You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by st...@apache.org on 2014/12/29 01:40:48 UTC

incubator-tamaya git commit: move reviewed core APIs and SPIs back in place

Repository: incubator-tamaya
Updated Branches:
  refs/heads/master d9b2cf418 -> c4e24709b


move reviewed core APIs and SPIs back in place

done together with anatole and rsandtner


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

Branch: refs/heads/master
Commit: c4e24709b13774413bf18d42b0fb41344648b00b
Parents: d9b2cf4
Author: Mark Struberg <st...@apache.org>
Authored: Mon Dec 29 01:39:28 2014 +0100
Committer: Mark Struberg <st...@apache.org>
Committed: Mon Dec 29 01:39:28 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/tamaya/ConfigException.java |  44 +++
 .../java/org/apache/tamaya/Configuration.java   | 197 ++++++++++
 .../org/apache/tamaya/spi/PropertyAdapter.java  |  38 ++
 .../org/apache/tamaya/spi/PropertySource.java   | 117 ++++++
 .../tamaya/spi/PropertySourceProvider.java      |  43 +++
 .../org/apache/tamaya/spi/ServiceContext.java   | 114 ++++++
 .../tamaya/spi/ServiceContextManager.java       | 106 ++++++
 .../java/org/apache/tamaya/ConfigException.java |  44 ---
 .../java/org/apache/tamaya/Configuration.java   | 366 -------------------
 .../java/org/apache/tamaya/PropertyAdapter.java |  89 -----
 .../java/org/apache/tamaya/PropertySource.java  | 129 -------
 .../org/apache/tamaya/spi/ServiceContext.java   | 109 ------
 .../tamaya/spi/ServiceContextManager.java       | 100 -----
 pom.xml                                         |  16 +-
 14 files changed, 674 insertions(+), 838 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/api/src/main/java/org/apache/tamaya/ConfigException.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/ConfigException.java b/api/src/main/java/org/apache/tamaya/ConfigException.java
