tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [18/21] incubator-tamaya git commit: TAMAYA-113: Remove Java 8 related parts - basic work done.
Date Tue, 29 Sep 2015 07:01:23 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java b/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
new file mode 100644
index 0000000..64bb9ed
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
@@ -0,0 +1,116 @@
+/*
+ * 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.spi;
+
+import java.util.Objects;
+import java.util.ServiceLoader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tamaya.ConfigException;
+
+
+/**
+ * This singleton provides access to the services available in the current {@link ServiceContext}. The
+ * behaviour can be adapted, by calling {@link ServiceContextManager#set(ServiceContext)} before accessing any
+ * services.
+ */
+public final class ServiceContextManager {
+
+    /** The logger used. */
+    private static final Logger LOG = Logger.getLogger(ServiceContextManager.class.getName());
+
+    /**
+     * The ServiceProvider used.
+     */
+    private static volatile ServiceContext serviceContextProviderDelegate;
+
+    /**
+     * Private singletons constructor.
+     */
+    private ServiceContextManager() {
+    }
+
+    /**
+     * Load the {@link ServiceContext} to be used.
+     *
+     * @return {@link ServiceContext} to be used for loading the services.
+     */
+    private static ServiceContext loadDefaultServiceProvider() {
+        ServiceContext highestServiceContext = null;
+        try {
+            int highestOrdinal = 0;
+            for (ServiceContext serviceContext : ServiceLoader.load(ServiceContext.class)) {
+                if (serviceContext.ordinal() > highestOrdinal) {
+                    highestServiceContext = serviceContext;
+                    highestOrdinal = serviceContext.ordinal();
+                }
+            }
+        } catch (Exception e) {
+            throw new ConfigException("ServiceContext not loadable", e);
+        }
+
+        if (highestServiceContext==null){
+            throw new ConfigException("No ServiceContext found");
+        }
+        LOG.info("Using Service Context of type: " + highestServiceContext.getClass().getName());
+        return highestServiceContext;
+    }
+
+    /**
+     * Replace the current {@link ServiceContext} in use.
+     *
+     * @param serviceContextProvider the new {@link ServiceContext}, not null.
+     */
+    public static ServiceContext set(ServiceContext serviceContextProvider) {
+        ServiceContext currentContext = ServiceContextManager.serviceContextProviderDelegate;
+        Objects.requireNonNull(serviceContextProvider);
+
+        synchronized (ServiceContextManager.class) {
+            if (ServiceContextManager.serviceContextProviderDelegate == null) {
+                ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
+                LOG.log(Level.INFO, "Using ServiceProvider: " + serviceContextProvider.getClass().getName());
+            } else {
+                LOG.log(Level.WARNING, "Replacing ServiceProvider " +
+                                ServiceContextManager.serviceContextProviderDelegate.getClass().getName() +
+                                " with: " + serviceContextProvider.getClass().getName());
+                ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
+            }
+        }
+
+        return currentContext;
+    }
+
+    /**
+     * Ge {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
+     *
+     * @return the {@link ServiceContext} used.
+     */
+    public static ServiceContext getServiceContext() {
+        if (serviceContextProviderDelegate == null) {
+            synchronized (ServiceContextManager.class) {
+                if (serviceContextProviderDelegate == null) {
+                    serviceContextProviderDelegate = loadDefaultServiceProvider();
+                }
+            }
+        }
+        return serviceContextProviderDelegate;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java b/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
new file mode 100644
index 0000000..fa7da0a
--- /dev/null
+++ b/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya;
+
+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/b6dc2eed/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/ConfigurationTest.java b/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
new file mode 100644
index 0000000..11a16b9
--- /dev/null
+++ b/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.*;
+
+/**
+ * Test class that tests the default methods implemented on {@link org.apache.tamaya.Configuration}. The provided
+ * {@link org.apache.tamaya.TestConfiguration} is implemeted with maximal use of the default methods.
+ */
+public class ConfigurationTest {
+
+    @Test
+    public void testget() throws Exception {
+        assertEquals(Boolean.TRUE, ConfigurationProvider.getConfiguration().get("booleanTrue", Boolean.class));
+        assertEquals(Boolean.FALSE, ConfigurationProvider.getConfiguration().get("booleanFalse", Boolean.class));
+        assertEquals((int)Byte.MAX_VALUE, (int)ConfigurationProvider.getConfiguration().get("byte", Byte.class));
+        assertEquals((int)Integer.MAX_VALUE, (int)ConfigurationProvider.getConfiguration().get("int", Integer.class));
+        assertEquals((long)Long.MAX_VALUE, (long)ConfigurationProvider.getConfiguration().get("long", Long.class));
+        assertEquals((double)Float.MAX_VALUE, (double)ConfigurationProvider.getConfiguration().get("float", Float.class), 0.0d);
+        assertEquals((double)Double.MAX_VALUE, (double)ConfigurationProvider.getConfiguration().get("double", Double.class), 0.0d);
+    }
+
+    @Test
+    public void testGetBoolean() throws Exception {
+        assertTrue(ConfigurationProvider.getConfiguration().get("booleanTrue", Boolean.class));
+        assertFalse(ConfigurationProvider.getConfiguration().get("booleanFalse", Boolean.class));
+        assertFalse(ConfigurationProvider.getConfiguration().get("foorBar", Boolean.class));
+    }
+
+    @Test
+    public void testGetInteger() throws Exception {
+        assertEquals(Integer.MAX_VALUE,(int) ConfigurationProvider.getConfiguration().get("int", Integer.class));
+    }
+
+    @Test
+    public void testGetLong() throws Exception {
+        assertEquals(Long.MAX_VALUE,(long) ConfigurationProvider.getConfiguration().get("long", Long.class));
+    }
+
+    @Test
+    public void testGetDouble() throws Exception {
+        assertEquals(Double.MAX_VALUE,(double) ConfigurationProvider.getConfiguration().get("double", Double.class), 0.0d);
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/api/src/test/java/org/apache/tamaya/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/TestConfiguration.java b/api/src/test/java/org/apache/tamaya/TestConfiguration.java
new file mode 100644
index 0000000..31de765
--- /dev/null
+++ b/api/src/test/java/org/apache/tamaya/TestConfiguration.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Test Configuration class, that is used to testdata the default methods provided by the API.
+ */
+public class TestConfiguration implements Configuration{
+
+    private static final Map<String, String> VALUES;
+    static {
+        VALUES = new HashMap<>();
+        VALUES.put("long", String.valueOf(Long.MAX_VALUE));
+        VALUES.put("int", String.valueOf(Integer.MAX_VALUE));
+        VALUES.put("double", String.valueOf(Double.MAX_VALUE));
+        VALUES.put("float", String.valueOf(Float.MAX_VALUE));
+        VALUES.put("short", String.valueOf(Short.MAX_VALUE));
+        VALUES.put("byte", String.valueOf(Byte.MAX_VALUE));
+        VALUES.put("booleanTrue", "true");
+        VALUES.put("booleanFalse", "false");
+        VALUES.put("String", "aStringValue");
+    }
+
+    @Override
+    public String get(String key) {
+        return VALUES.get(key);
+    }
+
+    @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 Configuration with(ConfigOperator operator) {
+        return null;
+    }
+
+    @Override
+    public <T> T query(ConfigQuery<T> query) {
+        throw new RuntimeException("Method not implemented yet.");
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        throw new RuntimeException("Method not implemented yet.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java b/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
new file mode 100644
index 0000000..1a02903
--- /dev/null
+++ b/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
@@ -0,0 +1,56 @@
+/*
+ * 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.apache.tamaya.spi.ConfigurationContext;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spi.ConfigurationProviderSpi;
+
+/**
+ * Test Configuration class, that is used to testdata the default methods provided by the API.
+ */
+public class TestConfigurationProvider implements ConfigurationProviderSpi {
+
+    private static final Configuration config = new TestConfiguration();
+
+    @Override
+    public Configuration getConfiguration() {
+        return config;
+    }
+
+    @Override
+    public ConfigurationContext getConfigurationContext() {
+        return null;
+    }
+
+    @Override
+    public void setConfigurationContext(ConfigurationContext context) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isConfigurationContextSettable() {
+        return false;
+    }
+
+    @Override
+    public ConfigurationContextBuilder getConfigurationContextBuilder() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java b/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
new file mode 100644
index 0000000..51edae9
--- /dev/null
+++ b/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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/b6dc2eed/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java b/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
new file mode 100644
index 0000000..e8c7f90
--- /dev/null
+++ b/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.spi;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Test;
+
+public class ServiceContextTest {
+
+    private ServiceContext serviceContext = new ServiceContext(){
+
+        @Override
+        public int ordinal() {
+            return 1;
+        }
+
+        @Override
+        public <T> T getService(Class<T> serviceType) {
+            if(String.class.equals(serviceType)){
+                return serviceType.cast("ServiceContextTest");
+            }
+            return null;
+        }
+
+        @Override
+        public <T> List<T> getServices(Class<T> serviceType) {
+            if(String.class.equals(serviceType)){
+                List<String> list = new ArrayList<>();
+                list.add("ServiceContextTest");
+                return List.class.cast(list);
+            }
+            return Collections.emptyList();
+        }
+    };
+
+    @Test
+    public void testOrdinal() throws Exception {
+        assertEquals(1, serviceContext.ordinal());
+    }
+
+    @Test
+    public void testgetService() throws Exception {
+        assertEquals("ServiceContextTest", serviceContext.getService(String.class));
+        assertNull(serviceContext.getService(Integer.class));
+    }
+
+    @Test
+    public void testGetService() throws Exception {
+        String service = serviceContext.getService(String.class);
+        assertNotNull(service);
+        assertEquals("ServiceContextTest", service);
+        Integer intService = serviceContext.getService(Integer.class);
+        assertNull(intService);
+    }
+
+    @Test
+    public void testGetServices() throws Exception {
+        Collection<String> services = serviceContext.getServices(String.class);
+        assertNotNull(services);
+        assertFalse(services.isEmpty());
+        assertEquals("ServiceContextTest", services.iterator().next());
+        List<Integer> intServices = serviceContext.getServices(Integer.class);
+        assertNotNull(intServices);
+        assertTrue(intServices.isEmpty());
+    }
+
+    @Test
+    public void testGetInstance() throws Exception {
+        assertNotNull(ServiceContextManager.getServiceContext());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java b/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
new file mode 100644
index 0000000..4df7340
--- /dev/null
+++ b/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
@@ -0,0 +1,90 @@
+/*
+ * 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.spi;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * This class implements the (default) {@link org.apache.tamaya.spi.ServiceContext} interface and hereby uses the JDK
+ * {@link java.util.ServiceLoader} to load the services required.
+ */
+public final class TestServiceContext implements ServiceContext {
+    /** List current services loaded, per class. */
+    private final ConcurrentHashMap<Class<?>, List<Object>> servicesLoaded = new ConcurrentHashMap<>();
+
+    private final Map<Class<?>, Object> singletons = new ConcurrentHashMap<>();
+
+    @Override
+    public int ordinal() {
+        return 1;
+    }
+
+    @Override
+    public <T> T getService(Class<T> serviceType) {
+        T cached = serviceType.cast(singletons.get(serviceType));
+        if(cached==null) {
+            Collection<T> services = getServices(serviceType);
+            if (services.isEmpty()) {
+                cached = (T) Object.class; // as marker for 'nothing here'
+            }
+            else{
+                cached = services.iterator().next();
+            }
+            singletons.put((Class)serviceType, cached);
+        }
+        if (cached == Object.class) {
+            cached = null;
+        }
+        return cached;
+    }
+
+    /**
+     * Loads and registers services.
+     *
+     * @param   <T>          the concrete type.
+     *
+     * @param   serviceType  The service type.
+     * @return  the items found, never {@code null}.
+     */
+    @Override
+    public <T> List<T> getServices(Class<T> serviceType) {
+        try {
+            List<T> services = new ArrayList<>();
+            for (T t : ServiceLoader.load(serviceType)) {
+                services.add(t);
+            }
+            services = Collections.unmodifiableList(services);
+            final List<T> previousServices = List.class.cast(servicesLoaded.putIfAbsent(serviceType, (List<Object>)services));
+            return previousServices != null ? previousServices : services;
+        } catch (Exception e) {
+            Logger.getLogger(TestServiceContext.class.getName()).log(Level.WARNING,
+                                      "Error loading services current type " + serviceType, e);
+            return Collections.emptyList();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi b/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
new file mode 100644
index 0000000..b9c5ba5
--- /dev/null
+++ b/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
@@ -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.TestConfigurationProvider

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
new file mode 100644
index 0000000..199956f
--- /dev/null
+++ b/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
@@ -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.spi.TestServiceContext
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/pom.xml
----------------------------------------------------------------------
diff --git a/attic/java8/api/pom.xml b/attic/java8/api/pom.xml
new file mode 100644
index 0000000..0d4e8a5
--- /dev/null
+++ b/attic/java8/api/pom.xml
@@ -0,0 +1,43 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy 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</groupId>
+        <artifactId>tamaya-java8</artifactId>
+        <version>0.2-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>tamaya-api</artifactId>
+    <name>Apache Tamaya Java 8 API</name>
+    <description>
+        The API defines a complete SE based API for reading of configuration data.
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigException.java b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
new file mode 100644
index 0000000..e3b6fb8
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+/**
+ * Exception class (runtime exception) for configuration issues.
+ */
+public class ConfigException extends RuntimeException {
+
+    private static final long serialVersionUID = -5886094818057522680L;
+
+    /**
+     * Creates a new configuration exception.
+     *
+     * @param message the exception message, not null.
+     */
+    public ConfigException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new configuration exception.
+     *
+     * @param message the exception message, not null.
+     * @param t       the throwable.
+     */
+    public ConfigException(String message, Throwable t) {
+        super(message, t);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/ConfigOperator.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigOperator.java b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigOperator.java
new file mode 100644
index 0000000..35c583c
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigOperator.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+/**
+ * Models a function that maps a given {@link Configuration} to another {@link Configuration}. This can be used
+ * to modell additional functionality and applying it to a given {@link Configuration} instance by calling
+ * the {@link Configuration#with(ConfigOperator)} method.
+ */
+@FunctionalInterface
+public interface ConfigOperator {
+
+    /**
+     * Creates a new {@link Configuration} based on the given Configuration. Operators basically acts similar to
+     * decorators, whereas operated instances may have non compatible behaviour, e.g. by applying security constraints
+     * or view restrictions.
+     *
+     * @param config the input configuration, not null.
+     * @return the operated configuration, never null.
+     */
+    Configuration operate(Configuration config);
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/ConfigQuery.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigQuery.java b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigQuery.java
new file mode 100644
index 0000000..6151d03
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigQuery.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+/**
+ * Models a function that maps a given {@link org.apache.tamaya.Configuration} to something else. This can be used
+ * to model additional functionality and applying it to a given {@link org.apache.tamaya.Configuration} instance by
+ * calling the {@link org.apache.tamaya.Configuration#query(org.apache.tamaya.ConfigQuery)} method.
+ * @param <T> the result type of the query.
+ */
+@FunctionalInterface
+public interface ConfigQuery<T> {
+
+    /**
+     * Creates a result based on the given Configuration. Queries basically acts similar to
+     * operators, whereas they returns any kind of result.
+     *
+     * @param config the input configuration, not null.
+     * @return the query result.
+     */
+    T query(Configuration config);
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/Configuration.java b/attic/java8/api/src/main/java/org/apache/tamaya/Configuration.java
new file mode 100644
index 0000000..583a1bf
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/Configuration.java
@@ -0,0 +1,232 @@
+/*
+ * 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 java.util.Map;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+
+
+/**
+ * A configuration models a aggregated set current properties, identified by a unique key, but adds higher level access functions to
+ * a {@link org.apache.tamaya.spi.PropertySource}. Hereby in most cases a configuration is a wrapper around a composite
+ * {@link org.apache.tamaya.spi.PropertySource} instance, which may combine multiple child config in well defined tree like structure,
+ * where nodes define logically the rules current priority, filtering, combination and overriding.
+ * <br/>
+ * <h3>Implementation Requirements</h3>
+ * Implementations current this interface must be
+ * <ul>
+ * <li>Thread safe.
+ * <li>Immutable
+ * </ul>
+ * It is not recommended that implementations also are serializable, since the any configuration can be <i>freezed</i>
+ * by reading out its complete configuration map into a serializable and remotable structure. This helps significantly
+ * simplifying the development current this interface, e.g. for being backed up by systems and stores that are not part current
+ * this library at all.
+ */
+public interface Configuration {
+
+    /**
+     * Access a property.
+     *
+     * @param key the property's key, not null.
+     * @return the property's value or {@code null}.
+     */
+    default String get(String key) {
+        return getProperties().get(key);
+    }
+
+
+    /**
+     * Get the property keys as type T. This will implicitly require a corresponding {@link
+     * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
+     * fromMap the given String keys.
+     *
+     * @param key  the property's absolute, or relative path, e.g. @code
+     *             a/b/c/d.myProperty}.
+     * @param type The target type required, not null.
+     * @param <T>  the target type.
+     * @return the property value, never null..
+     * @throws ConfigException if the keys could not be converted to the required target type.
+     */
+    default <T> T get(String key, Class<T> type) {
+        return get(key, TypeLiteral.of(type));
+    }
+
+    /**
+     * Get the property keys as type T. This will implicitly require a corresponding {@link
+     * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
+     * fromMap the given String keys.
+     *
+     * @param key  the property's absolute, or relative path, e.g. @code
+     *             a/b/c/d.myProperty}.
+     * @param type The target type required, not null.
+     * @param <T>  the target type.
+     * @return the property value, or null, if the underlying value is null as well.
+     * @throws ConfigException if the value could not be converted to the required target type by any of the
+     *                         registered converters.
+     */
+    <T> T get(String key, TypeLiteral<T> type);
+
+    /**
+     * Access a property.
+     *
+     * @param key the property's key, not null.
+     * @return the property's keys.
+     */
+    default Optional<String> getOptional(String key) {
+        return Optional.ofNullable(get(key));
+    }
+
+    /**
+     * Get the property keys as type T. This will implicitly require a corresponding {@link
+     * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
+     * fromMap the given String keys.
+     *
+     * @param key  the property's absolute, or relative path, e.g. @code
+     *             a/b/c/d.myProperty}.
+     * @param type The target type required, not null.
+     * @param <T>  the target type.
+     * @return the property value, never null..
+     * @throws ConfigException if the keys could not be converted to the required target type.
+     */
+    default <T> Optional<T> getOptional(String key, Class<T> type) {
+        return Optional.ofNullable(get(key, type));
+    }
+
+    /**
+     * Get the property keys as type T. This will implicitly require a corresponding {@link
+     * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
+     * fromMap the given String keys.
+     *
+     * @param key  the property's absolute, or relative path, e.g. @code
+     *             a/b/c/d.myProperty}.
+     * @param type The target type required, not null.
+     * @param <T>  the target type.
+     * @return the property value, never null..
+     * @throws ConfigException if the keys could not be converted to the required target type.
+     */
+    default <T> Optional<T> getOptional(String key, TypeLiteral<T> type) {
+        return Optional.ofNullable(get(key, type));
+    }
+
+    /**
+     * Access all current known Configuration properties as a full {@code Map<String,String>}.
+     * Be aware that entries from non scannable parts of the registered {@link org.apache.tamaya.spi.PropertySource}
+     * instances may not be contained in the result, but nevertheless be accessible calling one of the
+     * {@code get(...)} methods.
+     *
+     * @return the current properties. These may not include all properties from non-scannable
+     * {@link org.apache.tamaya.spi.PropertySource}s.
+     */
+    @SuppressWarnings("JavaDoc")
+    Map<String, String> getProperties();
+
+
+    /**
+     * Get the property keys as {@link Boolean}.
+     *
+     * @param key the property's absolute, or relative path, e.g. {@code
+     *            a/b/c/d.myProperty}.
+     * @return the property's keys.
+     * @throws ConfigException if the configured value could not be converted to the target type.
+     * @since Java8
+     */
+    default Optional<Boolean> getBoolean(String key) {
+        return getOptional(key, Boolean.class);
+    }
+
+    /**
+     * Get the property keys as {@link Integer}.
+     *
+     * @param key the property's absolute, or relative path, e.g. @code
+     *            a/b/c/d.myProperty}.
+     * @return the property's keys.
+     * @throws ConfigException if the configured value could not be converted to the target type.
+     * @since Java8
+     */
+    default OptionalInt getInteger(String key) {
+        Optional<Integer> val = getOptional(key, Integer.class);
+
+        if (val.isPresent()) {
+            return OptionalInt.of(val.get());
+        }
+        return OptionalInt.empty();
+    }
+
+    /**
+     * Get the property keys as {@link Long}.
+     *
+     * @param key the property's absolute, or relative path, e.g. @code
+     *            a/b/c/d.myProperty}.
+     * @return the property's keys.
+     * @throws ConfigException if the configured value could not be converted to the target type.
+     * @since Java8
+     */
+    default OptionalLong getLong(String key) {
+        Optional<Long> val = getOptional(key, Long.class);
+        if (val.isPresent()) {
+            return OptionalLong.of(val.get());
+        }
+        return OptionalLong.empty();
+    }
+
+    /**
+     * Get the property keys as {@link Double}.
+     *
+     * @param key the property's absolute, or relative path, e.g. @code
+     *            a/b/c/d.myProperty}.
+     * @return the property's keys.
+     * @throws ConfigException if the configured value could not be converted to the target type.
+     * @since Java8
+     */
+    default OptionalDouble getDouble(String key) {
+
+        Optional<Double> val = getOptional(key, Double.class);
+        if (val.isPresent()) {
+            return OptionalDouble.of(val.get());
+        }
+        return OptionalDouble.empty();
+    }
+
+    /**
+     * Extension point for adjusting configuration.
+     *
+     * @param operator A configuration operator, e.g. a filter, or an adjuster
+     *                 combining configurations.
+     * @return the new adjusted configuration, never {@code null}.
+     */
+    default Configuration with(ConfigOperator operator) {
+        return operator.operate(this);
+    }
+
+    /**
+     * Query a configuration.
+     *
+     * @param query the query, never {@code null}.
+     * @param <T>       the target query result type.
+     * @return the result
+     */
+    default <T> T query(ConfigQuery<T> query) {
+        return query.query(this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
new file mode 100644
index 0000000..03bd262
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
@@ -0,0 +1,87 @@
+/*
+ * 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.apache.tamaya.spi.ConfigurationContext;
+import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spi.ConfigurationProviderSpi;
+import org.apache.tamaya.spi.ServiceContextManager;
+
+import java.util.Objects;
+
+/**
+ * Static access to the {@link org.apache.tamaya.Configuration} for the very application.
+ */
+public final class ConfigurationProvider {
+
+    private static final ConfigurationProviderSpi PROVIDER_SPI = Objects.requireNonNull(ServiceContextManager.getServiceContext()
+            .getService(ConfigurationProviderSpi.class));
+
+    private ConfigurationProvider() {
+        // just to prevent initialisation
+    }
+
+    /**
+     * Access the current configuration.
+     *
+     * @return the corresponding Configuration instance, never null.
+     */
+    public static Configuration getConfiguration() {
+        return PROVIDER_SPI.getConfiguration();
+    }
+
+    /**
+     * Get access to the current ConfigurationContext.
+     *
+     * @return the current ConfigurationContext, never null.
+     */
+    public static ConfigurationContext getConfigurationContext() {
+        return PROVIDER_SPI.getConfigurationContext();
+    }
+
+    /**
+     * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new
+     * instance. This can be used to update the context with a new one, e.g. because some of the configuration
+     * data has changed and should be updated. It is the responsibility of the ConfigurationProvider to trigger
+     * corresponding update events for the current {@link org.apache.tamaya.Configuration}, so observing
+     * listeners can do whatever is appropriate to react to any given configuration changes.
+     *
+     * @param context the new ConfigurationContext to be applied.
+     * @throws java.lang.UnsupportedOperationException if the current provider is read-only and does not support
+     *                                                 applying a new ConfigurationContext.
+     */
+    public static void setConfigurationContext(ConfigurationContext context) {
+        PROVIDER_SPI.setConfigurationContext(context);
+    }
+
+    /**
+     * Create a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance. This method creates
+     * a new builder instance that is not related to any concrete {@link org.apache.tamaya.spi.ConfigurationContext}.
+     * You can use {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} to change the
+     * current configuration context.
+     *
+     * @return a new, empty {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
+     * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
+     * @see org.apache.tamaya.spi.ConfigurationContext
+     */
+    public static ConfigurationContextBuilder getConfigurationContextBuilder() {
+        return PROVIDER_SPI.getConfigurationContextBuilder();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java b/attic/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
new file mode 100644
index 0000000..5aa4f4c
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
@@ -0,0 +1,202 @@
+/*
+ * 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 java.io.Serializable;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+
+/**
+ * <p>Class for instantiation of objects that represent parameterized types
+ * with current parameters.</p>
+ * <p>
+ * <p>An object that represents a parameterized type may be obtained by
+ * subclassing <tt>TypeLiteral</tt>.</p>
+ * <p>
+ * <pre>
+ * TypeLiteral&lt;List&lt;Integer&gt;&gt; stringListType = new TypeLiteral&lt;List&lt;Integer&gt;&gt;() {};
+ * </pre>
+ *
+ * @param <T> the type, including all type parameters
+ */
+public class TypeLiteral<T> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    private static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
+    /** The current defined type. */
+    private Type definedType;
+
+    /**
+     * Constructor.
+     * @param definedType the defined type.
+     */
+    protected TypeLiteral(Type definedType) {
+        this.definedType = definedType;
+    }
+
+    /**
+     * Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
+     */
+    protected TypeLiteral() {
+        this.definedType = getDefinedType(this.getClass());
+    }
+
+    /**
+     * Creates a new TypeLiteral based on a given type.
+     *
+     * @param type the type , not null.
+     * @param <R>  the literal generic type.
+     * @return the corresponding TypeLiteral, never null.
+     */
+    public static <R> TypeLiteral<R> of(Type type) {
+        return new TypeLiteral<>(type);
+    }
+
+    /**
+     * Checks the current implemented generic interfaces and evaluates the given single type parameter.
+     *
+     * @param clazz         the class to check, not null.
+     * @param interfaceType the interface type to be checked, not null.
+     * @return the generic type parameter, or null, if it cannot be evaluated.
+     */
+    public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
+        for (Type type : clazz.getGenericInterfaces()) {
+            if (type instanceof ParameterizedType) {
+                ParameterizedType parameterizedType = (ParameterizedType) type;
+                if(parameterizedType.getRawType().equals(interfaceType)){
+                    return parameterizedType.getActualTypeArguments();
+                }
+            }
+        }
+        return EMPTY_TYPE_ARRAY;
+    }
+
+    /**
+     * Method that checks the class's type for a generic interface implementation type.
+     *
+     * @param type         the type, not null.
+     * @return the generic type parameter of the given single type generic interfaceType, or null.
+     */
+    public static Type[] getTypeParameters(Type type) {
+        if (type instanceof ParameterizedType) {
+            ParameterizedType parameterizedType = (ParameterizedType) type;
+            return parameterizedType.getActualTypeArguments();
+        }
+        return EMPTY_TYPE_ARRAY;
+    }
+
+    public final Type getType() {
+        return definedType;
+    }
+
+    /**
+      * Returns basic raw Java type.
+      *
+      * @return the actual type represented by this object
+      */
+    public final Class<T> getRawType() {
+        Class<T> rawType = null;
+
+        if (this.definedType instanceof Class) {
+            rawType = (Class<T>) this.definedType;
+        } else if (this.definedType instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) this.definedType;
+            rawType = (Class<T>) pt.getRawType();
+
+        } else if (this.definedType instanceof GenericArrayType) {
+            rawType = (Class<T>) Object[].class;
+        } else {
+            throw new RuntimeException("Illegal type for the Type Literal Class");
+        }
+
+        return rawType;
+    }
+
+
+    protected Type getDefinedType(Class<?> clazz) {
+        Type type = null;
+
+        if (clazz == null) {
+            throw new RuntimeException("Class parameter clazz can not be null");
+        }
+
+        Type superClazz = clazz.getGenericSuperclass();
+
+        if (superClazz.equals(Object.class)) {
+            throw new RuntimeException("Super class must be parametrized type");
+        } else if (superClazz instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) superClazz;
+            Type[] actualArgs = pt.getActualTypeArguments();
+
+            if (actualArgs.length == 1) {
+                type = actualArgs[0];
+
+            } else {
+                throw new RuntimeException("More than one parametric type");
+            }
+
+        } else {
+            type = getDefinedType((Class<?>) superClazz);
+        }
+
+        return type;
+    }
+
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((definedType == null) ? 0 : definedType.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        TypeLiteral other = (TypeLiteral) obj;
+        if (definedType == null) {
+            if (other.definedType != null) {
+                return false;
+            }
+        } else if (!definedType.equals(other.definedType)) {
+            return false;
+        }
+        return true;
+    }
+
+
+    @Override
+    public String toString() {
+        return "TypeLiteral{" +
+                "type=" + definedType +
+                '}';
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
new file mode 100644
index 0000000..24efdeb
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
@@ -0,0 +1,152 @@
+/*
+ * 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.spi;
+
+import org.apache.tamaya.TypeLiteral;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+/**
+ * Central SPI for programmatically dealing with the setup of the configuration system.
+ * This includes adding and enlisting {@link org.apache.tamaya.spi.PropertySource}s,
+ * managing {@link PropertyConverter}s, ConfigFilters, etc.
+ */
+public interface ConfigurationContext {
+
+    /**
+     * This method returns the current list of registered PropertySources ordered via their ordinal.
+     * PropertySources with a lower ordinal come last. The PropertySource with the
+     * highest ordinal comes first.
+     * If two PropertySources have the same ordinal number they will get sorted
+     * using their class name just to ensure the user at least gets the same ordering
+     * after a JVM restart, hereby names before are added last.
+     * PropertySources are loaded when this method is called the first time, which basically is
+     * when the first time configuration is accessed.
+     *
+     * @return a sorted list of registered PropertySources.  The returned list need not be modifiable
+     */
+    List<PropertySource> getPropertySources();
+
+    /**
+     * This method returns a subset ot the currently registered PropertySources.
+     *
+     * @param selector the selector query, not null.
+     * @return a collectino of selected PropertySources.
+     */
+    default Collection<PropertySource> getPropertySources(Predicate<PropertySource> selector){
+        return getPropertySources().stream().filter(selector).collect(Collectors.toList());
+    }
+
+    /**
+     * <p>
+     * This method returns the Map of registered PropertyConverters
+     * per type.
+     * The List for each type is ordered via their {@link javax.annotation.Priority} and
+     * class name.
+     * </p>
+     * <p>
+     * A simplified scenario could be like:
+     * <pre>
+     *  {
+     *      Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
+     *      Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
+     *      Integer.class -> {DynamicDefaultConverter}
+     *  }
+     * </pre>
+     * </p>
+     *
+     * @return map with sorted list of registered PropertySources per type.
+     */
+    Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters();
+
+    /**
+     * <p>
+     * This method returns the registered PropertyConverters for a given type.
+     * The List for each type is ordered via their {@link javax.annotation.Priority}.
+     * </p>
+     * <p>
+     * <p>
+     * PropertyConverters with a higher Priority come first. The PropertyConverter with the
+     * lowest Priority comes last.
+     * If two PropertyConverter have the same ordinal number they will get sorted
+     * using their class name just to ensure the user at least gets the same ordering
+     * after a JVM restart.
+     * </p>
+     * <p>
+     * <p>
+     * Additionally if a PropertyProvider is accessed, which is not registered the implementation
+     * should try to figure out, if there could be a default implementation as follows:
+     * <ol>
+     * <le>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
+     * instanceOf(String), fomr(String)}</le>
+     * <le>Look for a matching constructor: {@code T(String)}.</le>
+     * </ol>
+     * If a correspoding factory method or constructor could be found, a corresponding
+     * PropertyConverter should be created and registered automatically for the given
+     * type.
+     * </p>
+     * <p>
+     * <p>
+     * The scenario could be like:
+     * <pre>
+     *  {
+     *      Date.class -> {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
+     *      Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
+     *      Integer.class -> {DynamicDefaultConverter}
+     *  }
+     * </pre>
+     * </p>
+     * <p>
+     * <p>
+     * The converters returned for a type should be used as a chain, whereas the result of the
+     * first converter that is able to convert the configured value, is taken as the chain's result.
+     * No more converters are called after a converter has successfully converted the input into
+     * the required target type.
+     * </p>
+     *
+     * @return a sorted list of registered PropertySources per type.
+     */
+    <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> type);
+
+    /**
+     * Access the current PropertyFilter instances.
+     *
+     * @return the list of registered PropertyFilters, never null.
+     */
+    List<PropertyFilter> getPropertyFilters();
+
+    /**
+     * Access the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used to evaluate the final
+     * property values.
+     * @return the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used, never null.
+     */
+    PropertyValueCombinationPolicy getPropertyValueCombinationPolicy();
+
+    /**
+     * Creates a new updates instance for changing the current ConfigurationContext.
+     * @throws java.lang.UnsupportedOperationException if this ConfigurationContext is not updateable.
+     * @return a new ConfigurationContextUpdates instance.
+     */
+    ConfigurationContextBuilder toBuilder();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
new file mode 100644
index 0000000..e070450
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
@@ -0,0 +1,193 @@
+/*
+ * 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.spi;
+
+import org.apache.tamaya.TypeLiteral;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.function.Predicate;
+
+/**
+ * A builder for creating new or adapting instances of {@link org.apache.tamaya.spi.ConfigurationContext}.
+ * Builders can be obtained in exactly two ways:
+ * <ol>
+ *     <li>By accessing a preinitialized builder from an existing {@link org.apache.tamaya.spi.ConfigurationContext},
+ *     by calling {@link ConfigurationContext#toBuilder()}.</li>
+ *     <li>By accessing an empty builder instance from
+ *     {@link org.apache.tamaya.ConfigurationProvider#getConfigurationContextBuilder()}.</li>
+ * </ol>
+ * After all changes are applied to a builder a new {@link org.apache.tamaya.spi.ConfigurationContext} instance can
+ * be created and can be applied by calling
+ * {@link org.apache.tamaya.ConfigurationProvider#setConfigurationContext(ConfigurationContext)}. Since this method can
+ * throw an UnsupportedOperationException, you should check before if changing the current ConfigurationContext
+ * programmatically is supported by calling
+ * {@link org.apache.tamaya.ConfigurationProvider#isConfigurationContextSettable()}.
+ */
+public interface ConfigurationContextBuilder {
+
+    /**
+     * Init this builder instance with the given {@link org.apache.tamaya.spi.ConfigurationContext} instance. This
+     * method will replace any existing data in the current builder with the data contained in the given
+     * {@link org.apache.tamaya.spi.ConfigurationContext}.
+     *
+     * @param context the {@link org.apache.tamaya.spi.ConfigurationContext} instance to be used, not null.
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder setContext(ConfigurationContext context);
+
+    /**
+     * This method can be used for programmatically adding {@link org.apache.tamaya.spi.PropertySource}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param propertySourcesToAdd the PropertySources to add
+     * @return this builder, for chaining, never null.
+     */
+    default ConfigurationContextBuilder addPropertySources(PropertySource... propertySourcesToAdd) {
+        return addPropertySources(Arrays.asList(propertySourcesToAdd));
+    }
+
+
+    /**
+     * This method can be used for programmatically adding {@link org.apache.tamaya.spi.PropertySource}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param propertySourcesToAdd the PropertySources to add
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySourcesToAdd);
+
+    /**
+     * This method can be used for programmatically adding {@link org.apache.tamaya.spi.PropertySource}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param propertySourcesNames the PropertySource names of the sources to remove
+     * @return this builder, for chaining, never null.
+     */
+    default ConfigurationContextBuilder removePropertySources(String... propertySourcesNames) {
+        return removePropertySources(Arrays.asList(propertySourcesNames));
+    }
+
+    /**
+     * This method can be used for programmatically adding {@link org.apache.tamaya.spi.PropertySource}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param propertySourcesNames the PropertySource names of the sources to remove
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder removePropertySources(Collection<String> propertySourcesNames);
+
+    /**
+     * Adds the given PropertyFilter instances.
+     *
+     * @param filters the filters to add
+     * @return this builder, for chaining, never null.
+     */
+    default ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters) {
+        return addPropertyFilters(Arrays.asList(filters));
+    }
+
+    /**
+     * Adds the given PropertyFilter instances.
+     *
+     * @param filters the filters to add
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters);
+
+    /**
+     * Removes the given PropertyFilter instances.
+     *
+     * @param filters the filters to remove
+     * @return this builder, for chaining, never null.
+     */
+    default ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters) {
+        return removePropertyFilters(Arrays.asList(filters));
+    }
+
+    /**
+     * Removes the given PropertyFilter instances.
+     *
+     * @param selector the selector query, not null.
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder removePropertyFilters(Predicate<PropertyFilter> selector);
+
+    /**
+     * Removes the given PropertyFilter instances.
+     *
+     * @param filters the filters to remove
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters);
+
+    /**
+     * Remove the property sources selected by the given selector predicate.
+     *
+     * @param selector the selector query, not null.
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder removePropertySources(Predicate<PropertySource> selector);
+
+    /**
+     * This method can be used for programmatically adding {@link PropertyConverter}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param typeToConvert     the type which the converter is for
+     * @param propertyConverter the PropertyConverters to add for this type
+     * @return this builder, for chaining, never null.
+     */
+    <T> ConfigurationContextBuilder addPropertyConverter(TypeLiteral<T> typeToConvert,
+                                                         PropertyConverter<T> propertyConverter);
+
+    /**
+     * Removes the given PropertyConverter instances.
+     *
+     * @param typeToConvert the type which the converter is for
+     * @param converters    the converters to remove
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
+                                                         PropertyConverter<?>... converters);
+
+    /**
+     * Removes the given PropertyConverter instances.
+     *
+     * @param typeToConvert the type which the converter is for
+     * @param converters    the converters to remove
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
+                                                         Collection<PropertyConverter<?>> converters);
+
+    /**
+     * Sets the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used to evaluate the final
+     * property values.
+     *
+     * @param policy the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used, not null
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy);
+
+    /**
+     * Builds a {@link org.apache.tamaya.spi.ConfigurationContext} based on the data set.
+     */
+    ConfigurationContext build();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
new file mode 100644
index 0000000..b2cc381
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
@@ -0,0 +1,77 @@
+/*
+ * 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.spi;
+
+import org.apache.tamaya.Configuration;
+
+/**
+ * SPI that must be implemented to provide the component that manages all {@link org.apache.tamaya.Configuration}
+ * instances in a system. In SE this may be a true singleton containing exact one {@link org.apache.tamaya.Configuration}
+ * instance, whereas in Java EE and other more complex environments instances may be returned depending the current
+ * runtime context.
+ */
+public interface ConfigurationProviderSpi {
+
+    /**
+     * Access the current {@link org.apache.tamaya.Configuration}.
+     *
+     * @return the current {@link org.apache.tamaya.Configuration} instance, never null.
+     */
+    Configuration getConfiguration();
+
+    /**
+     * Get access to the current {@link org.apache.tamaya.spi.ConfigurationContext}.
+     *
+     * @return the current {@link org.apache.tamaya.spi.ConfigurationContext}, never null.
+     */
+    ConfigurationContext getConfigurationContext();
+
+    /**
+     * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new
+     * instance. This can be used to update the context with a new one, e.g. because some of the configuration
+     * data has changed and must be updated. It is the responsibility of the ConfigurationProvider to trigger
+     * corresponding update event for the current {@link org.apache.tamaya.spi.ConfigurationContext} or
+     * {@link org.apache.tamaya.Configuration}.
+     *
+     * @param context the new ConfigurationContext to be applied.
+     * @throws java.lang.UnsupportedOperationException if the current provider is read-only.
+     */
+    default void setConfigurationContext(ConfigurationContext context){
+        throw new UnsupportedOperationException("By default a ConfigurationContext cannot not be switched later.");
+    }
+
+    /**
+     * Method that allows to determine if a new {@link org.apache.tamaya.spi.ConfigurationContext} can be applied
+     * programmatically.
+     * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
+     * @return true, if {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} is supported
+     * by the current implementation.
+     */
+    default boolean isConfigurationContextSettable(){
+        return false;
+    }
+
+    /**
+     * Creates a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance.
+     *
+     * @return a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
+     */
+    ConfigurationContextBuilder getConfigurationContextBuilder();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
new file mode 100644
index 0000000..b69953e
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
@@ -0,0 +1,49 @@
+/*
+ * 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.spi;
+
+
+/**
+ * Interface for an property that converts a configured String into something else.
+ * This is used for implementing type conversion from a property (String) to a certain target
+ * type. Hereby the target type can be multivalued (eg collections) or complex if needed.
+ * @param <T> the result/target type of the converter.
+ */
+public interface PropertyConverter<T> {
+
+    /**
+     * Convert the given configuration keys from it's String representation into the required target type.
+     * <b>IMPORTANT NOTE: </b> Multiple instances of this type are ordered in a chain of converters that
+     * try to parse/convert a configured value. The first non-null result returned by a converter is
+     * used as the final result of the conversion. As a consequence implementations of this class must
+     * only return non-null values that are the result of a successful conversion of an entry.
+     *
+     * @param value the configuration value, not null.
+     * @return the converted value, or {@code null} if the value could not be converted. Returning a non-null
+     *         value will stop the conversion process and return the value as result (converted value).
+     */
+    T convert(String value);
+
+    //X TODO probably add some diagnostic info which explains what kind of
+    //X format(s) is supported.
+    //X This could be useful if e.g. no converter in the chain felt responsible
+    //X because a wrongly formatted configuration string had been used.
+    //X This could probably also be handled via an additional Annotation on the converter.
+    //X Collection<String> getSupportedFormats();
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/b6dc2eed/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
new file mode 100644
index 0000000..1fd8c36
--- /dev/null
+++ b/attic/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
@@ -0,0 +1,49 @@
+/*
+ * 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.spi;
+
+
+/**
+ * <p>Interface for filtering the current map of properties during the evaluation of the chain of PropertySources.
+ * Filters can be registered using the {@link org.apache.tamaya.spi.ServiceContext}. The ordinal
+ * hereby is defined by the corresponding {@code @Priority} annotation.</p>
+ * <p>Filters </p>
+ */
+public interface PropertyFilter {
+
+    /**
+     * <p>Maps the current {@code valueToBeFiltered} value to a new value. The resulting value will be used as the result
+     * passed to the user.</p>
+     * <p>If a filter is currently not available, it should just pass the input map to the method's
+     * output.</p>
+     * <p>Returning {@code null} will remove the entry and Optional.empty() will be returned to the user.</p>
+     * <h3>Implementation specification</h3>
+     * Implementations of this class must be
+     * <ul>
+     * <li>reentrant</li>
+     * <li>thread-safe</li>
+     * </ul>
+     *
+     * @param key               the key accessed, not null.
+     * @param valueToBeFiltered the value to be filtered, not null.
+     * @return the filtered value, or {@code null} if the value should be removed alltogether.
+     */
+    String filterProperty(String key, String valueToBeFiltered);
+
+}


Mime
View raw message