new file mode 100644
index 0000000..bac2ef4
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/ConfigException.java
@@ -0,0 +1,44 @@
+/*
+ * 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/c4e24709/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/Configuration.java b/api/src/main/java/org/apache/tamaya/Configuration.java
new file mode 100644
index 0000000..ef9955d
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/Configuration.java
@@ -0,0 +1,197 @@
+/*
+ * 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.PropertyAdapter;
+import org.apache.tamaya.spi.ServiceContext;
+
+import java.util.*;
+import java.util.function.Function;
+import java.util.function.UnaryOperator;
+
+/**
+ * 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 keys.
+     */
+    Optional<String> get(String key);
+
+
+    /**
+     * Get the property keys as type T. This will implicitly require a corresponding {@link
+     * PropertyAdapter} 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.
+     * @return the property value, never null..
+     * @throws ConfigException if the keys could not be converted to the required target
+     *                                  type.
+     */
+    <T> Optional<T> get(String key, Class<T> type);
+
+    /**
+     * Get the property keys as type {@code Class<T>}.
+     * <p>
+     * If {@code Class<T>} is not one current
+     * {@code Boolean, Short, Integer, Long, Float, Double, BigInteger,
+     * BigDecimal, String} , an according adapter must be
+     * available to perform the conversion fromMap {@link String} to
+     * {@code Class<T>}.
+     *
+     * @param key     the property's absolute, or relative path, e.g. @code
+     *                a/b/c/d.myProperty}.
+     * @param adapter the PropertyAdapter to perform the conversion fromMap
+     *                {@link String} to {@code Class<T>}, not {@code null}.
+     * @return the property's keys.
+     * @throws ConfigException if the keys could not be converted to the required target
+     *                                  type, or no such property exists.
+     */
+    default <T> Optional<T> getAdapted(String key, PropertyAdapter<T> adapter) {
+        Optional<String> value = get(key);
+        if (value.isPresent()) {
+            return Optional.ofNullable(adapter.adapt(value.get()));
+        }
+        return Optional.empty();
+    }
+
+
+    /**
+     * 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.
+     */
+    default Boolean getBoolean(String key) {
+        Optional<Boolean> val = get(key, Boolean.class);
+        if (val.isPresent()) {
+            return val.get();
+        }
+        return null;
+    }
+
+    /**
+     * 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.
+     */
+    default OptionalInt getInteger(String key) {
+        Optional<Integer> val = get(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.
+     */
+    default OptionalLong getLong(String key) {
+        Optional<Long> val = get(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.
+     */
+    default OptionalDouble getDouble(String key) {
+
+        Optional<Double> val = get(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(UnaryOperator<Configuration> operator) {
+        return operator.apply(this);
+    }
+
+
+    /**
+     * Query a configuration.
+     *
+     * @param query the query, never {@code null}.
+     * @return the result
+     */
+    default <T> T query(Function<Configuration,T> query) {
+        return query.apply(this);
+    }
+
+
+    /**
+     * Access a configuration.
+     *
+     * @return the corresponding Configuration instance, never null.
+     * @throws ConfigException if no such configuration is defined.
+     */
+    public static Configuration current(){
+        return ServiceContext.getInstance().getSingleton(Configuration.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/api/src/main/java/org/apache/tamaya/spi/PropertyAdapter.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertyAdapter.java b/api/src/main/java/org/apache/tamaya/spi/PropertyAdapter.java
new file mode 100644
index 0000000..1591228
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/spi/PropertyAdapter.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.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 eollections), complex or even contain
+ * full subconfigurations, if needed.
+ */
+@FunctionalInterface
+public interface PropertyAdapter<T>{
+
+    /**
+     * Adapt the given configuration keys to the required target type.
+     * @param value the configuration keys
+     * @return adapted keys
+     */
+    T adapt(String value);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertySource.java b/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
new file mode 100644
index 0000000..711b84b
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
@@ -0,0 +1,117 @@
+/*
+* 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.Map;
+import java.util.Optional;
+
+
+/**
+ * This interface models a provider that serves configuration properties. The contained
+ * properties may be read fromMap single or several sources (composite).<br/>
+ * PropertySources are the building blocks of the final configuration.
+ * <p/>
+ * <h3>Implementation Requirements</h3>
+ * <p></p>Implementations current this interface must be
+ * <ul>
+ * <li>Thread safe.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * <p>A PropertySourceProvider will get picked up via the
+ * {@link java.util.ServiceLoader} mechanism and can be registered via
+ * META-INF/services/org.apache.tamaya.spi.PropertySource
+ * </p>
+ * <p>
+ * If you like to register multiple PropertySources at the same time
+ * you can use the {@link org.apache.tamaya.spi.PropertySourceProvider}
+ * interface.
+ * </p>
+ */
+public interface PropertySource {
+
+    /**
+     * Lookup order:
+     * TODO rethink whole default PropertySources and ordering:
+     * TODO introduce default values or constants for ordinals
+     * <ol>
+     *     <li>System properties (ordinal 400)</li>
+     *     <li>Environment properties (ordinal 300)</li>
+     *     <li>JNDI values (ordinal 200)</li>
+     *     <li>Properties file values (/META-INF/applicationConfiguration.properties) (ordinal 100)</li>
+     * </ol>
+     * <p/>
+     * <p><b>Important Hints for custom implementations</b>:</p>
+     * <p>
+     * If a custom implementation should be invoked <b>before</b> the default implementations, use a value &gt; 400
+     * </p>
+     * <p>
+     * If a custom implementation should be invoked <b>after</b> the default implementations, use a value &lt; 100
+     * </p>
+     * <p/>
+     * <p>Reordering of the default order of the config-sources:</p>
+     * <p>Example: If the properties file/s should be used <b>before</b> the other implementations,
+     * you have to configure an ordinal &gt; 400. That means, you have to add e.g. deltaspike_ordinal=401 to
+     * /META-INF/apache-deltaspike.properties . Hint: In case of property files every file is handled as independent
+     * config-source, but all of them have ordinal 400 by default (and can be reordered in a fine-grained manner.</p>
+     *
+     * @return the 'importance' aka ordinal of the configured values. The higher, the more important.
+     * //X TODO think about making this a default method which returns default priority
+     */
+    int getOrdinal();
+
+
+    /**
+     * Get the name of the property source. The name should be unique for the type of source, whereas the id is used
+     * to ensure unique identity, either locally or remotely.
+     * @return the configuration's name, never null.
+     */
+    String getName();
+
+    /**
+     * Access a property.
+     *
+     * @param key the property's key, not null.
+     * @return the property's keys.
+     */
+    Optional<String> get(String key);
+
+    /**
+     * Access the current properties as Map. The resulting Map may not return all items accessible, e.g.
+     * when the underlying storage does not support iteration of its entries.
+     *
+     * @return the a corresponding map, never null.
+     * //X TODO or should we just do getPropertyKeys()? Think about security (key) vs easier merging (full map)?
+     */
+    Map<String,String> getProperties();
+
+    /**
+     * Determines if this config source should be scanned for its list of properties.
+     *
+     * Generally, slow PropertySources should return false here.
+     *
+     * @return true if this PropertySource should be scanned for its list of properties,
+     * false if it should not be scanned.
+     */
+    default boolean isScannable(){
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java b/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
new file mode 100644
index 0000000..42e3b4d
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
@@ -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 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.Collection;
+
+/**
+ * <p>Implement this interfaces to provide a PropertySource provider which
+ * is able to register multiple PropertySources. This is e.g. needed if
+ * there are multiple property files of a given config file name.</p>
+ * 
+ * <p>If a PropertySource like JNDI only exists once, then there is no need
+ * to implement it via the PropertySourceProvider but should directly
+ * expose a {@link PropertySource}.</p>
+ *
+ * <p>A PropertySourceProvider will get picked up via the
+ * {@link java.util.ServiceLoader} mechanism and must get registered via
+ * META-INF/services/org.apache.tamaya.spi.PropertySourceProvider</p>
+ */
+public interface PropertySourceProvider {
+
+    /**
+     * @return For each e.g. property file, we return a single PropertySource
+     *         or an empty list if no PropertySource exists.
+     */
+    Collection<PropertySource> getPropertySources();
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java b/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
new file mode 100644
index 0000000..2c134c3
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
@@ -0,0 +1,114 @@
+/*
+ * 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.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.Supplier;
+
+/**
+ * This class models the component that is managing the lifecycle current the
+ * services used by the Configuration API.
+ */
+public interface ServiceContext {
+
+    /**
+     * @return ordinal of the ServiceContext. The one with the highest ordinal will be taken.
+     */
+    int ordinal();
+
+    /**
+     * Delegate method for {@link ServiceContext#getService(Class)}.
+     *
+     * @param serviceType the service type.
+     * @return the service found, never {@code null}.
+     * @see ServiceContext#getService(Class)
+     */
+    default <T> T getSingleton(Class<T> serviceType) {
+        return getService(serviceType)
+                .orElseThrow(() -> new IllegalStateException("Singleton missing: " + serviceType.getName()));
+    }
+
+    /**
+     * Delegate method for {@link ServiceContext#getService(Class)}.
+     *
+     * @param serviceType the service type.
+     * @return the service found, never {@code null}.
+     * @see ServiceContext#getService(Class)
+     */
+    default <T> T getSingleton(Class<T> serviceType, Supplier<T> defaultSupplier) {
+        return getService(serviceType)
+                .orElse((defaultSupplier.get()));
+    }
+
+    /**
+     * Access a singleton, given its type.
+     *
+     * @param serviceType
+     *            the service type.
+     * @return The instance to be used, never {@code null}
+     */
+    <T> Optional<T> getService(Class<T> serviceType);
+
+    /**
+     * Access a list current services, given its type. The bootstrap mechanism should
+     * order the instance for precedence, hereby the most significant should be
+     * first in order.
+     *
+     * @param serviceType
+     *            the service type.
+     * @param defaultList
+     *            the lis returned, if no services could be found.
+     * @return The instance to be used, never {@code null}
+     */
+    <T> List<? extends T> getServices(Class<T> serviceType, List<? extends T> defaultList);
+
+    /**
+     * Access a list current services, given its type. The bootstrap mechanism should
+     * order the instance for precedence, hereby the most significant should be
+     * first in order.
+     *
+     * @param serviceType
+     *            the service type.
+     * @return The instance to be used, never {@code null}
+     */
+    default <T> List<? extends T> getServices(Class<T> serviceType){
+        return getServices(serviceType, Collections.emptyList());
+    }
+
+    /**
+     * Get the current {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
+     *
+     * @return the {@link ServiceContext} to be used.
+     */
+    public static ServiceContext getInstance(){
+        return ServiceContextManager.getServiceContext();
+    }
+
+    /**
+     * Replace the current {@link ServiceContext} in use.
+     *
+     * @param serviceContext the new {@link ServiceContext}, not null.
+     */
+    public static ServiceContext set(ServiceContext serviceContext){
+        return ServiceContextManager.set(Objects.requireNonNull(serviceContext));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/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..d5cbb93
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
@@ -0,0 +1,106 @@
+/*
+ * 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.*;
+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.
+ */
+final class ServiceContextManager {
+    /**
+     * 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() {
+        try {
+            int highestOrdinal = 0;
+            ServiceContext highestServiceContext = null;
+            for (ServiceContext serviceContext : ServiceLoader.load(ServiceContext.class)) {
+                if (serviceContext.ordinal() > highestOrdinal) {
+                    highestServiceContext = serviceContext;
+                }
+            }
+
+            return highestServiceContext;
+        } catch (Exception e) {
+            throw new ConfigException("No ServiceContext found");
+        }
+    }
+
+    /**
+     * 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;
+                Logger.getLogger(ServiceContextManager.class.getName())
+                        .log(Level.INFO, "Using ServiceProvider: " + serviceContextProvider.getClass().getName());
+            } else {
+                Logger.getLogger(ServiceContextManager.class.getName())
+                        .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/c4e24709/dormant/api/src/main/java/org/apache/tamaya/ConfigException.java
----------------------------------------------------------------------
diff --git a/dormant/api/src/main/java/org/apache/tamaya/ConfigException.java b/dormant/api/src/main/java/org/apache/tamaya/ConfigException.java
deleted file mode 100644
index bac2ef4..0000000
--- a/dormant/api/src/main/java/org/apache/tamaya/ConfigException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-/**
- * 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/c4e24709/dormant/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/dormant/api/src/main/java/org/apache/tamaya/Configuration.java b/dormant/api/src/main/java/org/apache/tamaya/Configuration.java
deleted file mode 100644
index fa61447..0000000
--- a/dormant/api/src/main/java/org/apache/tamaya/Configuration.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-import org.apache.tamaya.spi.ConfigurationFactorySpi;
-import org.apache.tamaya.spi.ConfigurationSpi;
-import org.apache.tamaya.spi.ServiceContext;
-
-import java.util.*;
-import java.util.function.Function;
-import java.util.function.UnaryOperator;
-
-/**
- * A configuration models a aggregated set current properties, identified by a unique key, but adds higher level access functions to
- * a {@link PropertySource}. Hereby in most cases a configuration is a wrapper around a composite
- * {@link 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 extends PropertyMapSupplier {
-
-    /**
-     * An empty and immutable Configuration instance.
-     */
-    public static final Configuration EMPTY_CONFIGURATION = new Configuration() {
-
-        @Override
-        public String getName() {
-            return "<empty>";
-        }
-
-        @Override
-        public Optional<String> get(String key) {
-            return Optional.empty();
-        }
-
-        @Override
-        public Map<String, String> getProperties() {
-            return Collections.emptyMap();
-        }
-
-        @Override
-        public String toString(){
-            return "PropertySource [name=<empty>]";
-        }
-    };
-
-    /**
-     * Get the name of the property source. The name should be unique for the type of source, whereas the id is used
-     * to ensure unique identity, either locally or remotely.
-     * @return the configuration's name, never null.
-     */
-    String getName();
-
-    /**
-     * Access a property.
-     *
-     * @param key the property's key, not null.
-     * @return the property's keys.
-     */
-    Optional<String> get(String key);
-
-    /**
-     * Determines if this config source should be scanned for its list of properties.
-     *
-     * Generally, slow ConfigSources should return false here.
-     *
-     * @return true if this ConfigSource should be scanned for its list of properties,
-     * false if it should not be scanned.
-     */
-    default boolean isScannable(){
-        return true;
-    }
-
-    /**
-     * Allows to quickly check, if a provider is empty.
-     *
-     * @return true, if the provier is empty.
-     */
-    default boolean isEmpty() {
-        return getProperties().isEmpty();
-    }
-
-    /**
-     * 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.
-     */
-	default Boolean getBoolean(String key) {
-		Optional<Boolean> val = get(key, Boolean.class);
-		if (val.isPresent()) {
-			return val.get();
-		}
-		return null;
-	}
-
-    /**
-     * 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.
-     */
-    default OptionalInt getInteger(String key){
-        Optional<Integer> val = get(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.
-     */
-    default OptionalLong getLong(String key){
-        Optional<Long> val = get(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.
-     */
-    default OptionalDouble getDouble(String key){
-
-        Optional<Double> val = get(key, Double.class);
-        if(val.isPresent()){
-            return OptionalDouble.of(val.get());
-        }
-        return OptionalDouble.empty();
-    }
-
-
-    /**
-     * Get the property keys as type {@code Class<T>}.
-     * <p>
-     * If {@code Class<T>} is not one current
-     * {@code Boolean, Short, Integer, Long, Float, Double, BigInteger,
-     * BigDecimal, String} , an according adapter must be
-     * available to perform the conversion fromMap {@link String} to
-     * {@code Class<T>}.
-     *
-     * @param key     the property's absolute, or relative path, e.g. @code
-     *                a/b/c/d.myProperty}.
-     * @param adapter the PropertyAdapter to perform the conversion fromMap
-     *                {@link String} to {@code Class<T>}, not {@code null}.
-     * @return the property's keys.
-     * @throws ConfigException if the keys could not be converted to the required target
-     *                                  type, or no such property exists.
-     */
-    default <T> Optional<T> getAdapted(String key, PropertyAdapter<T> adapter){
-        Optional<String> value = get(key);
-        if(value.isPresent()) {
-            return Optional.ofNullable(adapter.adapt(value.get()));
-        }
-        return Optional.empty();
-    }
-
-//    /**
-//     * Get the property with the given key as type {@code Class<T>}.
-//     * <p>
-//     * If {@code Class<T>} is not one current
-//     * {@code Boolean, Short, Integer, Long, Float, Double, BigInteger,
-//     * BigDecimal, String} , an according adapter must be
-//     * available to perform the conversion from {@link String} to
-//     * {@code Class<T>}.
-//     *
-//     * @param key     the property's absolute, or relative path, e.g. {@code
-//     *                a/b/c/d.myProperty}.
-//     * @param adapter the PropertyAdapter to perform the conversion from
-//     *                {@link String} to {@code Class<T>}, not {@code null}.
-//     * @return the property value, never null.
-//     * @throws ConfigException if the keys could not be converted to the required target
-//     *                                  type, or no such property exists.
-//     */
-//    default <T> DynamicValue<T> getAdaptedDynamicValue(String key, PropertyAdapter<T> adapter){
-//        Optional<String> value = get(key);
-//        if(value.isPresent()) {
-//            return DynamicValue.ofNullable(getName()+':' + key, adapter.adapt(value.get()));
-//        }
-//        return DynamicValue.empty(getName()+':' + key);
-//    }
-
-
-    /**
-     * Get the property keys as type T. This will implicitly require a corresponding {@link
-     * PropertyAdapter} 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.
-     * @return the property value, never null..
-     * @throws ConfigException if the keys could not be converted to the required target
-     *                                  type.
-     */
-    default <T> Optional<T> get(String key, Class<T> type){
-        return getAdapted(key, PropertyAdapter.getInstance(type));
-    }
-
-//    /**
-//     * Get the property value as {@link org.apache.tamaya.DynamicValue}. This will implicitly require a corresponding {@link
-//     * PropertyAdapter} that is capable of converting the String value to the current required type T.
-//     *
-//     * @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.
-//     * @return the dynamic value instance, never null.
-//     * @throws ConfigException if the keys could not be converted to the required target
-//     *                                  type.
-//     */
-//    default <T> DynamicValue<T> getDynamicValue(String key, Class<T> type){
-//        return getAdaptedDynamicValue(key, PropertyAdapter.getInstance(type));
-//    }
-
-    /**
-     * 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(UnaryOperator<Configuration> operator){
-        return operator.apply(this);
-    }
-
-
-    /**
-     * Query a configuration.
-     *
-     * @param query the query, never {@code null}.
-     * @return the result
-     */
-    default <T> T query(Function<Configuration,T> query){
-        return query.apply(this);
-    }
-
-
-    /**
-     * Allows to check if a configuration with a given name is defined.
-     *
-     * @param name the configuration's name, not null, not empty.
-     * @return true, if such a configuration is defined.
-     */
-    public static boolean isAvailable(String name){
-        return ServiceContext.getInstance().getSingleton(ConfigurationSpi.class).isConfigurationAvailable(name);
-    }
-
-    /**
-     * Creates a configuration from a {@link org.apache.tamaya.PropertySource}.
-     *
-     * @param propertySource the property source
-     * @return the corresponding Configuration instance, never null.
-     */
-    public static Configuration from(PropertySource propertySource){
-        return ServiceContext.getInstance().getSingleton(ConfigurationFactorySpi.class, () -> new ConfigurationFactorySpi(){}).from(propertySource);
-    }
-
-    /**
-     * Access a configuration by name.
-     *
-     * @param name the configuration's name, not null, not empty.
-     * @return the corresponding Configuration instance, never null.
-     * @throws ConfigException if no such configuration is defined.
-     */
-    public static Configuration current(String name){
-        return ServiceContext.getInstance().getSingleton(ConfigurationSpi.class).getConfiguration(name);
-    }
-
-    /**
-     * Access a configuration.
-     *
-     * @return the corresponding Configuration instance, never null.
-     * @throws ConfigException if no such configuration is defined.
-     */
-    public static Configuration current(){
-        return ServiceContext.getInstance().getSingleton(ConfigurationSpi.class).getConfiguration();
-    }
-
-    /**
-     * Access a typed configuration, based on the default configuration.
-     *
-     * @param type the annotated configuration type (could be an interface or
-     *             a non abstract class), not null.
-     * @param configurations overriding configurations to be used for evaluating the values for injection into {@code instance}, not null.
-     *                       If no such config is passed, the default configurationa provided by the current
-     *                       registered providers are used.
-     * @return the corresponding typed Configuration instance, never null.
-     * @throws ConfigException if the configuration could not be resolved.
-     */
-    public static <T> T createTemplate(Class<T> type, Configuration... configurations){
-        return ServiceContext.getInstance().getSingleton(ConfigurationSpi.class).createTemplate(type, configurations);
-    }
-
-    /**
-     * Configures an instance, by resolving and injecting the configuration
-     * entries.
-     *
-     * @param instance the instance with configuration annotations, not null.
-     * @param configurations overriding configurations to be used for evaluating the values for injection into {@code instance}, not null.
-     *                       If no such config is passed, the default configurationa provided by the current
-     *                       registered providers are used.
-     * @throws ConfigException if the configuration could not be resolved.
-     */
-    public static void configure(Object instance, Configuration... configurations){
-        ServiceContext.getInstance().getSingleton(ConfigurationSpi.class).configure(instance, configurations);
-    }
-
-    /**
-     * Evaluate the current expression based on the current configuration valid.
-     *
-     * @param configurations overriding configurations to be used for evaluating the values for injection into {@code instance}, not null.
-     *                       If no such config is passed, the default configurationa provided by the current
-     *                       registered providers are used.
-     * @param expression the expression, not null.
-     * @return the evaluated config expression.
-     */
-    public static String evaluateValue(String expression, Configuration... configurations){
-        return ServiceContext.getInstance().getSingleton(ConfigurationSpi.class).evaluateValue(expression, configurations);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/dormant/api/src/main/java/org/apache/tamaya/PropertyAdapter.java
----------------------------------------------------------------------
diff --git a/dormant/api/src/main/java/org/apache/tamaya/PropertyAdapter.java b/dormant/api/src/main/java/org/apache/tamaya/PropertyAdapter.java
deleted file mode 100644
index 5cecd09..0000000
--- a/dormant/api/src/main/java/org/apache/tamaya/PropertyAdapter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-
-import org.apache.tamaya.annotation.WithPropertyAdapter;
-import org.apache.tamaya.spi.PropertyAdapterSpi;
-import org.apache.tamaya.spi.ServiceContext;
-
-/**
- * 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 eollections), complex or even contain
- * full subconfigurations, if needed.
- */
-@FunctionalInterface
-public interface PropertyAdapter<T>{
-
-    /**
-     * Adapt the given configuration keys to the required target type.
-     * @param value the configuration keys
-     * @return adapted keys
-     */
-    T adapt(String value);
-
-
-    /**
-     * Registers a new PropertyAdapter for the given target type, hereby replacing any existing adapter for
-     * this type.
-     * @param targetType The target class, not null.
-     * @param adapter The adapter, not null.
-     * @param <T> The target type
-     * @return any adapter replaced with the new adapter, or null.
-     */
-    public static <T> PropertyAdapter<T> register(Class<T> targetType, PropertyAdapter<T> adapter){
-        return ServiceContext.getInstance().getSingleton(PropertyAdapterSpi.class).register(targetType, adapter);
-    }
-
-    /**
-     * Get an adapter converting to the given target type.
-     * @param targetType the target type class
-     * @return true, if the given target type is supported.
-     */
-    public static boolean isTargetTypeSupported(Class<?> targetType){
-        return ServiceContext.getInstance().getSingleton(PropertyAdapterSpi.class).isTargetTypeSupported(targetType);
-    }
-
-    /**
-     * Get an adapter converting to the given target type.
-     * @param targetType the target type class
-     * @param <T> the target type
-     * @return the corresponding adapter, never null.
-     * @throws org.apache.tamaya.ConfigException if the target type is not supported.
-     */
-    public static  <T> PropertyAdapter<T> getInstance(Class<T> targetType){
-        return ServiceContext.getInstance().getSingleton(PropertyAdapterSpi.class).getPropertyAdapter(targetType, null);
-    }
-
-    /**
-     * Get an adapter converting to the given target type.
-     * @param targetType the target type class
-     * @param annotation the {@link org.apache.tamaya.annotation.WithPropertyAdapter} annotation, or null. If the annotation is not null and
-     *                   defines an overriding adapter, this instance is created and returned.
-     * @param <T> the target type
-     * @return the corresponding adapter, never null.
-     * @throws org.apache.tamaya.ConfigException if the target type is not supported, or the overriding adapter cannot be
-     * instantiated.
-     */
-    public static  <T> PropertyAdapter<T> getInstance(Class<T> targetType, WithPropertyAdapter annotation){
-        return ServiceContext.getInstance().getSingleton(PropertyAdapterSpi.class).getPropertyAdapter(targetType, annotation);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/dormant/api/src/main/java/org/apache/tamaya/PropertySource.java
----------------------------------------------------------------------
diff --git a/dormant/api/src/main/java/org/apache/tamaya/PropertySource.java b/dormant/api/src/main/java/org/apache/tamaya/PropertySource.java
deleted file mode 100644
index f4b01ae..0000000
--- a/dormant/api/src/main/java/org/apache/tamaya/PropertySource.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.tamaya;
-
-import java.util.*;
-import java.util.function.Function;
-import java.util.function.UnaryOperator;
-
-/**
- * This interface models a provider that serves configuration properties. The contained
- * properties may be read fromMap single or several sources (composite).<br/>
- * Property config are the building blocks out current which complex
- * configuration is setup.
- * <p/>
- * <h3>Implementation Requirements</h3>
- * <p></p>Implementations current this interface must be
- * <ul>
- * <li>Thread safe.
- * </ul>
- * It is highly recommended that implementations also are
- * <ul>
- * <li>Immutable</li>
- * <li>serializable</li>
- * </ul>
- * </p>
- */
-public interface PropertySource extends PropertyMapSupplier {
-
-    /**
-     * An empty and immutable PropertyProvider instance.
-     */
-    public static final PropertySource EMPTY_PROPERTYSOURCE = new PropertySource() {
-
-        @Override
-        public String getName() {
-            return "<empty>";
-        }
-
-        @Override
-        public Optional<String> get(String key) {
-            return Optional.empty();
-        }
-
-        @Override
-        public Map<String, String> getProperties() {
-            return Collections.emptyMap();
-        }
-
-        @Override
-        public String toString(){
-            return "PropertySource [name=<empty>]";
-        }
-    };
-
-    /**
-     * Get the name of the property source. The name should be unique for the type of source, whereas the id is used
-     * to ensure unique identity, either locally or remotely.
-     * @return the configuration's name, never null.
-     */
-    String getName();
-
-    /**
-     * Access a property.
-     *
-     * @param key the property's key, not null.
-     * @return the property's keys.
-     */
-    Optional<String> get(String key);
-
-    /**
-     * Determines if this config source should be scanned for its list of properties.
-     *
-     * Generally, slow ConfigSources should return false here.
-     *
-     * @return true if this ConfigSource should be scanned for its list of properties,
-     * false if it should not be scanned.
-     */
-    default boolean isScannable(){
-        return true;
-    }
-
-    /**
-     * Allows to quickly check, if a provider is empty.
-     *
-     * @return true, if the provier is empty.
-     */
-    default boolean isEmpty() {
-        return getProperties().isEmpty();
-    }
-
-    /**
-     * Extension point for adjusting property sources.
-     *
-     * @param operator A property source operator, e.g. a filter, or an adjuster
-     *                 combining property sources.
-     * @return the new adjusted property source, never {@code null}.
-     */
-    default PropertySource with(UnaryOperator<PropertySource> operator){
-        return operator.apply(this);
-    }
-
-    /**
-     * Query something from a property source.
-     *
-     * @param query the query, never {@code null}.
-     * @return the result
-     */
-    default <T> T query(Function<PropertySource, T> query){
-        return query.apply(this);
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/dormant/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
----------------------------------------------------------------------
diff --git a/dormant/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java b/dormant/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
deleted file mode 100644
index a2e127e..0000000
--- a/dormant/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.function.Supplier;
-
-/**
- * This class models the component that is managing the lifecycle current the
- * services used by the Configuration API.
- */
-public interface ServiceContext {
-
-    /**
-     * Delegate method for {@link ServiceContext#getService(Class)}.
-     *
-     * @param serviceType the service type.
-     * @return the service found, never {@code null}.
-     * @see ServiceContext#getService(Class)
-     */
-    default <T> T getSingleton(Class<T> serviceType) {
-        return getService(serviceType)
-                .orElseThrow(() -> new IllegalStateException("Singleton missing: " + serviceType.getName()));
-    }
-
-    /**
-     * Delegate method for {@link ServiceContext#getService(Class)}.
-     *
-     * @param serviceType the service type.
-     * @return the service found, never {@code null}.
-     * @see ServiceContext#getService(Class)
-     */
-    default <T> T getSingleton(Class<T> serviceType, Supplier<T> defaultSupplier) {
-        return getService(serviceType)
-                .orElse((defaultSupplier.get()));
-    }
-
-    /**
-     * Access a singleton, given its type.
-     *
-     * @param serviceType
-     *            the service type.
-     * @return The instance to be used, never {@code null}
-     */
-    <T> Optional<T> getService(Class<T> serviceType);
-
-	/**
-	 * Access a list current services, given its type. The bootstrap mechanism should
-	 * order the instance for precedence, hereby the most significant should be
-	 * first in order.
-	 * 
-	 * @param serviceType
-	 *            the service type.
-	 * @param defaultList
-	 *            the lis returned, if no services could be found.
-	 * @return The instance to be used, never {@code null}
-	 */
-    <T> List<? extends T> getServices(Class<T> serviceType, List<? extends T> defaultList);
-
-    /**
-     * Access a list current services, given its type. The bootstrap mechanism should
-     * order the instance for precedence, hereby the most significant should be
-     * first in order.
-     *
-     * @param serviceType
-     *            the service type.
-     * @return The instance to be used, never {@code null}
-     */
-    default <T> List<? extends T> getServices(Class<T> serviceType){
-        return getServices(serviceType, Collections.emptyList());
-    }
-
-    /**
-     * Get the current {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
-     *
-     * @return the {@link ServiceContext} to be used.
-     */
-    public static ServiceContext getInstance(){
-        return ServiceContextManager.getServiceContext();
-    }
-
-    /**
-     * Replace the current {@link ServiceContext} in use.
-     *
-     * @param serviceContext the new {@link ServiceContext}, not null.
-     */
-    public static ServiceContext set(ServiceContext serviceContext){
-        return ServiceContextManager.set(Objects.requireNonNull(serviceContext));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/dormant/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
----------------------------------------------------------------------
diff --git a/dormant/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java b/dormant/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
deleted file mode 100644
index 63e4d70..0000000
--- a/dormant/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import java.util.*;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * 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.
- */
-final class ServiceContextManager {
-    /**
-     * The ServiceProvider used.
-     */
-    private static volatile ServiceContext serviceContextProviderDelegate;
-    /**
-     * The shared lock instance user.
-     */
-    private static final Object LOCK = new Object();
-
-    /**
-     * 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() {
-        try {
-            for (ServiceContext sp : ServiceLoader.load(ServiceContext.class)) {
-                return sp;
-            }
-        } catch (Exception e) {
-            Logger.getLogger(ServiceContextManager.class.getName()).log(Level.INFO, "Using default ServiceProvider.");
-        }
-        return new DefaultServiceContextProvider();
-    }
-
-    /**
-     * 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 (LOCK) {
-            if (ServiceContextManager.serviceContextProviderDelegate == null) {
-                ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
-                Logger.getLogger(ServiceContextManager.class.getName())
-                        .log(Level.INFO, "Using ServiceProvider: " + serviceContextProvider.getClass().getName());
-            } else {
-                Logger.getLogger(ServiceContextManager.class.getName())
-                        .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 (LOCK) {
-                if (serviceContextProviderDelegate == null) {
-                    serviceContextProviderDelegate = loadDefaultServiceProvider();
-                }
-            }
-        }
-        return serviceContextProviderDelegate;
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c4e24709/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 64b6a49..45529c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -347,7 +347,7 @@ under the License.
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
-                <version>2.12</version>
+                <version>2.13</version>
                 <executions>
                     <execution>
                         <id>verify-style</id>
@@ -502,6 +502,20 @@ under the License.
                         </module>
                     </checkstyleRules>
                 </configuration>
+
+                <dependencies>
+                    <dependency>
+                        <groupId>com.puppycrawl.tools</groupId>
+                        <artifactId>checkstyle</artifactId>
+                        <version>6.2</version>
+                        <exclusions><!-- MCHECKSTYLE-156 -->
+                            <exclusion>
+                                <groupId>com.sun</groupId>
+                                <artifactId>tools</artifactId>
+                            </exclusion>
+                        </exclusions>
+                    </dependency>
+                </dependencies>
             </plugin>
 
             <plugin>