You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2018/02/05 00:10:42 UTC
[1/3] incubator-tamaya git commit: - Adapted OSGI deps. - Defined
clear resolvability of packages,
removing redundancies. - Refactored parts of TypeLiteral into util class.
Repository: incubator-tamaya
Updated Branches:
refs/heads/configjsr 0be1acbf3 -> 094720846
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java b/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java
index 006bd2d..f575023 100644
--- a/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java
+++ b/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigBuilderTest.java
@@ -18,16 +18,10 @@
*/
package org.apache.tamaya.base;
-import org.apache.tamaya.spi.TamayaConfigBuilder;
-import org.apache.tamaya.spi.ConfigContext;
-import org.apache.tamaya.spi.ConfigValueCombinationPolicy;
-import org.apache.tamaya.spi.TypeLiteral;
-import org.apache.tamaya.spi.Filter;
-import org.apache.tamaya.base.DefaultConfigBuilder;
+import org.apache.tamaya.base.ConfigValueCombinationPolicy;
+import org.apache.tamaya.base.filter.Filter;
import org.junit.Test;
-import javax.config.Config;
-import javax.config.ConfigProvider;
import javax.config.spi.ConfigBuilder;
import javax.config.spi.ConfigProviderResolver;
import javax.config.spi.ConfigSource;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java b/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java
index 587fe5a..fb67095 100644
--- a/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java
+++ b/code/base/src/test/java/org/apache/tamaya/base/DefaultConfigTest.java
@@ -18,7 +18,6 @@
*/
package org.apache.tamaya.base;
-import org.apache.tamaya.spi.TypeLiteral;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java b/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java
index be10fb7..82fb911 100644
--- a/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java
+++ b/code/base/src/test/java/org/apache/tamaya/base/TestConfigurationProvider.java
@@ -18,9 +18,8 @@
*/
package org.apache.tamaya.base;
-import org.apache.tamaya.spi.Filter;
-import org.apache.tamaya.spi.ServiceContext;
-import org.apache.tamaya.base.DefaultConfigBuilder;
+import org.apache.tamaya.base.filter.Filter;
+import org.apache.tamaya.base.ServiceContext;
import javax.config.Config;
import javax.config.spi.ConfigBuilder;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java b/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java
index 5aefbd0..c09bd4d 100644
--- a/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java
+++ b/code/base/src/test/java/org/apache/tamaya/base/configsource/EnumConverterTest.java
@@ -19,7 +19,6 @@
package org.apache.tamaya.base.configsource;
import org.apache.tamaya.base.convert.ConversionContext;
-import org.apache.tamaya.spi.TypeLiteral;
import org.apache.tamaya.base.convert.EnumConverter;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java b/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java
index e8c40f6..34abf6e 100644
--- a/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java
+++ b/code/base/src/test/java/org/apache/tamaya/base/convert/EnumConverterTest.java
@@ -18,9 +18,6 @@
*/
package org.apache.tamaya.base.convert;
-import org.apache.tamaya.base.convert.EnumConverter;
-import org.apache.tamaya.base.convert.ConversionContext;
-import org.apache.tamaya.spi.TypeLiteral;
import org.junit.Test;
import java.math.RoundingMode;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java b/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java
index 3c91f12..e51a266 100644
--- a/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java
+++ b/code/base/src/test/java/org/apache/tamaya/base/services/DefaultServiceContext.java
@@ -19,7 +19,7 @@
package org.apache.tamaya.base.services;
import org.apache.tamaya.base.PriorityServiceComparator;
-import org.apache.tamaya.spi.ServiceContext;
+import org.apache.tamaya.base.ServiceContext;
import javax.annotation.Priority;
import java.io.IOException;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java
----------------------------------------------------------------------
diff --git a/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java b/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java
index 56afd47..268d524 100644
--- a/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java
+++ b/code/base/src/test/java/org/apache/tamaya/filter/FilterComparatorTest.java
@@ -19,8 +19,7 @@
package org.apache.tamaya.filter;
import org.apache.tamaya.base.filter.FilterComparator;
-import org.apache.tamaya.spi.ConfigValue;
-import org.apache.tamaya.spi.Filter;
+import org.apache.tamaya.base.filter.Filter;
import org.junit.Test;
import javax.annotation.Priority;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.ServiceContext
----------------------------------------------------------------------
diff --git a/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.ServiceContext b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.ServiceContext
new file mode 100644
index 0000000..7b8a81d
--- /dev/null
+++ b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.base.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.base.DefaultServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/code/base/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/code/base/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
deleted file mode 100644
index 7b8a81d..0000000
--- a/code/base/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy current the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.base.DefaultServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/bnd.bnd
----------------------------------------------------------------------
diff --git a/code/compat/bnd.bnd b/code/compat/bnd.bnd
index 0409b56..8a2771a 100644
--- a/code/compat/bnd.bnd
+++ b/code/compat/bnd.bnd
@@ -30,5 +30,4 @@ Import-Package: \
org.apache.tamaya.base,\
org.apache.tamaya.base.configsource,\
org.apache.tamaya.base.convert,\
- org.apache.tamaya.base.filter,\
- org.apache.tamaya.spi
+ org.apache.tamaya.base.filter
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/Configuration.java b/code/compat/src/main/java/org/apache/tamaya/Configuration.java
index 3cf57f7..e4cd2e6 100644
--- a/code/compat/src/main/java/org/apache/tamaya/Configuration.java
+++ b/code/compat/src/main/java/org/apache/tamaya/Configuration.java
@@ -56,7 +56,7 @@ public interface Configuration {
* @return the property's value.
*/
default String get(String key){
- return get(key, org.apache.tamaya.spi.TypeLiteral.of(String.class));
+ return get(key, TypeLiteral.of(String.class));
}
/**
@@ -67,7 +67,7 @@ public interface Configuration {
* @return the property's keys.
*/
default String getOrDefault(String key, String defaultValue){
- return getOrDefault(key, org.apache.tamaya.spi.TypeLiteral.of(String.class), defaultValue);
+ return getOrDefault(key, TypeLiteral.of(String.class), defaultValue);
}
/**
@@ -84,7 +84,7 @@ public interface Configuration {
* @throws ConfigException if the keys could not be converted to the required target type.
*/
default <T> T getOrDefault(String key, Class<T> type, T defaultValue){
- return getOrDefault(key, org.apache.tamaya.spi.TypeLiteral.of(type), defaultValue);
+ return getOrDefault(key, TypeLiteral.of(type), defaultValue);
}
/**
@@ -100,7 +100,7 @@ public interface Configuration {
* @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, org.apache.tamaya.spi.TypeLiteral.of(type));
+ return get(key, TypeLiteral.of(type));
}
/**
@@ -115,7 +115,7 @@ public interface Configuration {
* @return the property value, never {@code null}.
* @throws ConfigException if the keys could not be converted to the required target type.
*/
- <T> T get(String key, org.apache.tamaya.spi.TypeLiteral<T> type);
+ <T> T get(String key, TypeLiteral<T> type);
/**
* Get the property keys as type T. This will implicitly require a corresponding {@link
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java
index 9eae5af..d3bf0d2 100644
--- a/code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java
+++ b/code/compat/src/main/java/org/apache/tamaya/ConfigurationProvider.java
@@ -18,6 +18,7 @@
*/
package org.apache.tamaya;
+import org.apache.tamaya.base.ServiceContextManager;
import org.apache.tamaya.spi.*;
import java.util.logging.Logger;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java b/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java
index ac3e3b9..d043229 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationBuilder.java
@@ -19,6 +19,7 @@
package org.apache.tamaya.spi;
import org.apache.tamaya.Configuration;
+import org.apache.tamaya.spi.TypeLiteral;
import java.util.Collection;
import java.util.Comparator;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
index 43f7ea0..f4bec74 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
@@ -19,6 +19,8 @@
package org.apache.tamaya.spi;
+import org.apache.tamaya.spi.TypeLiteral;
+
import java.util.List;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java b/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
index 8e3f307..104aadd 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
@@ -18,6 +18,8 @@
*/
package org.apache.tamaya.spi;
+import org.apache.tamaya.spi.TypeLiteral;
+
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spi/FilterContext.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spi/FilterContext.java b/code/compat/src/main/java/org/apache/tamaya/spi/FilterContext.java
index 2851697..02ee66a 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spi/FilterContext.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spi/FilterContext.java
@@ -19,6 +19,7 @@
package org.apache.tamaya.spi;
import org.apache.tamaya.Configuration;
+import org.apache.tamaya.base.Experimental;
import java.util.Collections;
import java.util.HashMap;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spi/PropertyFilter.java b/code/compat/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
index 3054496..3449e47 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
@@ -19,9 +19,10 @@
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
+ * Filters can be registered using the {@link org.apache.tamaya.base.ServiceContext}. The ordinal
* hereby is defined by the corresponding {@code @Priority} annotation.</p>
* <p>Filters </p>
*/
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spi/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spi/TypeLiteral.java b/code/compat/src/main/java/org/apache/tamaya/spi/TypeLiteral.java
new file mode 100644
index 0000000..9240602
--- /dev/null
+++ b/code/compat/src/main/java/org/apache/tamaya/spi/TypeLiteral.java
@@ -0,0 +1,225 @@
+/*
+ * 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.io.Serializable;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Objects;
+
+/**
+ * <p>Class for instantiation of objects that represent parameterized types
+ * with current parameters.</p>
+ *
+ * <p>An object that represents a parameterized type may be obtained by
+ * subclassing <tt>TypeLiteral</tt>.</p>
+ *
+ * <pre>
+ * TypeLiteral<List<Integer>> stringListType = new TypeLiteral<List<Integer>>() {};
+ * </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 final Type definedType;
+
+ /**
+ * Constructor.
+ * @param definedType the defined type.
+ */
+ public TypeLiteral(Type definedType) {
+ Objects.requireNonNull(definedType, "Type must be given");
+
+ this.definedType = definedType;
+ }
+
+ /**
+ * Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
+ */
+ public TypeLiteral() {
+ this.definedType = getDefinedType(this.getClass());
+ }
+
+ /**
+ * Creates a new TypeLiteral based on a given type.
+ *
+ * @param type the type , not {@code null}.
+ * @param <R> the literal generic type.
+ * @return the corresponding TypeLiteral, never {@code null}.
+ */
+ public static <R> TypeLiteral<R> of(Type type) {
+ Objects.requireNonNull(type, "Type must be given.");
+
+ return new TypeLiteral<R>(type);
+ }
+
+ /**
+ * Checks the current implemented generic interfaces and evaluates the given single type parameter.
+ *
+ * @param clazz the class to check, not {@code null}.
+ * @param interfaceType the interface type to be checked, not {@code null}.
+ * @return the generic type parameters, or an empty array, if it cannot be evaluated.
+ */
+ public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
+ Objects.requireNonNull(clazz, "Class parameter must be given.");
+ Objects.requireNonNull(interfaceType, "Interface parameter must be given.");
+
+ 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 {@code null}.
+ * @return the generic type parameter of the given single type generic interfaceType, or an empty array.
+ */
+ public static Type[] getTypeParameters(Type type) {
+ Objects.requireNonNull(type, "Type must be given.");
+
+ 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
+ */
+ @SuppressWarnings("unchecked")
+ public final Class<T> getRawType() {
+ Class<T> rawType;
+
+ 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 if (this.definedType instanceof Class) {
+ rawType = (Class<T>) this.definedType;
+ } else {
+ throw new RuntimeException("Illegal type for the Type Literal Class");
+ }
+
+ return rawType;
+ }
+
+ /**
+ * Returns actual type arguments, if present.
+ *
+ * @return the actual type represented by defined class, or an empty array.
+ */
+ public final Type[] getActualTypeArguments() {
+ if (this.definedType instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) this.definedType;
+ return pt.getActualTypeArguments();
+ }
+ return new Type[0];
+ }
+
+
+ protected Type getDefinedType(Class<?> clazz) {
+ Type type;
+
+ if (clazz == null) {
+ throw new RuntimeException("Class parameter clazz can not be null");
+ }
+
+ Type superClazz = clazz.getGenericSuperclass();
+
+ 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 if (superClazz.equals(Object.class)) {
+ throw new RuntimeException("Super class must be parametrized 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/09472084/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfiguration.java b/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfiguration.java
index bdbd09c..7a4d72b 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfiguration.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfiguration.java
@@ -29,7 +29,7 @@ import org.apache.tamaya.spi.PropertyConverter;
import org.apache.tamaya.spi.PropertySource;
import org.apache.tamaya.spi.PropertyValue;
import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.base.ServiceContextManager;
import java.util.HashMap;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilder.java b/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilder.java
index 1b3f1ce..2089eb9 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilder.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilder.java
@@ -19,6 +19,7 @@
package org.apache.tamaya.spisupport;
import org.apache.tamaya.Configuration;
+import org.apache.tamaya.spi.TypeLiteral;
import org.apache.tamaya.spi.*;
import org.apache.tamaya.spi.ConfigurationBuilder;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContext.java b/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContext.java
index 2c300ad..1717203 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContext.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContext.java
@@ -18,6 +18,7 @@
*/
package org.apache.tamaya.spisupport;
+import org.apache.tamaya.base.ServiceContextManager;
import org.apache.tamaya.spi.TypeLiteral;
import org.apache.tamaya.spi.*;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java b/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java
index 0ee54da..200556f 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java
@@ -18,6 +18,7 @@
*/
package org.apache.tamaya.spisupport;
+import org.apache.tamaya.base.ServiceContextManager;
import org.apache.tamaya.spi.TypeLiteral;
import org.apache.tamaya.spi.*;
import org.apache.tamaya.spisupport.propertysource.CLIPropertySource;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spisupport/PropertyConverterManager.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spisupport/PropertyConverterManager.java b/code/compat/src/main/java/org/apache/tamaya/spisupport/PropertyConverterManager.java
index 7bc8d26..bc1f30d 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spisupport/PropertyConverterManager.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spisupport/PropertyConverterManager.java
@@ -23,7 +23,7 @@ import org.apache.tamaya.spi.TypeLiteral;
import org.apache.tamaya.base.PriorityServiceComparator;
import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.base.ServiceContextManager;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java b/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java
index 92f520e..7f64810 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java
@@ -21,7 +21,7 @@ package org.apache.tamaya.spisupport.propertysource;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.spi.PropertySource;
import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.base.ServiceContextManager;
import org.apache.tamaya.spisupport.PropertySourceComparator;
import java.io.IOException;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java
----------------------------------------------------------------------
diff --git a/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java b/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java
index 27b6e4b..ec69913 100644
--- a/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java
+++ b/code/compat/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java
@@ -18,7 +18,7 @@
*/
package org.apache.tamaya.spisupport.propertysource;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.base.ServiceContextManager;
import java.io.InputStream;
import java.net.URL;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/test/java/org/apache/tamaya/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/code/compat/src/test/java/org/apache/tamaya/TestConfiguration.java b/code/compat/src/test/java/org/apache/tamaya/TestConfiguration.java
index a035467..ec37098 100644
--- a/code/compat/src/test/java/org/apache/tamaya/TestConfiguration.java
+++ b/code/compat/src/test/java/org/apache/tamaya/TestConfiguration.java
@@ -103,7 +103,7 @@ public class TestConfiguration implements Configuration{
}
@Override
- public <T> T get(String key, org.apache.tamaya.spi.TypeLiteral<T> type) {
+ public <T> T get(String key, TypeLiteral<T> type) {
throw new RuntimeException("Method not implemented yet.");
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/test/java/org/apache/tamaya/TypeLiteralTest.java
----------------------------------------------------------------------
diff --git a/code/compat/src/test/java/org/apache/tamaya/TypeLiteralTest.java b/code/compat/src/test/java/org/apache/tamaya/TypeLiteralTest.java
index 8e2ddc6..c6bf0f0 100644
--- a/code/compat/src/test/java/org/apache/tamaya/TypeLiteralTest.java
+++ b/code/compat/src/test/java/org/apache/tamaya/TypeLiteralTest.java
@@ -30,39 +30,39 @@ import org.apache.tamaya.spi.TypeLiteral;
import org.junit.Test;
/**
- * Tests for the {@link org.apache.tamaya.spi.TypeLiteral} class.
+ * Tests for the {@link TypeLiteral} class.
*/
@SuppressWarnings("serial")
public class TypeLiteralTest {
@Test(expected = NullPointerException.class)
public void constructorRequiresNonNullParameter() {
- new org.apache.tamaya.spi.TypeLiteral<List<String>>(null){};
+ new TypeLiteral<List<String>>(null){};
}
@Test
public void test_constrcutor(){
- org.apache.tamaya.spi.TypeLiteral<List<String>> listTypeLiteral = new org.apache.tamaya.spi.TypeLiteral<List<String>>(){};
+ TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
assertEquals(List.class, listTypeLiteral.getRawType());
- assertEquals(String.class, org.apache.tamaya.spi.TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
+ assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
}
@Test
public void test_of(){
class MyListClass extends ArrayList<String>{}
- org.apache.tamaya.spi.TypeLiteral<MyListClass> listTypeLiteral = org.apache.tamaya.spi.TypeLiteral.of(MyListClass.class);
+ TypeLiteral<MyListClass> listTypeLiteral = TypeLiteral.of(MyListClass.class);
assertEquals(MyListClass.class, listTypeLiteral.getRawType());
assertEquals(MyListClass.class, listTypeLiteral.getType());
}
@Test(expected = NullPointerException.class)
public void ofDoesNotAcceptNullAsParamter() {
- org.apache.tamaya.spi.TypeLiteral.of(null);
+ TypeLiteral.of(null);
}
@Test
public void test_getTypeParameter(){
- org.apache.tamaya.spi.TypeLiteral<List<String>> listTypeLiteral = new org.apache.tamaya.spi.TypeLiteral<List<String>>(){};
+ TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
assertEquals(List.class, listTypeLiteral.getRawType());
assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java
----------------------------------------------------------------------
diff --git a/code/compat/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java b/code/compat/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java
index 42673f8..bb61dc7 100644
--- a/code/compat/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java
+++ b/code/compat/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java
@@ -21,6 +21,7 @@ package org.apache.tamaya.spi;
import org.apache.tamaya.ConfigOperator;
import org.apache.tamaya.ConfigQuery;
import org.apache.tamaya.Configuration;
+import org.apache.tamaya.spi.TypeLiteral;
import org.junit.Test;
import java.net.InetAddress;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/test/java/org/apache/tamaya/spi/FilterContextTest.java
----------------------------------------------------------------------
diff --git a/code/compat/src/test/java/org/apache/tamaya/spi/FilterContextTest.java b/code/compat/src/test/java/org/apache/tamaya/spi/FilterContextTest.java
index e272b9a..99b5679 100644
--- a/code/compat/src/test/java/org/apache/tamaya/spi/FilterContextTest.java
+++ b/code/compat/src/test/java/org/apache/tamaya/spi/FilterContextTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.tamaya.spi;
-import org.apache.tamaya.spi.FilterContext;
+import org.apache.tamaya.spi.TypeLiteral;
import org.junit.Test;
import java.util.Collections;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
----------------------------------------------------------------------
diff --git a/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java b/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
index 31fb2f8..332717a 100644
--- a/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
+++ b/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
@@ -18,6 +18,8 @@
*/
package org.apache.tamaya.spi;
+import org.apache.tamaya.base.ServiceContext;
+import org.apache.tamaya.base.ServiceContextManager;
import org.junit.Test;
import java.io.IOException;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
----------------------------------------------------------------------
diff --git a/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java b/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
index fe4ee05..6ed3e7c 100644
--- a/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
+++ b/code/compat/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
@@ -28,6 +28,8 @@ import java.io.IOException;
import java.net.URL;
import java.util.*;
+import org.apache.tamaya.base.ServiceContext;
+import org.apache.tamaya.base.ServiceContextManager;
import org.junit.Test;
public class ServiceContextTest {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
----------------------------------------------------------------------
diff --git a/code/compat/src/test/java/org/apache/tamaya/spi/TestServiceContext.java b/code/compat/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
index 4b8edc1..55637ca 100644
--- a/code/compat/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
+++ b/code/compat/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
@@ -18,6 +18,8 @@
*/
package org.apache.tamaya.spi;
+import org.apache.tamaya.base.ServiceContext;
+
import java.io.IOException;
import java.net.URL;
import java.util.*;
@@ -26,7 +28,7 @@ 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
+ * This class implements the (default) {@link ServiceContext} interface and hereby uses the JDK
* {@link java.util.ServiceLoader} to load the services required.
*/
public final class TestServiceContext implements ServiceContext {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/compat/src/test/resources/META-INF/services/org.apache.tamaya.base.ServiceContext
----------------------------------------------------------------------
diff --git a/code/compat/src/test/resources/META-INF/services/org.apache.tamaya.base.ServiceContext b/code/compat/src/test/resources/META-INF/services/org.apache.tamaya.base.ServiceContext
new file mode 100644
index 0000000..199956f
--- /dev/null
+++ b/code/compat/src/test/resources/META-INF/services/org.apache.tamaya.base.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/09472084/code/compat/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/code/compat/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/code/compat/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
deleted file mode 100644
index 199956f..0000000
--- a/code/compat/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy current the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.spi.TestServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/bnd.bnd
----------------------------------------------------------------------
diff --git a/code/core/bnd.bnd b/code/core/bnd.bnd
index 7c85414..ff0a686 100644
--- a/code/core/bnd.bnd
+++ b/code/core/bnd.bnd
@@ -29,7 +29,6 @@ Import-Package: \
org.apache.tamaya.base.configsource,\
org.apache.tamaya.base.convert,\
org.apache.tamaya.base.filter,\
- org.apache.tamaya.spi,\
org.osgi.framework,\
javax.annotation
Private-Package: \
@@ -41,5 +40,5 @@ Export-Service: \
javax.config.spi.ConfigProviderResolver,\
javax.config.spi.Converter,\
javax.config.spi.ConfigSource,\
- org.apache.tamaya.spi.ServiceContext
+ org.apache.tamaya.ServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java b/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java
index 3e0fdba..150663c 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/OSGIActivator.java
@@ -19,10 +19,10 @@
package org.apache.tamaya.core;
import org.apache.tamaya.base.DefaultConfigBuilder;
+import org.apache.tamaya.base.ServiceContext;
+import org.apache.tamaya.base.ServiceContextManager;
import org.apache.tamaya.base.configsource.ConfigSourceComparator;
import org.apache.tamaya.base.filter.FilterComparator;
-import org.apache.tamaya.spi.ServiceContext;
-import org.apache.tamaya.spi.ServiceContextManager;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/main/java/org/apache/tamaya/core/OSGIServiceContext.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/OSGIServiceContext.java b/code/core/src/main/java/org/apache/tamaya/core/OSGIServiceContext.java
index eb01733..8359fb9 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/OSGIServiceContext.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/OSGIServiceContext.java
@@ -18,7 +18,7 @@
*/
package org.apache.tamaya.core;
-import org.apache.tamaya.spi.ServiceContext;
+import org.apache.tamaya.base.ServiceContext;
import org.osgi.framework.Bundle;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/main/java/org/apache/tamaya/core/TamayaConfigProviderResolver.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/TamayaConfigProviderResolver.java b/code/core/src/main/java/org/apache/tamaya/core/TamayaConfigProviderResolver.java
index 9c9d587..81f01e1 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/TamayaConfigProviderResolver.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/TamayaConfigProviderResolver.java
@@ -19,7 +19,10 @@
package org.apache.tamaya.core;
import org.apache.tamaya.base.DefaultConfigBuilder;
-import org.apache.tamaya.spi.*;
+import org.apache.tamaya.base.ConfigContext;
+import org.apache.tamaya.base.ServiceContext;
+import org.apache.tamaya.base.ServiceContextManager;
+import org.apache.tamaya.base.filter.Filter;
import org.osgi.service.component.annotations.Component;
import javax.config.Config;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/main/java/org/apache/tamaya/core/converters/ConvertQuery.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/converters/ConvertQuery.java b/code/core/src/main/java/org/apache/tamaya/core/converters/ConvertQuery.java
index 2b22d83..859e8b3 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/converters/ConvertQuery.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/converters/ConvertQuery.java
@@ -19,8 +19,8 @@
package org.apache.tamaya.core.converters;
import org.apache.tamaya.base.convert.ConversionContext;
-import org.apache.tamaya.spi.ConfigContext;
-import org.apache.tamaya.spi.ConfigContextSupplier;
+import org.apache.tamaya.base.ConfigContext;
+import org.apache.tamaya.base.ConfigContextSupplier;
import javax.config.Config;
import javax.config.spi.Converter;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/main/resources/META-INF/services/org.apache.tamaya.base.ServiceContext
----------------------------------------------------------------------
diff --git a/code/core/src/main/resources/META-INF/services/org.apache.tamaya.base.ServiceContext b/code/core/src/main/resources/META-INF/services/org.apache.tamaya.base.ServiceContext
new file mode 100644
index 0000000..4364f06
--- /dev/null
+++ b/code/core/src/main/resources/META-INF/services/org.apache.tamaya.base.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.base.DefaultServiceContext
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigValueEvaluator
----------------------------------------------------------------------
diff --git a/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigValueEvaluator b/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigValueEvaluator
deleted file mode 100644
index 26d41ab..0000000
--- a/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigValueEvaluator
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy current the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.base.DefaultConfigValueEvaluator
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
deleted file mode 100644
index 4364f06..0000000
--- a/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy current the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.base.DefaultServiceContext
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spisupport.ConfigValueEvaluator
----------------------------------------------------------------------
diff --git a/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spisupport.ConfigValueEvaluator b/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spisupport.ConfigValueEvaluator
new file mode 100644
index 0000000..26d41ab
--- /dev/null
+++ b/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spisupport.ConfigValueEvaluator
@@ -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.base.DefaultConfigValueEvaluator
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/test/java/org/apache/tamaya/core/TamayaConfigProviderResolverTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/TamayaConfigProviderResolverTest.java b/code/core/src/test/java/org/apache/tamaya/core/TamayaConfigProviderResolverTest.java
index dafe7a3..d3713cf 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/TamayaConfigProviderResolverTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/TamayaConfigProviderResolverTest.java
@@ -18,9 +18,7 @@
*/
package org.apache.tamaya.core;
-import org.apache.tamaya.core.TamayaConfigProviderResolver;
-import org.apache.tamaya.spi.ConfigContext;
-import org.apache.tamaya.spi.ConfigContextSupplier;
+import org.apache.tamaya.base.ConfigContextSupplier;
import org.junit.Test;
import static org.junit.Assert.*;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/test/java/org/apache/tamaya/core/testdata/TestFilter.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestFilter.java b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestFilter.java
index e0f93bf..4f7bca7 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestFilter.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestFilter.java
@@ -19,8 +19,7 @@
package org.apache.tamaya.core.testdata;
import org.apache.tamaya.base.filter.FilterContext;
-import org.apache.tamaya.spi.Filter;
-import org.apache.tamaya.spi.ConfigValue;
+import org.apache.tamaya.base.filter.Filter;
import javax.annotation.Priority;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingFilter.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingFilter.java b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingFilter.java
index 795ec37..919d808 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingFilter.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingFilter.java
@@ -19,8 +19,7 @@
package org.apache.tamaya.core.testdata;
import org.apache.tamaya.base.filter.FilterContext;
-import org.apache.tamaya.spi.Filter;
-import org.apache.tamaya.spi.ConfigValue;
+import org.apache.tamaya.base.filter.Filter;
import javax.annotation.Priority;
import javax.config.ConfigProvider;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/test/resources/META-INF/services/org.apache.tamaya.base.filter.Filter
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.base.filter.Filter b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.base.filter.Filter
new file mode 100644
index 0000000..d727173
--- /dev/null
+++ b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.base.filter.Filter
@@ -0,0 +1,20 @@
+#
+# 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.core.testdata.TestFilter
+org.apache.tamaya.core.testdata.TestRemovingFilter
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.Filter
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.Filter b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.Filter
deleted file mode 100644
index d727173..0000000
--- a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.Filter
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy current the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-org.apache.tamaya.core.testdata.TestFilter
-org.apache.tamaya.core.testdata.TestRemovingFilter
[2/3] incubator-tamaya git commit: - Adapted OSGI deps. - Defined
clear resolvability of packages,
removing redundancies. - Refactored parts of TypeLiteral into util class.
Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/ConfigContextSupplier.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/ConfigContextSupplier.java b/code/base/src/main/java/org/apache/tamaya/spi/ConfigContextSupplier.java
deleted file mode 100644
index 0207ebe..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/ConfigContextSupplier.java
+++ /dev/null
@@ -1,47 +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 jdk.nashorn.internal.objects.annotations.Function;
-
-import javax.config.spi.ConfigSource;
-import javax.config.spi.Converter;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Central SPI for programmatically dealing with the setup of the configuration system.
- * This includes adding and enlisting {@link ConfigSource}s,
- * managing {@link Converter}s, ConfigFilters, etc.
- */
-@FunctionalInterface
-public interface ConfigContextSupplier {
-
- /**
- * Make an instance of a configuration accessible for use with Apache Tamaya specific extensions.
- * In most cases it should be sufficient to implement this interfance on your implementation of
- * {@link javax.config.Config}.
- *
- * @return the corresponding configuration context, never null.
- */
- ConfigContext getConfigContext();
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/ConfigValue.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/ConfigValue.java b/code/base/src/main/java/org/apache/tamaya/spi/ConfigValue.java
deleted file mode 100644
index fedcef5..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/ConfigValue.java
+++ /dev/null
@@ -1,209 +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.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Class modelling the result of a request for a property value. A property value is basically identified by its key.
- * There might be reasons, where one want to further analyze, which PropertySources provided a value and which not, so
- * it is possible to create a PropertyValue with a null value. Nevertheless in all cases the provider source (typically
- * the name of the PropertySource) must be set.
- */
-public final class ConfigValue implements Serializable{
- private static final long serialVersionUID = 1L;
- /** The requested key. */
- private String key;
- /** The value. */
- private String value;
- /** Additional metadata provided by the provider. */
- private String metaEntry;
-
- ConfigValue(ConfigValueBuilder builder){
- this.key = Objects.requireNonNull(builder.key);
- this.value = Objects.requireNonNull(builder.value);
- this.metaEntry = builder.metaEntry;
- }
-
- /**
- * Creates a new instance
- * @param key the key, not {@code null}.
- * @param value the value, not {@code null}.
- * @param metaEntry the source, typically the name of the {@link javax.config.spi.ConfigSource} providing
- * the value, not {@code null}.
- */
- private ConfigValue(String key, String value, String metaEntry){
- this.key = Objects.requireNonNull(key, "Key is required.");
- this.value = Objects.requireNonNull(value, "Value is required.");
- this.metaEntry = metaEntry;
- }
-
- /**
- * The requested key.
- * @return the, key never {@code null}.
- */
- public String getKey() {
- return key;
- }
-
- /**
- * The value.
- * @return the value, in case a value is null it is valid to return {#code null} as result for
- * {@link javax.config.spi.ConfigSource#getValue(String)}}.
- */
- public String getValue() {
- return this.value;
- }
-
- /**
- * Creates a full configuration map for this key, value pair and all its meta context data. This map
- * is also used for subsequent processing, like value filtering.
- * @return the property value entry map.
- */
- public String getMetaEntry() {
- return metaEntry;
- }
-
- /**
- * Creates a new builder instance.
- * @param key the key, not {@code null}.
- * @return a new builder instance.
- */
- public static ConfigValueBuilder builder(String key){
- Objects.requireNonNull(key, "Key must be given.");
- return new ConfigValueBuilder(key);
- }
-
- /**
- * Creates a new builder instance.
- * @param key the key, not {@code null}.
- * @param value the property value, not {@code null}.
- * @return a new builder instance.
- */
- public static ConfigValueBuilder builder(String key, String value) {
- Objects.requireNonNull(key, "Key must be given.");
- Objects.requireNonNull(value, "Value must be given");
- return new ConfigValueBuilder(key, value);
- }
-
-
- /**
- * Creates a new PropertyValue without any metadata..
- * @param key the key, not {@code null}.
- * @param value the value.
- * @param metaEntry the metaEntry, typically the name of the {@link javax.config.spi.ConfigSource}
- * providing the value, not {@code null}.
- * @return a new property value instance, or {@code null},
- * if the value passed is {@code null}..
- */
- public static ConfigValue of(String key, String value, String metaEntry) {
- if (value==null) {
- return null;
- }
- return new ConfigValue(key, value, metaEntry);
- }
-
- /**
- * Creates a new builder instance based on this item.
- * @return a new builder, never null.
- */
- public ConfigValueBuilder toBuilder() {
- return new ConfigValueBuilder(this.getKey())
- .setValue(this.getValue())
- .setMetaEntry(this.metaEntry);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ConfigValue)) return false;
- ConfigValue that = (ConfigValue) o;
- return Objects.equals(getKey(), that.getKey()) &&
- Objects.equals(getValue(), that.getValue()) &&
- Objects.equals(getMetaEntry(), that.getMetaEntry());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getKey(), getValue(),
- getMetaEntry());
- }
-
- @Override
- public String toString() {
- return "PropertyValue{" +
- "key='" + key + '\'' +
- ", value='" + value + '\'' +
- ", metaEntry='" + metaEntry + '\'' +
- '}';
- }
-
- /**
- * Maps a map of {@code Map<String,String>} to a {@code Map<String,PropertyValue>}.
- * @param config the String based map, not {@code null}.
- * @return the corresponding value based map.
- */
- public static Map<String,ConfigValue> map(Map<String, String> config) {
- Map<String,ConfigValue> result = new HashMap<>(config.size());
- for(Map.Entry<String,String> en:config.entrySet()){
- result.put(en.getKey(), ConfigValue.of(en.getKey(), en.getValue(), config.get(en.getKey()+"[meta]")));
- }
- return result;
- }
-
- /**
- * Maps a map of {@code Map<String,String>} to a {@code Map<String,PropertyValue>}.
- *
- * @param config the String based map, not {@code null}.
- * @param source the source name, not {@code null}.
- * @param metaData additional metadata, not {@code null}.
- * @return the corresponding value based map.
- */
- public static Map<String,ConfigValue> map(Map<String, String> config, String source,
- Map<String,String> metaData) {
- Objects.requireNonNull(config, "Config must be given.");
- Objects.requireNonNull(source, "Source must be given.");
- Objects.requireNonNull(metaData, "Meta data must be given.");
-
- Map<String,ConfigValue> result = new HashMap<>(config.size());
-
- for(Map.Entry<String,String> en:config.entrySet()){
- ConfigValue value = new ConfigValueBuilder(en.getKey(), source).setValue(en.getValue())
- .addMetaEntries(metaData).build();
- result.put(en.getKey(), value);
- }
- return result;
- }
-
- public Map<? extends String, ? extends String> asMap() {
- Map<String,String> map = new HashMap<>();
- map.put(key, value);
- map.put(key+"[meta]", this.metaEntry);
- return map;
- }
-
- public static ConfigValue of(String key, Map<String, String> rawProperties) {
- String value = rawProperties.get(key);
- String meta = rawProperties.get(key+"[meta]");
- return new ConfigValue(key, value, meta);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/ConfigValueBuilder.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/ConfigValueBuilder.java b/code/base/src/main/java/org/apache/tamaya/spi/ConfigValueBuilder.java
deleted file mode 100644
index d1c2d60..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/ConfigValueBuilder.java
+++ /dev/null
@@ -1,179 +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.io.IOException;
-import java.io.StringWriter;
-import java.util.*;
-
-/**
- * Builder to create a {@link ConfigValue} instance.
- */
-public class ConfigValueBuilder {
- /** The key accessed. */
- String key;
- /** The property value. */
- String value;
- /** additional metadata entries (optional). */
- String metaEntry;
-
- /**
- * Create a new builder instance, for a given set of parameters.
- * Before calling build at least a {@link #value} and its {@link #metaEntry}
- * must be set.
- */
- ConfigValueBuilder(String key){
- this.key = Objects.requireNonNull(key);
- }
-
- /**
- * Create a new builder instance, for a given set of parameters.
- * @param key to access a property value, not {@code null}.
- * @param value property value.
- */
- ConfigValueBuilder(String key, String value) {
- this.key = Objects.requireNonNull(key);
- this.value = Objects.requireNonNull(value);
- }
-
- /**
- * Create a new builder instance, for a given set of parameters.
- *
- * @param key to access a property value.
- * @param value the value, not {@code null}. If a value is {@code null}
- * {@link javax.config.spi.ConfigSource#getValue(String)} should return {@code null}.
- * @param metaEntry property metaEntry.
- */
- ConfigValueBuilder(String key, String value, String metaEntry) {
- this.key = Objects.requireNonNull(key);
- this.value = value;
- this.metaEntry = Objects.requireNonNull(metaEntry);
- }
-
- /**
- * Replaces/sets the context data.
- * @param metaEntry the context data to be applied.
- * @return the builder for chaining.
- */
- public ConfigValueBuilder setMetaEntry(String metaEntry) {
- this.metaEntry = metaEntry;
- return this;
- }
-
- /**
- * Add an additional context data information.
- * @param key the context data key, not {@code null}.
- * @param value the context value, not {@code null} (will be converted to String).
- * @return the builder for chaining.
- */
- public ConfigValueBuilder addMetaEntry(String key, String value) {
- Objects.requireNonNull(key, "Meta key must be given.");
- Objects.requireNonNull(value, "Meta value must be given.");
- if(metaEntry==null){
- metaEntry = key+"="+value;
- }else{
- metaEntry = "\n" + key+"="+value;
- }
- return this;
- }
-
- /**
- * Adds the context data given.
- * @param metaEntries the context data to be applied, not {@code null}.
- * @return the builder for chaining.
- */
- public ConfigValueBuilder addMetaEntries(Map<String, String> metaEntries) {
- Properties props = new Properties();
- props.putAll(metaEntries);
- StringWriter stringWriter = new StringWriter();
- try {
- props.store(stringWriter, null);
- stringWriter.flush();
- if(metaEntry==null){
- metaEntry = stringWriter.toString();
- }else{
- metaEntry += '\n' + stringWriter.toString();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- return this;
- }
-
- /**
- * Adds the context data given as JSON object.
- * @param meta the context data in JSON format, not {@code null}.
- * @return the builder for chaining.
- */
- public ConfigValueBuilder addMetaEntry(String meta) {
- if(metaEntry==null){
- metaEntry = meta;
- }else{
- metaEntry += '\n' + meta;
- }
- return this;
- }
-
- /**
- * Get the value's context data.
- * @return the context data, not {@code null}.
- */
- public String getMetaEntry() {
- return metaEntry;
- }
-
- /**
- * Sets a new key.
- * @param key the new key, not {@code null}.
- * @return the builder for chaining.
- */
- public ConfigValueBuilder setKey(String key) {
- this.key = Objects.requireNonNull(key);
- return this;
- }
-
- /**
- * Sets a new value.
- * @param value the new value, not {@code null}.
- * @return the builder for chaining.
- */
- public ConfigValueBuilder setValue(String value) {
- this.value = Objects.requireNonNull(value, "Value must be given.");
-
- return this;
- }
-
- /**
- * Creates a new immutable {@link ConfigValue}.
- * @return a new immutable {@link ConfigValue}, never {@code null}.
- */
- public ConfigValue build(){
- return new ConfigValue(this);
- }
-
- @Override
- public String toString() {
- return "PropertyValueBuilder{" +
- "key='" + key + '\'' +
- "value='" + value + '\'' +
- ", metaEntry=" + metaEntry +
- '}';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/ConfigValueCombinationPolicy.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/ConfigValueCombinationPolicy.java b/code/base/src/main/java/org/apache/tamaya/spi/ConfigValueCombinationPolicy.java
deleted file mode 100644
index f380bf8..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/ConfigValueCombinationPolicy.java
+++ /dev/null
@@ -1,71 +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 javax.config.Config;
-import javax.config.spi.ConfigSource;
-
-/**
- * Policy that determines how the final value of a configuration entry is evaluated. An instances of this
- * interface can be registered to get control how multiple PropertySources are combined. This is useful in cases
- * where the default overriding policy as implemented in {@link #DEFAULT_OVERRIDING_POLICY} is not matching
- * the need of the current application, e.g. then entries containing multiple values should be combined to new
- * values instead of overridden.
- */
-public interface ConfigValueCombinationPolicy {
-
- /**
- * Default overriding collector, where each existing entry ({@code current} is overridden by a subsequent non-null
- * entry evaluated by {@code propertySource.get(key)}.
- */
- ConfigValueCombinationPolicy DEFAULT_OVERRIDING_POLICY = (currentValue, key, propertySource) -> {
- String value = propertySource.getValue(key);
- String meta = propertySource.getValue(key+"[meta]");
- return value!=null? value:currentValue;
- };
-
- /**
- * @deprecated Use {@linkplain #DEFAULT_OVERRIDING_POLICY} instead. Will be removed in 1.0.
- */
- @Deprecated
- ConfigValueCombinationPolicy DEFAULT_OVERRIDING_COLLECTOR = DEFAULT_OVERRIDING_POLICY;
-
-
- /**
- * Method that is called for each value evaluated by a PropertySource for the given key. This method is called
- * either when a single key is accessed, e.g. by calling {@code org.apache.tamaya.Configuration.getXXX}, but also
- * when the full configuration property map is accessed by calling
- * {@link Config#getPropertyNames()}}.
- *
- * @param currentValue the current value, including metadata entries. If no such key is present the current value
- * is null.
- * The collector should either combine the existing value with value from {@code currentValue}
- * or replace the value in {@code currentValue} with {@code valueRead}, hereby returning the
- * result to be used as new {@code currentValue}.
- * @param key The current key to be evaluated.
- * @param propertySource The PropertySource that may return an value for the given key. The PropertySource given
- * may be evaluated for additional meta-data, how the given values are to be combined.
- * Note that the value returned by a PropertySource can be null. In that case
- * {@code currentValue} should be returned in almost all cases.
- * @return the value to be used for future evaluation, including metadata entries.
- */
- String collect(String currentValue, String key, ConfigSource propertySource);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/Experimental.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/Experimental.java b/code/base/src/main/java/org/apache/tamaya/spi/Experimental.java
deleted file mode 100644
index 9831820..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/Experimental.java
+++ /dev/null
@@ -1,32 +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.lang.annotation.*;
-
-/**
- * This is a simple annotation for flaging out functionality or features the Tamaya team is not sure if it is already
- * stabilized, so use it with some caution.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Inherited
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD,
- ElementType.TYPE})
-public @interface Experimental {
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/Filter.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/Filter.java b/code/base/src/main/java/org/apache/tamaya/spi/Filter.java
deleted file mode 100644
index 2cafbdb..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/Filter.java
+++ /dev/null
@@ -1,51 +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;
-
-
-/**
- * <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>
- */
-@FunctionalInterface
-public interface Filter {
-
- /**
- * <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.</p>
- * <h3>Implementation specification</h3>
- * Implementations of this class must be
- * <ul>
- * <li>reentrant</li>
- * <li>thread-safe</li>
- * </ul>
- * @param key the key, not null.
- * @param value the value to be filtered, which also can be {@code null} if removed by another filter.
- * @return the filtered value, or {@code null} if the value should be removed alltogether.
- * @see ConfigValue
- * @see ConfigValueBuilder
- */
- String filterProperty(String key, String value);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/ServiceContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/ServiceContext.java b/code/base/src/main/java/org/apache/tamaya/spi/ServiceContext.java
deleted file mode 100644
index ff0bb9f..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/ServiceContext.java
+++ /dev/null
@@ -1,147 +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.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-
-
-/**
- * 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();
-
- static ClassLoader defaultClassLoader(){
- ClassLoader classloader = Thread.currentThread().getContextClassLoader();
- if(classloader==null){
- classloader = ServiceContextManager.class.getClassLoader();
- }
- return classloader;
- }
-
- /**
- * Access a service singleton via its type.
- * If multiple implementations for the very serviceType exist then
- * the one with the highest {@link javax.annotation.Priority} will be used.
- *
- * @param <T> the type of the service type.
- * @param serviceType the service type.
- * @return The instance to be used, or {@code null}
- * @throws IllegalArgumentException if there are multiple service implementations with the maximum priority.
- */
- default <T> T getService(Class<T> serviceType){
- return getService(serviceType, defaultClassLoader());
- }
-
- /**
- * Access a service singleton via its type.
- * If multiple implementations for the very serviceType exist then
- * the one with the highest {@link javax.annotation.Priority} will be used.
- *
- * @param <T> the type of the service type.
- * @param serviceType the service type.
- * @param classLoader the class loader to be considered.
- * @return The instance to be used, or {@code null}
- * @throws IllegalArgumentException if there are multiple service implementations with the maximum priority.
- */
- <T> T getService(Class<T> serviceType, ClassLoader classLoader);
-
- /**
- * Factory method to create a type, hereby a new instance is created on each access.
- * If multiple implementations for the very serviceType exist then
- * the one with the highest {@link javax.annotation.Priority} will be used as the base
- * for creating subsequent instances.
- *
- * @param <T> the type of the service type.
- * @param serviceType the service type.
- * @return The new instance to be used, or {@code null}
- * @throws IllegalArgumentException if there are multiple service implementations with the maximum priority.
- */
- default <T> T create(Class<T> serviceType){
- return create(serviceType, defaultClassLoader());
- }
-
- /**
- * Factory method to create a type, hereby a new instance is created on each access.
- * If multiple implementations for the very serviceType exist then
- * the one with the highest {@link javax.annotation.Priority} will be used as the base
- * for creating subsequent instances.
- *
- * @param <T> the type of the service type.
- * @param serviceType the service type.
- * @param classLoader the class loader to be considered.
- * @return The new instance to be used, or {@code null}
- * @throws IllegalArgumentException if there are multiple service implementations with the maximum priority.
- */
- <T> T create(Class<T> serviceType, ClassLoader classLoader);
-
-
- /**
- * 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 <T> the type of the list element returned by this method
- * @return The instance to be used, never {@code null}
- */
- default <T> List<T> getServices(Class<T> serviceType){
- return getServices(serviceType, defaultClassLoader());
- }
-
- /**
- * 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 <T> the type of the list element returned by this method
- * @return The instance to be used, never {@code null}
- */
- <T> List<T> getServices(Class<T> serviceType, ClassLoader classLoader);
-
- /**
- * Loads resources from the current runtime context. This method allows to use runtime
- * specific code to load resources, e.g. within OSGI environments.
- * @param resource the resource, not {@code null}.
- * @param cl the desired classloader context, if null, the current thread context classloader is used.
- * @return the resources found
- * @throws IOException if load fails.
- */
- Enumeration<URL> getResources(String resource, ClassLoader cl) throws IOException;
-
- /**
- * Loads a resource from the current runtime context. This method allows to use runtime
- * specific code to load a resource, e.g. within OSGI environments.
- * @param resource the resource, not {@code null}.
- * @param cl the desired classloader context, if null, the current thread context classloader is used.
- * @return the resource found, or {@code null}.
- */
- URL getResource(String resource, ClassLoader cl);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java b/code/base/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
deleted file mode 100644
index ddfd425..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
+++ /dev/null
@@ -1,118 +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.Objects;
-import java.util.ServiceLoader;
-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.
- */
-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 (highestServiceContext == null) {
- highestServiceContext = serviceContext;
- } else if (serviceContext.ordinal() > highestOrdinal) {
- highestServiceContext = serviceContext;
- highestOrdinal = serviceContext.ordinal();
- }
- }
- } catch (Exception e) {
- throw new IllegalStateException("ServiceContext not loadable", e);
- }
- if (highestServiceContext == null) {
- throw new IllegalStateException("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 {@code null}.
- * @return the currently used context after setting it.
- */
- public static ServiceContext set(ServiceContext serviceContextProvider) {
- Objects.requireNonNull(serviceContextProvider);
- ServiceContext currentContext = ServiceContextManager.serviceContextProviderDelegate;
-
- 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;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/StandaloneConfigContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/StandaloneConfigContext.java b/code/base/src/main/java/org/apache/tamaya/spi/StandaloneConfigContext.java
deleted file mode 100644
index 43eba5c..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/StandaloneConfigContext.java
+++ /dev/null
@@ -1,292 +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 org.apache.tamaya.base.configsource.ConfigSourceComparator;
-//import org.apache.tamaya.base.convert.ConverterManager;
-//
-//import javax.config.spi.ConfigSource;
-//import javax.config.spi.Converter;
-//import java.lang.reflect.ParameterizedType;
-//import java.lang.reflect.Type;
-//import java.util.*;
-//import java.util.concurrent.locks.ReentrantReadWriteLock;
-//import java.util.logging.Logger;
-//
-///**
-// * Central SPI for programmatically dealing with the setup of the configuration system.
-// * This includes adding and enlisting {@link ConfigSource}s,
-// * managing {@link Converter}s, ConfigFilters, etc.
-// */
-//public final class StandaloneConfigContext implements ConfigContext{
-//
-// private static final Logger LOG = Logger.getLogger(StandaloneConfigContext.class.getName());
-//
-// /**
-// * Subcomponent handling {@link Converter} instances.
-// */
-// private final ConverterManager converterManager = new ConverterManager();
-//
-//
-//
-// /**
-// * The current unmodifiable list of loaded {@link Filter} instances.
-// */
-// private final List<Filter> immutableFilters;
-//
-// /**
-// * The current unmodifiable list of loaded {@link ConfigSource} instances.
-// */
-// @Override
-// public List<ConfigSource> getSources(){
-// return immutableConfigSources;
-// }
-//
-// /**
-// * The current unmodifiable list of loaded {@link Filter} instances.
-// */
-// @Override
-// public List<Filter> getFilters(){
-// return immutableFilters;
-// }
-//
-//
-// /**
-// * Lock for internal synchronization.
-// */
-// final ReentrantReadWriteLock propertySourceLock = new ReentrantReadWriteLock();
-//
-// @SuppressWarnings("unchecked")
-// StandaloneConfigContext(StandaloneConfigContextBuilder builder) {
-// List<ConfigSource> propertySources = new ArrayList<>();
-// // first we load all PropertySources which got registered via java.util.ServiceLoader
-// propertySources.addAll(builder.propertySources);
-// // now sort them according to their ordinal values
-// immutableConfigSources = Collections.unmodifiableList(propertySources);
-//
-// // as next step we pick up the PropertyFilters pretty much the same way
-// List<Filter> filters = new ArrayList<>(builder.getFilters());
-// immutableFilters = Collections.unmodifiableList(filters);
-//
-// // Finally add the converters
-// for(Map.Entry<Type, Collection<Converter>> en:builder.getConverter().entrySet()) {
-// for (@SuppressWarnings("rawtypes") Converter converter : en.getValue()) {
-// this.converterManager.addSources(en.getKey(), converter);
-// }
-// }
-// LOG.info("Registered " + converterManager.getConverters().size() + " property converters: " +
-// converterManager.getConverters());
-//
-// configValueCombinationPolicy = builder.combinationPolicy;
-//
-// }
-//
-//
-// @Override
-// public boolean equals(Object o) {
-// if (this == o) {
-// return true;
-// }
-// if (!(o instanceof StandaloneConfigContext)){
-// return false;
-// }
-//
-// StandaloneConfigContext that = (StandaloneConfigContext) o;
-//
-// if (!converterManager.equals(that.converterManager)) {
-// return false;
-// }
-// if (!immutableConfigSources.equals(that.immutableConfigSources)) {
-// return false;
-// }
-// if (!immutableFilters.equals(that.immutableFilters)) {
-// return false;
-// }
-// return getConfigValueCombinationPolicy().equals(that.getConfigValueCombinationPolicy());
-//
-// }
-//
-// @Override
-// public int hashCode() {
-// int result = converterManager.hashCode();
-// result = 31 * result + immutableConfigSources.hashCode();
-// result = 31 * result + immutableFilters.hashCode();
-// result = 31 * result + getConfigValueCombinationPolicy().hashCode();
-// return result;
-// }
-//
-// @Override
-// public String toString() {
-// StringBuilder b = new StringBuilder("ConfigurationContext{\n");
-// b.append(" Property Sources\n");
-// b.append(" ----------------\n");
-// if(immutableConfigSources.isEmpty()){
-// b.append(" No property sources loaded.\n\n");
-// }else {
-// b.append(" CLASS NAME ORDINAL SCANNABLE SIZE STATE ERROR\n\n");
-// for (ConfigSource ps : immutableConfigSources) {
-// b.append(" ");
-// appendFormatted(b, ps.getClass().getSimpleName(), 30);
-// appendFormatted(b, ps.getName(), 70);
-// appendFormatted(b, String.valueOf(ConfigSourceComparator.getOrdinal(ps)), 8);
-// String state = ps.getValue("_state");
-// if(state==null){
-// appendFormatted(b, "OK", 10);
-// }else {
-// appendFormatted(b, state, 10);
-// if("ERROR".equals(state)){
-// String val = ps.getValue("_exception");
-// if(val!=null) {
-// appendFormatted(b, val, 30);
-// }
-// }
-// }
-// b.append('\n');
-// }
-// b.append("\n");
-// }
-// b.append(" Property Filters\n");
-// b.append(" ----------------\n");
-// if(immutableFilters.isEmpty()){
-// b.append(" No property filters loaded.\n\n");
-// }else {
-// b.append(" CLASS INFO\n\n");
-// for (Filter filter : getPropertyFilters()) {
-// b.append(" ");
-// appendFormatted(b, filter.getClass().getSimpleName(), 30);
-// b.append(removeNewLines(filter.toString()));
-// b.append('\n');
-// }
-// b.append("\n\n");
-// }
-// b.append(" Property Converters\n");
-// b.append(" -------------------\n");
-// b.append(" CLASS TYPE INFO\n\n");
-// for(Map.Entry<Type, List<Converter>> converterEntry: getConverters().entrySet()){
-// for(Converter converter: converterEntry.getValue()){
-// b.append(" ");
-// appendFormatted(b, converter.getClass().getSimpleName(), 30);
-// if(converterEntry.getKey() instanceof ParameterizedType){
-// ParameterizedType pt = (ParameterizedType)converterEntry.getKey();
-// appendFormatted(b, pt.getRawType().getTypeName(), 30);
-// }else{
-// appendFormatted(b, converterEntry.getKey().getTypeName(), 30);
-// }
-// b.append(removeNewLines(converter.toString()));
-// b.append('\n');
-// }
-// }
-// b.append("\n\n");
-// b.append(" PropertyValueCombinationPolicy: " + getConfigValueCombinationPolicy().getClass().getName()).append('\n');
-// b.append('}');
-// return b.toString();
-// }
-//
-//
-//
-//
-//
-// /**
-// * <p>
-// * This method returns the Map of registered PropertyConverters
-// * per type.
-// * The List for each type is ordered via their {@link javax.annotation.Priority} and
-// * cladd name.
-// * </p>
-// *
-// * <p>A simplified scenario could be like:</p>
-// * <pre>
-// * {
-// * Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
-// * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
-// * Integer.class -> {DynamicDefaultConverter}
-// * }
-// * </pre>
-// *
-// * @return map with sorted list of registered PropertySources per type.
-// */
-// public Map<Type, List<Converter>> getConverters() {
-// return converterManager.getConverters();
-// }
-//
-// /**
-// * <p>
-// * This method returns the registered PropertyConverters for a given type.
-// * The List for each type is ordered via their {@link javax.annotation.Priority}.
-// * </p>
-// *
-// * <p>
-// * PropertyConverters with a higher Priority come first. The PropertyConverter with the
-// * lowest Priority comes last.
-// * If two PropertyConverter have the same ordinal number they will get sorted
-// * using their class name just to ensure the user at least gets the same ordering
-// * after a JVM restart.
-// * </p>
-// *
-// * <p>
-// * Additionally if a PropertyProvider is accessed, which is not registered the implementation
-// * should try to figure out, if there could be a default implementation as follows:</p>
-// * <ol>
-// * <li>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
-// * instanceOf(String), fomr(String)}</li>
-// * <li>Look for a matching constructor: {@code T(String)}.</li>
-// * </ol>
-// *
-// * <p>
-// * If a correspoding factory method or constructor could be found, a corresponding
-// * PropertyConverter should be created and registered automatically for the given
-// * type.
-// * </p>
-// *
-// * <p> The scenario could be like:</p>
-// *
-// * <pre>
-// * {
-// * Date.class -> {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
-// * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
-// * Integer.class -> {DynamicDefaultConverter}
-// * }
-// * </pre>
-// *
-// * <p>
-// * The converters returned for a type should be used as a chain, whereas the result of the
-// * first converters that is able to convert the configured value, is taken as the chain's result.
-// * No more converters are called after a converters has successfully converted the input into
-// * the required target type.
-// * </p>
-// *
-// * @param type type of the desired converters
-// * @return a sorted list of registered PropertySources per type.
-// */
-// public List<Converter> getConverters(Type type) {
-// return converterManager.getConverters(type);
-// }
-//
-// /**
-// * Access the current PropertyFilter instances.
-// * @return the list of registered PropertyFilters, never null.
-// */
-// public List<Filter> getPropertyFilters() {
-// return immutableFilters;
-// }
-//
-//
-//
-//}
-//
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/StandaloneConfigContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/StandaloneConfigContextBuilder.java b/code/base/src/main/java/org/apache/tamaya/spi/StandaloneConfigContextBuilder.java
deleted file mode 100644
index f8cd841..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/StandaloneConfigContextBuilder.java
+++ /dev/null
@@ -1,407 +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 org.apache.tamaya.base.configsource.ConfigSourceComparator;
-//import org.apache.tamaya.base.configsource.CLIConfigSource;
-//import org.apache.tamaya.base.configsource.EnvironmentConfigSource;
-//import org.apache.tamaya.base.configsource.JavaConfigurationConfigSource;
-//import org.apache.tamaya.base.configsource.SystemConfigSource;
-//
-//import javax.config.spi.ConfigSource;
-//import javax.config.spi.ConfigSourceProvider;
-//import javax.config.spi.Converter;
-//import java.lang.reflect.ParameterizedType;
-//import java.lang.reflect.Type;
-//import java.util.*;
-//import java.util.logging.Logger;
-//
-///**
-// * Default implementation of {@link StandaloneConfigContextBuilder}.
-// */
-//public final class StandaloneConfigContextBuilder {
-//
-// private static final Logger LOG = Logger.getLogger(StandaloneConfigContextBuilder.class.getName());
-//
-// protected List<Filter> filters = new ArrayList<>();
-// protected List<ConfigSource> propertySources = new ArrayList<>();
-// protected ConfigValueCombinationPolicy combinationPolicy = ConfigValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
-// protected Map<Type, Collection<Converter>> propertyConverters = new HashMap<>();
-//
-// /**
-// * Flag if the config has already been built.
-// * Configuration can be built only once
-// */
-// private boolean built;
-// private ClassLoader classLoader;
-//
-// /**
-// * Creates a new builder instance.
-// */
-// public StandaloneConfigContextBuilder() {
-// }
-//
-// /**
-// * Creates a new builder instance initializing it with the given context.
-// * @param context the context to be used, not null.
-// */
-// public StandaloneConfigContextBuilder(ConfigContext context) {
-// this.propertyConverters.putAll(context.getConverters());
-// this.filters.addAll(context.getFilters());
-// for(ConfigSource ps:context.getSources()) {
-// withSources(ps);
-// }
-// this.combinationPolicy = context.getConfigValueCombinationPolicy();
-// }
-//
-// /**
-// * Allows to reset configuration context during unit tests.
-// */
-// public final StandaloneConfigContextBuilder reset() {
-// checkBuilderState();
-// this.filters.clear();
-// this.propertySources.clear();
-// this.propertyConverters.clear();
-// this.combinationPolicy = ConfigValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
-// return this;
-// }
-//
-//
-// public StandaloneConfigContextBuilder withContext(ConfigContext context) {
-// checkBuilderState();
-// this.propertyConverters.putAll(context.getConverters());
-// for(ConfigSource ps:context.getSources()){
-// this.propertySources.add(ps);
-// }
-// this.filters.addAll(context.getFilters());
-// this.combinationPolicy = context.getConfigValueCombinationPolicy();
-// return this;
-// }
-//
-// public final StandaloneConfigContextBuilder withSources(ConfigSource... sources){
-// return withSources(Arrays.asList(sources));
-// }
-//
-// public StandaloneConfigContextBuilder withSources(Collection<ConfigSource> sources){
-// checkBuilderState();
-// for(ConfigSource source:sources) {
-// if (!this.propertySources.contains(source)) {
-// this.propertySources.add(source);
-// }
-// }
-// return this;
-// }
-//
-//
-// public StandaloneConfigContextBuilder addDiscoveredSources() {
-// checkBuilderState();
-// List<ConfigSource> propertySources = new ArrayList<>();
-//// addDiscoveredSources(propertySources);
-// for(ConfigSource ps: ServiceContextManager.getServiceContext().getServices(ConfigSource.class, classLoader)) {
-// if(!propertySources.contains(ps)){
-// propertySources.add(ps);
-// }
-// }
-//
-// for(ConfigSourceProvider provider:
-// ServiceContextManager.getServiceContext().getServices(ConfigSourceProvider.class, classLoader)){
-// for(ConfigSource src: provider.getConfigSources(classLoader)){
-// propertySources.add(src);
-// }
-// }
-// Collections.sort(propertySources, ConfigSourceComparator.getInstance());
-// return withSources(propertySources);
-// }
-//
-// private StandaloneConfigContextBuilder addDiscoveredSources(List<ConfigSource> propertySources) {
-// for(ConfigSource ps: new ConfigSource[]{
-// new EnvironmentConfigSource(),
-// new JavaConfigurationConfigSource(),
-// new CLIConfigSource(),
-// new SystemConfigSource()
-// }){
-// if(!propertySources.contains(ps)){
-// propertySources.add(ps);
-// }
-// }
-// return this;
-// }
-//
-// public StandaloneConfigContextBuilder addDiscoveredPropertyFilters() {
-// checkBuilderState();
-// for(Filter pf:ServiceContextManager.getServiceContext().getServices(Filter.class, classLoader)){
-// withFilters(pf);
-// }
-// return this;
-// }
-//
-// public StandaloneConfigContextBuilder addDiscoveredConverters() {
-// checkBuilderState();
-// addDiscoveredConverters();
-// for(Map.Entry<Type, Collection<Converter>> en: getDefaultConverters().entrySet()){
-// for(Converter pc: en.getValue()) {
-// withConverters(en.getKey(), pc);
-// }
-// }
-// return this;
-// }
-//
-// @SuppressWarnings("unchecked")
-// public void addDiscoveredConverters() {
-// // should be overridden by subclasses.
-// }
-//
-// public final StandaloneConfigContextBuilder removeSources(ConfigSource... propertySources) {
-// return removeSources(Arrays.asList(propertySources));
-// }
-//
-// public StandaloneConfigContextBuilder removeSources(Collection<ConfigSource> propertySources) {
-// checkBuilderState();
-// this.propertySources.removeAll(propertySources);
-// return this;
-// }
-//
-// protected ConfigSource getSource(String name) {
-// for(ConfigSource ps:propertySources){
-// if(ps.getName().equals(name)){
-// return ps;
-// }
-// }
-// throw new IllegalArgumentException("No such PropertySource: "+name);
-// }
-//
-// public List<ConfigSource> getSources() {
-// return Collections.unmodifiableList(this.propertySources);
-// }
-//
-// public StandaloneConfigContextBuilder increasePriority(ConfigSource propertySource) {
-// checkBuilderState();
-// int index = propertySources.indexOf(propertySource);
-// if(index<0){
-// throw new IllegalArgumentException("No such PropertySource: " + propertySource);
-// }
-// if(index<(propertySources.size()-1)){
-// propertySources.remove(propertySource);
-// propertySources.add(index+1, propertySource);
-// }
-// return this;
-// }
-//
-// public StandaloneConfigContextBuilder decreasePriority(ConfigSource propertySource) {
-// checkBuilderState();
-// int index = propertySources.indexOf(propertySource);
-// if(index<0){
-// throw new IllegalArgumentException("No such PropertySource: " + propertySource);
-// }
-// if(index>0){
-// propertySources.remove(propertySource);
-// propertySources.add(index-1, propertySource);
-// }
-// return this;
-// }
-//
-// public StandaloneConfigContextBuilder highestPriority(ConfigSource propertySource) {
-// checkBuilderState();
-// int index = propertySources.indexOf(propertySource);
-// if(index<0){
-// throw new IllegalArgumentException("No such PropertySource: " + propertySource);
-// }
-// if(index<(propertySources.size()-1)){
-// propertySources.remove(propertySource);
-// propertySources.add(propertySource);
-// }
-// return this;
-// }
-//
-// public StandaloneConfigContextBuilder lowestPriority(ConfigSource propertySource) {
-// checkBuilderState();
-// int index = propertySources.indexOf(propertySource);
-// if(index<0){
-// throw new IllegalArgumentException("No such PropertySource: " + propertySource);
-// }
-// if(index>0){
-// propertySources.remove(propertySource);
-// propertySources.add(0, propertySource);
-// }
-// return this;
-// }
-//
-// public final StandaloneConfigContextBuilder withFilters(Filter... filters){
-// return withFilters(Arrays.asList(filters));
-// }
-//
-// public final StandaloneConfigContextBuilder withFilters(Collection<Filter> filters){
-// checkBuilderState();
-// for(Filter f:filters) {
-// if (!this.filters.contains(f)) {
-// this.filters.add(f);
-// }
-// }
-// return this;
-// }
-//
-// public final StandaloneConfigContextBuilder removeFilters(Filter... filters) {
-// return removeFilters(Arrays.asList(filters));
-// }
-//
-// public final StandaloneConfigContextBuilder removeFilters(Collection<Filter> filters) {
-// checkBuilderState();
-// this.filters.removeAll(filters);
-// return this;
-// }
-//
-//
-// public final <T> StandaloneConfigContextBuilder removeConverters(Type typeToConvert,
-// @SuppressWarnings("unchecked") Converter<T>... converters) {
-// return removeConverters(typeToConvert, Arrays.asList(converters));
-// }
-//
-// public final <T> StandaloneConfigContextBuilder removeConverters(Type typeToConvert,
-// Collection<Converter<T>> converters) {
-// Collection<Converter> subConverters = this.propertyConverters.get(typeToConvert);
-// if(subConverters!=null) {
-// subConverters.removeAll(converters);
-// }
-// return this;
-// }
-//
-// public final StandaloneConfigContextBuilder removeConverters(TypeLiteral<?> typeToConvert) {
-// this.propertyConverters.remove(typeToConvert);
-// return this;
-// }
-//
-//
-// public final StandaloneConfigContextBuilder withPropertyValueCombinationPolicy(ConfigValueCombinationPolicy combinationPolicy){
-// checkBuilderState();
-// this.combinationPolicy = Objects.requireNonNull(combinationPolicy);
-// return this;
-// }
-//
-//
-// public <T> StandaloneConfigContextBuilder withConverters(Type type, Converter<T>... propertyConverters){
-// checkBuilderState();
-// Objects.requireNonNull(type);
-// Objects.requireNonNull(propertyConverters);
-// Collection<Converter> converters = this.propertyConverters.get(type);
-// if(converters==null){
-// converters = new ArrayList<>();
-// this.propertyConverters.put(type, converters);
-// }
-// for(Converter<T> propertyConverter:propertyConverters) {
-// if (!converters.contains(propertyConverter)) {
-// converters.add(propertyConverter);
-// } else {
-// LOG.warning("Converter ignored, already registered: " + propertyConverter);
-// }
-// }
-// return this;
-// }
-//
-// public <T> StandaloneConfigContextBuilder withConverters(Type type, Collection<Converter<T>> propertyConverters){
-// checkBuilderState();
-// Objects.requireNonNull(type);
-// Objects.requireNonNull(propertyConverters);
-// Collection<Converter> converters = this.propertyConverters.get(type);
-// if(converters==null){
-// converters = new ArrayList<>();
-// this.propertyConverters.put(type, converters);
-// }
-// for(Converter<T> propertyConverter:propertyConverters) {
-// if (!converters.contains(propertyConverter)) {
-// converters.add(propertyConverter);
-// } else {
-// LOG.warning("Converter ignored, already registered: " + propertyConverter);
-// }
-// }
-// return this;
-// }
-//
-// protected StandaloneConfigContextBuilder loadDefaults() {
-// checkBuilderState();
-// this.combinationPolicy = ConfigValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
-// addDiscoveredSources();
-// addDiscoveredPropertyFilters();
-// addDiscoveredConverters();
-// return this;
-// }
-//
-//
-// protected Map<Type, Collection<Converter>> getDefaultConverters() {
-// Map<Type, Collection<Converter>> result = new HashMap<>();
-// for (Converter conv : ServiceContextManager.getServiceContext().getServices(
-// Converter.class, classLoader)) {
-// for(Type type:conv.getClass().getGenericInterfaces()){
-// if(type instanceof ParameterizedType){
-// ParameterizedType pt = (ParameterizedType)type;
-// if(Converter.class.equals(((ParameterizedType) type).getRawType())){
-// Type target = pt.getActualTypeArguments()[0];
-// Collection<Converter> convList = result.get(target);
-// if (convList == null) {
-// convList = new ArrayList<>();
-// result.put(target, convList);
-// }
-// convList.add(conv);
-// }
-// }
-// }
-// }
-// return result;
-// }
-//
-//
-// /**
-// * Builds a new configuration based on the configuration of this builder instance.
-// *
-// * @return a new {@link javax.config.Config configuration instance},
-// * never {@code null}.
-// */
-// public ConfigContext build() {
-// checkBuilderState();
-// built = true;
-// return new StandaloneConfigContext(this);
-// }
-//
-// public StandaloneConfigContextBuilder sortFilter(Comparator<Filter> comparator) {
-// Collections.sort(filters, comparator);
-// return this;
-// }
-//
-// public StandaloneConfigContextBuilder sortSources(Comparator<ConfigSource> comparator) {
-// Collections.sort(propertySources, comparator);
-// return this;
-// }
-//
-// private void checkBuilderState() {
-// if (built) {
-// throw new IllegalStateException("Configuration has already been build.");
-// }
-// }
-//
-// public List<Filter> getFilters() {
-// return filters;
-// }
-//
-// public Map<Type, Collection<Converter>> getConverter() {
-// return Collections.unmodifiableMap(this.propertyConverters);
-// }
-//
-// public void setClassLoader(ClassLoader classLoader) {
-// this.classLoader = classLoader;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/TamayaConfigBuilder.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/TamayaConfigBuilder.java b/code/base/src/main/java/org/apache/tamaya/spi/TamayaConfigBuilder.java
deleted file mode 100644
index 43559ba..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/TamayaConfigBuilder.java
+++ /dev/null
@@ -1,332 +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 org.apache.tamaya.base.DefaultConfigBuilder;
-
-import javax.config.spi.ConfigBuilder;
-import javax.config.spi.ConfigSource;
-import javax.config.spi.Converter;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A builder for creating new or adapting instances of {@link javax.config.Config}.
- * Builders can be obtained in exactly two ways:
- * <ol>
- * <li>By accessing an empty builder instance from
- * {@link javax.config.spi.ConfigProviderResolver#getBuilder()}.</li>
- * </ol>
- */
-public interface TamayaConfigBuilder extends ConfigBuilder, ConfigContextSupplier{
-
- /**
- * Create a new empty configuration builder.
- * @return
- */
- static TamayaConfigBuilder create() {
- return new DefaultConfigBuilder();
- }
-
- static TamayaConfigBuilder create(ConfigContextSupplier contextSupplier){
- return new DefaultConfigBuilder(contextSupplier.getConfigContext());
- }
-
- static TamayaConfigBuilder from(ConfigBuilder configBuilder){
- if(configBuilder instanceof TamayaConfigBuilder) {
- return (TamayaConfigBuilder) configBuilder;
- }else if(configBuilder instanceof ConfigContextSupplier){
- return create((ConfigContextSupplier)configBuilder);
- }
- throw new IllegalArgumentException("Builder must implement ConfigContextSupplier.");
- }
-
- /**
- * This method can be used for programmatically adding {@link ConfigSource}s.
- * Hereby the property source is added to the tail of property sources with
- * lowest priority regardless of its current ordinal value. To sort the property
- * sources based on their ordinals call {@link #sortSources}.
- *
- * @param propertySources the PropertySources to add
- * @return this builder, for chaining, never null.
- * @throws IllegalArgumentException If a property source with a given name already
- * exists.
- */
- TamayaConfigBuilder withSources(Collection<ConfigSource> propertySources);
-
- /**
- * Removes the given property sources, if existing. The existing order of property
- * sources is preserved.
- *
- * @param propertySources the property sources to remove, not {@code null}.
- * @return the builder for chaining.
- */
- TamayaConfigBuilder removeSources(ConfigSource... propertySources);
-
- /**
- * Removes the given property sources, if existing. The existing order of property
- * sources is preserved.
- *
- * @param propertySources the property sources to remove, not {@code null}.
- * @return the builder for chaining.
- */
- TamayaConfigBuilder removeSources(Collection<ConfigSource> propertySources);
-
- /**
- * Increases the priority of the given property source, by moving it towards the end
- * of the chain of property sources. If the property source given is already at the end
- * this method has no effect. This operation does not change any ordinal values.
- *
- * @param propertySource the property source to be incresed regarding its significance.
- * @return the builder for chaining.
- * @throws IllegalArgumentException If no such property source exists in the current
- * chain.
- */
- TamayaConfigBuilder increasePriority(ConfigSource propertySource);
-
- /**
- * Decreases the priority of the given property source, by moving it towards the start
- * of the chain of property sources. If the property source given is already the first
- * this method has no effect. This operation does not change any ordinal values.
- *
- * @param propertySource the property source to be decresed regarding its significance.
- * @return the builder for chaining.
- * @throws IllegalArgumentException If no such property source exists in the current
- * chain.
- */
- TamayaConfigBuilder decreasePriority(ConfigSource propertySource);
-
- /**
- * Increases the priority of the given property source to be maximal, by moving it to
- * the tail of the of property source chain. If the property source given is
- * already the last item this method has no effect. This operation does not change
- * any ordinal values.
- *
- * @param propertySource the property source to be maximized regarding its significance.
- * @return the builder for chaining.
- * @throws IllegalArgumentException If no such property source exists in the current
- * chain.
- */
- TamayaConfigBuilder highestPriority(ConfigSource propertySource);
-
- /**
- * Decreases the priority of the given property source to be minimal, by moving it to
- * the start of the chain of property source chain. If the property source given is
- * already the first item this method has no effect. This operation does not change
- * any ordinal values.
- *
- * @param propertySource the property source to be minimized regarding its significance.
- * @return the builder for chaining.
- * @throws IllegalArgumentException If no such property source exists in the current
- * chain.
- */
- TamayaConfigBuilder lowestPriority(ConfigSource propertySource);
-
- /**
- * Access the current chain of property sources. Items at the end of the list have
- * precedence/more significance.
- *
- * @return the property source chain, never {@code null}.
- */
- List<ConfigSource> getSources();
-
- /**
- * Sorts the current registered property sources using the given comparator.
- *
- * NOTE: property sources at the beginning have minimal significance.
- *
- * @param comparator the comparator to be used, not {@code null}.
- * @return this instance for chaining.
- */
- TamayaConfigBuilder sortSources(Comparator<ConfigSource> comparator);
-
- /**
- * Adds the given PropertyFilter instances, hereby the instances are added
- * to the end of the list with highest priority. The ordering of existing
- * property filters remains unchanged. To sort the property
- * filters call {@link #sortFilter}.
- *
- * @param filters the filters to add
- * @return this builder, for chaining, never null.
- */
- TamayaConfigBuilder withFilters(Filter... filters);
-
- /**
- * Adds the given PropertyFilter instances, hereby the instances are added
- * to the end of the list with highest priority. The ordering of existing
- * property filters remains unchanged. To sort the property
- * filters call {@link #sortFilter}.
- *
- * @param filters the filters to add
- * @return this builder, for chaining, never null.
- */
- TamayaConfigBuilder withFilters(Collection<Filter> filters);
-
- /**
- * Add all registered (default) property filters to the context built.
- * @return this builder, for chaining, never null.
- */
- TamayaConfigBuilder addDiscoveredFilters();
-
- /**
- * Removes the given PropertyFilter instances, if existing. The order of the remaining
- * filters is preserved.
- *
- * @param filters the filter to remove
- * @return this builder, for chaining, never null.
- */
- TamayaConfigBuilder removeFilters(Filter... filters);
-
- /**
- * Removes the given PropertyFilter instances, if existing. The order of the remaining
- * filters is preserved.
- *
- * @param filters the filter to remove
- * @return this builder, for chaining, never null.
- */
- TamayaConfigBuilder removeFilters(Collection<Filter> filters);
-
- /**
- * Access the current chain of property filters. Items at the end of the list have
- * precedence/more significance.
- *
- * @return the property source chain, never {@code null}.
- */
- List<Filter> getFilters();
-
- /**
- * This method can be used for adding {@link Converter}s.
- * Converters are added at the end after any existing converters.
- * For converters already registered for the current target type the
- * method has no effect.
- *
- * @param converters the converters to add for this type
- * @return this builder, for chaining, never null.
- */
- TamayaConfigBuilder withConverters(Collection<Converter<?>> converters);
-
- /**
- * This method can be used for adding {@link Converter}s.
- * Converters are added at the end after any existing converters.
- * For converters already registered for the current target type the
- * method has no effect.
- *
- * @param typeToConvert the type for which the converters is for
- * @param converters the converters to add for this type
- * @param <T> the target type.
- * @return this builder, for chaining, never null.
- */
- <T> TamayaConfigBuilder withConverters(Class<T> typeToConvert, Converter<T>... converters);
-
- /**
- * This method can be used for adding {@link Converter}s.
- * Converters are added at the end after any existing converters.
- * For converters already registered for the current target type the
- * method has no effect.
- *
- * @param typeToConvert the type for which the converters is for
- * @param converters the converters to add for this type
- * @param <T> the target type.
- * @return this builder, for chaining, never null.
- */
- <T> TamayaConfigBuilder withConverters(Class<T> typeToConvert, Collection<Converter<T>> converters);
-
-
- /**
- * Removes the given PropertyConverter instances for the given type,
- * if existing.
- *
- * @param typeToConvert the type which the converters is for
- * @param converters the converters to remove
- * @param <T> the target type.
- * @return this builder, for chaining, never null.
- */
- <T> TamayaConfigBuilder removeConverters(Class<T> typeToConvert, Converter<T>... converters);
-
- /**
- * Removes the given PropertyConverter instances for the given type,
- * if existing.
- *
- * @param typeToConvert the type which the converters is for
- * @param converters the converters to remove
- * @param <T> the target type.
- * @return this builder, for chaining, never null.
- */
- <T> TamayaConfigBuilder removeConverters(Class<T> typeToConvert, Collection<Converter<T>> converters);
-
- /**
- * Removes all converters for the given type, which actually renders a given type
- * unsupported for type conversion.
- *
- * @param typeToConvert the type which the converters is for
- * @return this builder, for chaining, never null.
- */
- <T> TamayaConfigBuilder removeConverters(Class<T> typeToConvert);
-
- /**
- * Access the current registered property converters.
- *
- * @return the current registered property converters.
- */
- Map<Type, List<Converter>> getConverter();
-
- /**
- * Sets the {@link ConfigValueCombinationPolicy} used to evaluate the final
- * property values.
- *
- * @param policy the {@link ConfigValueCombinationPolicy} used, not {@code null}.
- * @return this builder, for chaining, never null.
- */
- TamayaConfigBuilder withPropertyValueCombinationPolicy(ConfigValueCombinationPolicy policy);
-
- /**
- * Sorts the current registered property filters using the given comparator.
- *
- * NOTE: property filters at the beginning have minimal significance.
- *
- * @param comparator the comparator to be used, not {@code null}.
- * @return this instance for chaining.
- */
- TamayaConfigBuilder sortFilter(Comparator<Filter> comparator);
-
- @Override
- TamayaConfigBuilder addDefaultSources();
-
- @Override
- TamayaConfigBuilder addDiscoveredSources();
-
- @Override
- TamayaConfigBuilder addDiscoveredConverters();
-
- @Override
- TamayaConfigBuilder forClassLoader(ClassLoader loader);
-
- @Override
- TamayaConfigBuilder withSources(ConfigSource... sources);
-
- @Override
- TamayaConfigBuilder withConverters(Converter<?>... converters);
-
- <T> TamayaConfigBuilder withConverter(Class<T> type, Converter<T> converter);
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/TypeLiteral.java b/code/base/src/main/java/org/apache/tamaya/spi/TypeLiteral.java
deleted file mode 100644
index 0139e85..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/TypeLiteral.java
+++ /dev/null
@@ -1,225 +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.io.Serializable;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Objects;
-
-
-/**
- * <p>Class for instantiation of objects that represent parameterized types
- * with current parameters.</p>
- *
- * <p>An object that represents a parameterized type may be obtained by
- * subclassing <tt>TypeLiteral</tt>.</p>
- *
- * <pre>
- * TypeLiteral<List<Integer>> stringListType = new TypeLiteral<List<Integer>>() {};
- * </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 final Type definedType;
-
- /**
- * Constructor.
- * @param definedType the defined type.
- */
- public TypeLiteral(Type definedType) {
- Objects.requireNonNull(definedType, "Type must be given");
-
- this.definedType = definedType;
- }
-
- /**
- * Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
- */
- public TypeLiteral() {
- this.definedType = getDefinedType(this.getClass());
- }
-
- /**
- * Creates a new TypeLiteral based on a given type.
- *
- * @param type the type , not {@code null}.
- * @param <R> the literal generic type.
- * @return the corresponding TypeLiteral, never {@code null}.
- */
- public static <R> TypeLiteral<R> of(Type type) {
- Objects.requireNonNull(type, "Type must be given.");
-
- return new TypeLiteral<R>(type);
- }
-
- /**
- * Checks the current implemented generic interfaces and evaluates the given single type parameter.
- *
- * @param clazz the class to check, not {@code null}.
- * @param interfaceType the interface type to be checked, not {@code null}.
- * @return the generic type parameters, or an empty array, if it cannot be evaluated.
- */
- public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
- Objects.requireNonNull(clazz, "Class parameter must be given.");
- Objects.requireNonNull(interfaceType, "Interface parameter must be given.");
-
- 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 {@code null}.
- * @return the generic type parameter of the given single type generic interfaceType, or an empty array.
- */
- public static Type[] getTypeParameters(Type type) {
- Objects.requireNonNull(type, "Type must be given.");
-
- 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
- */
- @SuppressWarnings("unchecked")
- public final Class<T> getRawType() {
- Class<T> rawType;
-
- 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 if (this.definedType instanceof Class) {
- rawType = (Class<T>) this.definedType;
- } else {
- throw new RuntimeException("Illegal type for the Type Literal Class");
- }
-
- return rawType;
- }
-
- /**
- * Returns actual type arguments, if present.
- *
- * @return the actual type represented by defined class, or an empty array.
- */
- public final Type[] getActualTypeArguments() {
- if (this.definedType instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) this.definedType;
- return pt.getActualTypeArguments();
- }
- return new Type[0];
- }
-
-
- protected Type getDefinedType(Class<?> clazz) {
- Type type;
-
- if (clazz == null) {
- throw new RuntimeException("Class parameter clazz can not be null");
- }
-
- Type superClazz = clazz.getGenericSuperclass();
-
- 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 if (superClazz.equals(Object.class)) {
- throw new RuntimeException("Super class must be parametrized 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/09472084/code/base/src/main/java/org/apache/tamaya/spi/package-info.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/package-info.java b/code/base/src/main/java/org/apache/tamaya/spi/package-info.java
deleted file mode 100644
index cc6feee..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-
-/**
- * Tamaya extended configuration SPI.
- */
-package org.apache.tamaya.spi;
\ No newline at end of file
[3/3] incubator-tamaya git commit: - Adapted OSGI deps. - Defined
clear resolvability of packages,
removing redundancies. - Refactored parts of TypeLiteral into util class.
Posted by an...@apache.org.
- Adapted OSGI deps.
- Defined clear resolvability of packages, removing redundancies.
- Refactored parts of TypeLiteral into util class.
Signed-off-by: Anatole Tresch <an...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/09472084
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/09472084
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/09472084
Branch: refs/heads/configjsr
Commit: 0947208464bc5ba32c62525a541a61c497fe9a9e
Parents: 0be1acb
Author: Anatole Tresch <an...@apache.org>
Authored: Mon Feb 5 01:10:12 2018 +0100
Committer: Anatole Tresch <an...@apache.org>
Committed: Mon Feb 5 01:10:12 2018 +0100
----------------------------------------------------------------------
code/base/bnd.bnd | 3 +-
.../org/apache/tamaya/base/ConfigContext.java | 156 +++++++
.../tamaya/base/ConfigContextSupplier.java | 42 ++
.../org/apache/tamaya/base/ConfigValue.java | 209 ++++++++++
.../apache/tamaya/base/ConfigValueBuilder.java | 179 ++++++++
.../base/ConfigValueCombinationPolicy.java | 71 ++++
.../org/apache/tamaya/base/DefaultConfig.java | 4 +-
.../tamaya/base/DefaultConfigBuilder.java | 4 +-
.../tamaya/base/DefaultServiceContext.java | 2 -
.../org/apache/tamaya/base/Experimental.java | 32 ++
.../org/apache/tamaya/base/ServiceContext.java | 147 +++++++
.../tamaya/base/ServiceContextManager.java | 118 ++++++
.../apache/tamaya/base/TamayaConfigBuilder.java | 333 +++++++++++++++
.../java/org/apache/tamaya/base/TypeUtils.java | 136 +++++++
.../base/configsource/ConfigSourceManager.java | 5 +-
.../JavaConfigurationConfigSource.java | 2 +-
.../PropertiesResourceConfigSource.java | 2 +-
.../tamaya/base/convert/ConversionContext.java | 2 -
.../tamaya/base/convert/ConverterManager.java | 7 +-
.../org/apache/tamaya/base/filter/Filter.java | 51 +++
.../tamaya/base/filter/FilterComparator.java | 2 -
.../tamaya/base/filter/FilterContext.java | 2 -
.../tamaya/base/filter/FilterManager.java | 6 +-
.../tamaya/base/filter/RegexPropertyFilter.java | 3 -
.../org/apache/tamaya/spi/ConfigContext.java | 154 -------
.../tamaya/spi/ConfigContextSupplier.java | 47 ---
.../java/org/apache/tamaya/spi/ConfigValue.java | 209 ----------
.../apache/tamaya/spi/ConfigValueBuilder.java | 179 --------
.../spi/ConfigValueCombinationPolicy.java | 71 ----
.../org/apache/tamaya/spi/Experimental.java | 32 --
.../main/java/org/apache/tamaya/spi/Filter.java | 51 ---
.../org/apache/tamaya/spi/ServiceContext.java | 147 -------
.../tamaya/spi/ServiceContextManager.java | 118 ------
.../tamaya/spi/StandaloneConfigContext.java | 292 -------------
.../spi/StandaloneConfigContextBuilder.java | 407 -------------------
.../apache/tamaya/spi/TamayaConfigBuilder.java | 332 ---------------
.../java/org/apache/tamaya/spi/TypeLiteral.java | 225 ----------
.../org/apache/tamaya/spi/package-info.java | 23 --
.../tamaya/base/DefaultConfigBuilderTest.java | 10 +-
.../apache/tamaya/base/DefaultConfigTest.java | 1 -
.../tamaya/base/TestConfigurationProvider.java | 5 +-
.../base/configsource/EnumConverterTest.java | 1 -
.../tamaya/base/convert/EnumConverterTest.java | 3 -
.../base/services/DefaultServiceContext.java | 2 +-
.../tamaya/filter/FilterComparatorTest.java | 3 +-
.../org.apache.tamaya.base.ServiceContext | 19 +
.../org.apache.tamaya.spi.ServiceContext | 19 -
code/compat/bnd.bnd | 3 +-
.../java/org/apache/tamaya/Configuration.java | 10 +-
.../apache/tamaya/ConfigurationProvider.java | 1 +
.../apache/tamaya/spi/ConfigurationBuilder.java | 1 +
.../apache/tamaya/spi/ConfigurationContext.java | 2 +
.../tamaya/spi/ConfigurationContextBuilder.java | 2 +
.../org/apache/tamaya/spi/FilterContext.java | 1 +
.../org/apache/tamaya/spi/PropertyFilter.java | 3 +-
.../java/org/apache/tamaya/spi/TypeLiteral.java | 225 ++++++++++
.../tamaya/spisupport/DefaultConfiguration.java | 2 +-
.../spisupport/DefaultConfigurationBuilder.java | 1 +
.../spisupport/DefaultConfigurationContext.java | 1 +
.../DefaultConfigurationContextBuilder.java | 1 +
.../spisupport/PropertyConverterManager.java | 2 +-
.../JavaConfigurationPropertySource.java | 2 +-
.../PropertiesResourcePropertySource.java | 2 +-
.../org/apache/tamaya/TestConfiguration.java | 2 +-
.../java/org/apache/tamaya/TypeLiteralTest.java | 14 +-
.../tamaya/spi/ConversionContextTest.java | 1 +
.../apache/tamaya/spi/FilterContextTest.java | 2 +-
.../tamaya/spi/ServiceContextManagerTest.java | 2 +
.../apache/tamaya/spi/ServiceContextTest.java | 2 +
.../apache/tamaya/spi/TestServiceContext.java | 4 +-
.../org.apache.tamaya.base.ServiceContext | 19 +
.../org.apache.tamaya.spi.ServiceContext | 19 -
code/core/bnd.bnd | 3 +-
.../org/apache/tamaya/core/OSGIActivator.java | 4 +-
.../apache/tamaya/core/OSGIServiceContext.java | 2 +-
.../core/TamayaConfigProviderResolver.java | 5 +-
.../tamaya/core/converters/ConvertQuery.java | 4 +-
.../org.apache.tamaya.base.ServiceContext | 19 +
.../org.apache.tamaya.spi.ConfigValueEvaluator | 19 -
.../org.apache.tamaya.spi.ServiceContext | 19 -
...pache.tamaya.spisupport.ConfigValueEvaluator | 19 +
.../core/TamayaConfigProviderResolverTest.java | 4 +-
.../apache/tamaya/core/testdata/TestFilter.java | 3 +-
.../core/testdata/TestRemovingFilter.java | 3 +-
.../org.apache.tamaya.base.filter.Filter | 20 +
.../services/org.apache.tamaya.spi.Filter | 20 -
86 files changed, 1867 insertions(+), 2469 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/bnd.bnd
----------------------------------------------------------------------
diff --git a/code/base/bnd.bnd b/code/base/bnd.bnd
index cc6472d..41ce9eb 100644
--- a/code/base/bnd.bnd
+++ b/code/base/bnd.bnd
@@ -23,8 +23,7 @@ Export-Package: \
org.apache.tamaya.base,\
org.apache.tamaya.base.configsource,\
org.apache.tamaya.base.convert,\
- org.apache.tamaya.base.filter,\
- org.apache.tamaya.spi
+ org.apache.tamaya.base.filter
Import-Package: \
javax.config,\
javax.config.spi,\
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/ConfigContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/ConfigContext.java b/code/base/src/main/java/org/apache/tamaya/base/ConfigContext.java
new file mode 100644
index 0000000..eb6a16d
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/ConfigContext.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.base;
+
+import org.apache.tamaya.base.filter.Filter;
+
+import javax.config.spi.ConfigSource;
+import javax.config.spi.Converter;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Central SPI for programmatically dealing with the setup of the configuration system.
+ * This includes adding and enlisting {@link javax.config.spi.ConfigSource}s,
+ * managing {@link javax.config.spi.Converter}s, ConfigFilters, etc.
+ */
+public interface ConfigContext {
+
+ /**
+ * 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<ConfigSource> getSources();
+
+// /**
+// * Access a {@link ConfigSource} using its (unique) name.
+// * @param name the propoerty source's name, not {@code null}.
+// * @return the propoerty source found, or {@code null}.
+// */
+// default ConfigSource getSource(String name) {
+// for(ConfigSource ps: getSources()){
+// if(name.equals(ps.getName())){
+// return ps;
+// }
+// }
+// return null;
+// }
+
+ /**
+ * Access the current PropertyFilter instances.
+ * @return the list of registered PropertyFilters, never null.
+ */
+ List<Filter> getFilters();
+
+ /**
+ * <p>
+ * This method returns the Map of registered PropertyConverters
+ * per type.
+ * The List for each type is ordered via their {@link javax.annotation.Priority} and
+ * cladd name.
+ * </p>
+ *
+ * <p>A simplified scenario could be like:</p>
+ * <pre>
+ * {
+ * Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
+ * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
+ * Integer.class -> {DynamicDefaultConverter}
+ * }
+ * </pre>
+ *
+ * @return map with sorted list of registered PropertySources per type.
+ */
+ Map<Type, List<Converter>> getConverters();
+
+ /**
+ * <p>
+ * This method returns the registered PropertyConverters for a given type.
+ * The List for each type is ordered via their {@link javax.annotation.Priority}.
+ * </p>
+ *
+ * <p>
+ * PropertyConverters with a higher Priority come first. The PropertyConverter with the
+ * lowest Priority comes last.
+ * If two PropertyConverter have the same ordinal number they will get sorted
+ * using their class name just to ensure the user at least gets the same ordering
+ * after a JVM restart.
+ * </p>
+ *
+ * <p>
+ * Additionally if a PropertyProvider is accessed, which is not registered the implementation
+ * should try to figure out, if there could be a default implementation as follows:</p>
+ * <ol>
+ * <li>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
+ * instanceOf(String), fomr(String)}</li>
+ * <li>Look for a matching constructor: {@code T(String)}.</li>
+ * </ol>
+ *
+ * <p>
+ * If a correspoding factory method or constructor could be found, a corresponding
+ * PropertyConverter should be created and registered automatically for the given
+ * type.
+ * </p>
+ *
+ * <p> The scenario could be like:</p>
+ *
+ * <pre>
+ * {
+ * Date.class -> {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
+ * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
+ * Integer.class -> {DynamicDefaultConverter}
+ * }
+ * </pre>
+ *
+ * <p>
+ * The converters returned for a type should be used as a chain, whereas the result of the
+ * first converters that is able to convert the configured value, is taken as the chain's result.
+ * No more converters are called after a converters has successfully converted the input into
+ * the required target type.
+ * </p>
+ *
+ * @param type type of the desired converters
+ * @return a sorted list of registered PropertySources per type, or null.
+ */
+ default List<Converter> getConverters(Type type){
+ return Optional.ofNullable(getConverters().get(type)).orElse(Collections.emptyList());
+ }
+
+ /**
+ * Access the {@link ConfigValueCombinationPolicy} used to evaluate the final
+ * property values.
+ * @return the {@link ConfigValueCombinationPolicy} used, never null.
+ */
+ default ConfigValueCombinationPolicy getConfigValueCombinationPolicy(){
+ return ConfigValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/ConfigContextSupplier.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/ConfigContextSupplier.java b/code/base/src/main/java/org/apache/tamaya/base/ConfigContextSupplier.java
new file mode 100644
index 0000000..9e3be69
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/ConfigContextSupplier.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.base;
+
+import javax.config.spi.ConfigSource;
+import javax.config.spi.Converter;
+
+/**
+ * Central SPI for programmatically dealing with the setup of the configuration system.
+ * This includes adding and enlisting {@link ConfigSource}s,
+ * managing {@link Converter}s, ConfigFilters, etc.
+ */
+@FunctionalInterface
+public interface ConfigContextSupplier {
+
+ /**
+ * Make an instance of a configuration accessible for use with Apache Tamaya specific extensions.
+ * In most cases it should be sufficient to implement this interfance on your implementation of
+ * {@link javax.config.Config}.
+ *
+ * @return the corresponding configuration context, never null.
+ */
+ ConfigContext getConfigContext();
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/ConfigValue.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/ConfigValue.java b/code/base/src/main/java/org/apache/tamaya/base/ConfigValue.java
new file mode 100644
index 0000000..697f79a
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/ConfigValue.java
@@ -0,0 +1,209 @@
+/*
+ * 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.base;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Class modelling the result of a request for a property value. A property value is basically identified by its key.
+ * There might be reasons, where one want to further analyze, which PropertySources provided a value and which not, so
+ * it is possible to create a PropertyValue with a null value. Nevertheless in all cases the provider source (typically
+ * the name of the PropertySource) must be set.
+ */
+public final class ConfigValue implements Serializable{
+ private static final long serialVersionUID = 1L;
+ /** The requested key. */
+ private String key;
+ /** The value. */
+ private String value;
+ /** Additional metadata provided by the provider. */
+ private String metaEntry;
+
+ ConfigValue(ConfigValueBuilder builder){
+ this.key = Objects.requireNonNull(builder.key);
+ this.value = Objects.requireNonNull(builder.value);
+ this.metaEntry = builder.metaEntry;
+ }
+
+ /**
+ * Creates a new instance
+ * @param key the key, not {@code null}.
+ * @param value the value, not {@code null}.
+ * @param metaEntry the source, typically the name of the {@link javax.config.spi.ConfigSource} providing
+ * the value, not {@code null}.
+ */
+ private ConfigValue(String key, String value, String metaEntry){
+ this.key = Objects.requireNonNull(key, "Key is required.");
+ this.value = Objects.requireNonNull(value, "Value is required.");
+ this.metaEntry = metaEntry;
+ }
+
+ /**
+ * The requested key.
+ * @return the, key never {@code null}.
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * The value.
+ * @return the value, in case a value is null it is valid to return {#code null} as result for
+ * {@link javax.config.spi.ConfigSource#getValue(String)}}.
+ */
+ public String getValue() {
+ return this.value;
+ }
+
+ /**
+ * Creates a full configuration map for this key, value pair and all its meta context data. This map
+ * is also used for subsequent processing, like value filtering.
+ * @return the property value entry map.
+ */
+ public String getMetaEntry() {
+ return metaEntry;
+ }
+
+ /**
+ * Creates a new builder instance.
+ * @param key the key, not {@code null}.
+ * @return a new builder instance.
+ */
+ public static ConfigValueBuilder builder(String key){
+ Objects.requireNonNull(key, "Key must be given.");
+ return new ConfigValueBuilder(key);
+ }
+
+ /**
+ * Creates a new builder instance.
+ * @param key the key, not {@code null}.
+ * @param value the property value, not {@code null}.
+ * @return a new builder instance.
+ */
+ public static ConfigValueBuilder builder(String key, String value) {
+ Objects.requireNonNull(key, "Key must be given.");
+ Objects.requireNonNull(value, "Value must be given");
+ return new ConfigValueBuilder(key, value);
+ }
+
+
+ /**
+ * Creates a new PropertyValue without any metadata..
+ * @param key the key, not {@code null}.
+ * @param value the value.
+ * @param metaEntry the metaEntry, typically the name of the {@link javax.config.spi.ConfigSource}
+ * providing the value, not {@code null}.
+ * @return a new property value instance, or {@code null},
+ * if the value passed is {@code null}..
+ */
+ public static ConfigValue of(String key, String value, String metaEntry) {
+ if (value==null) {
+ return null;
+ }
+ return new ConfigValue(key, value, metaEntry);
+ }
+
+ /**
+ * Creates a new builder instance based on this item.
+ * @return a new builder, never null.
+ */
+ public ConfigValueBuilder toBuilder() {
+ return new ConfigValueBuilder(this.getKey())
+ .setValue(this.getValue())
+ .setMetaEntry(this.metaEntry);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ConfigValue)) return false;
+ ConfigValue that = (ConfigValue) o;
+ return Objects.equals(getKey(), that.getKey()) &&
+ Objects.equals(getValue(), that.getValue()) &&
+ Objects.equals(getMetaEntry(), that.getMetaEntry());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getKey(), getValue(),
+ getMetaEntry());
+ }
+
+ @Override
+ public String toString() {
+ return "PropertyValue{" +
+ "key='" + key + '\'' +
+ ", value='" + value + '\'' +
+ ", metaEntry='" + metaEntry + '\'' +
+ '}';
+ }
+
+ /**
+ * Maps a map of {@code Map<String,String>} to a {@code Map<String,PropertyValue>}.
+ * @param config the String based map, not {@code null}.
+ * @return the corresponding value based map.
+ */
+ public static Map<String,ConfigValue> map(Map<String, String> config) {
+ Map<String,ConfigValue> result = new HashMap<>(config.size());
+ for(Map.Entry<String,String> en:config.entrySet()){
+ result.put(en.getKey(), ConfigValue.of(en.getKey(), en.getValue(), config.get(en.getKey()+"[meta]")));
+ }
+ return result;
+ }
+
+ /**
+ * Maps a map of {@code Map<String,String>} to a {@code Map<String,PropertyValue>}.
+ *
+ * @param config the String based map, not {@code null}.
+ * @param source the source name, not {@code null}.
+ * @param metaData additional metadata, not {@code null}.
+ * @return the corresponding value based map.
+ */
+ public static Map<String,ConfigValue> map(Map<String, String> config, String source,
+ Map<String,String> metaData) {
+ Objects.requireNonNull(config, "Config must be given.");
+ Objects.requireNonNull(source, "Source must be given.");
+ Objects.requireNonNull(metaData, "Meta data must be given.");
+
+ Map<String,ConfigValue> result = new HashMap<>(config.size());
+
+ for(Map.Entry<String,String> en:config.entrySet()){
+ ConfigValue value = new ConfigValueBuilder(en.getKey(), source).setValue(en.getValue())
+ .addMetaEntries(metaData).build();
+ result.put(en.getKey(), value);
+ }
+ return result;
+ }
+
+ public Map<? extends String, ? extends String> asMap() {
+ Map<String,String> map = new HashMap<>();
+ map.put(key, value);
+ map.put(key+"[meta]", this.metaEntry);
+ return map;
+ }
+
+ public static ConfigValue of(String key, Map<String, String> rawProperties) {
+ String value = rawProperties.get(key);
+ String meta = rawProperties.get(key+"[meta]");
+ return new ConfigValue(key, value, meta);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/ConfigValueBuilder.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/ConfigValueBuilder.java b/code/base/src/main/java/org/apache/tamaya/base/ConfigValueBuilder.java
new file mode 100644
index 0000000..259a5be
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/ConfigValueBuilder.java
@@ -0,0 +1,179 @@
+/*
+ * 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.base;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.*;
+
+/**
+ * Builder to create a {@link ConfigValue} instance.
+ */
+public class ConfigValueBuilder {
+ /** The key accessed. */
+ String key;
+ /** The property value. */
+ String value;
+ /** additional metadata entries (optional). */
+ String metaEntry;
+
+ /**
+ * Create a new builder instance, for a given set of parameters.
+ * Before calling build at least a {@link #value} and its {@link #metaEntry}
+ * must be set.
+ */
+ ConfigValueBuilder(String key){
+ this.key = Objects.requireNonNull(key);
+ }
+
+ /**
+ * Create a new builder instance, for a given set of parameters.
+ * @param key to access a property value, not {@code null}.
+ * @param value property value.
+ */
+ ConfigValueBuilder(String key, String value) {
+ this.key = Objects.requireNonNull(key);
+ this.value = Objects.requireNonNull(value);
+ }
+
+ /**
+ * Create a new builder instance, for a given set of parameters.
+ *
+ * @param key to access a property value.
+ * @param value the value, not {@code null}. If a value is {@code null}
+ * {@link javax.config.spi.ConfigSource#getValue(String)} should return {@code null}.
+ * @param metaEntry property metaEntry.
+ */
+ ConfigValueBuilder(String key, String value, String metaEntry) {
+ this.key = Objects.requireNonNull(key);
+ this.value = value;
+ this.metaEntry = Objects.requireNonNull(metaEntry);
+ }
+
+ /**
+ * Replaces/sets the context data.
+ * @param metaEntry the context data to be applied.
+ * @return the builder for chaining.
+ */
+ public ConfigValueBuilder setMetaEntry(String metaEntry) {
+ this.metaEntry = metaEntry;
+ return this;
+ }
+
+ /**
+ * Add an additional context data information.
+ * @param key the context data key, not {@code null}.
+ * @param value the context value, not {@code null} (will be converted to String).
+ * @return the builder for chaining.
+ */
+ public ConfigValueBuilder addMetaEntry(String key, String value) {
+ Objects.requireNonNull(key, "Meta key must be given.");
+ Objects.requireNonNull(value, "Meta value must be given.");
+ if(metaEntry==null){
+ metaEntry = key+"="+value;
+ }else{
+ metaEntry = "\n" + key+"="+value;
+ }
+ return this;
+ }
+
+ /**
+ * Adds the context data given.
+ * @param metaEntries the context data to be applied, not {@code null}.
+ * @return the builder for chaining.
+ */
+ public ConfigValueBuilder addMetaEntries(Map<String, String> metaEntries) {
+ Properties props = new Properties();
+ props.putAll(metaEntries);
+ StringWriter stringWriter = new StringWriter();
+ try {
+ props.store(stringWriter, null);
+ stringWriter.flush();
+ if(metaEntry==null){
+ metaEntry = stringWriter.toString();
+ }else{
+ metaEntry += '\n' + stringWriter.toString();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return this;
+ }
+
+ /**
+ * Adds the context data given as JSON object.
+ * @param meta the context data in JSON format, not {@code null}.
+ * @return the builder for chaining.
+ */
+ public ConfigValueBuilder addMetaEntry(String meta) {
+ if(metaEntry==null){
+ metaEntry = meta;
+ }else{
+ metaEntry += '\n' + meta;
+ }
+ return this;
+ }
+
+ /**
+ * Get the value's context data.
+ * @return the context data, not {@code null}.
+ */
+ public String getMetaEntry() {
+ return metaEntry;
+ }
+
+ /**
+ * Sets a new key.
+ * @param key the new key, not {@code null}.
+ * @return the builder for chaining.
+ */
+ public ConfigValueBuilder setKey(String key) {
+ this.key = Objects.requireNonNull(key);
+ return this;
+ }
+
+ /**
+ * Sets a new value.
+ * @param value the new value, not {@code null}.
+ * @return the builder for chaining.
+ */
+ public ConfigValueBuilder setValue(String value) {
+ this.value = Objects.requireNonNull(value, "Value must be given.");
+
+ return this;
+ }
+
+ /**
+ * Creates a new immutable {@link ConfigValue}.
+ * @return a new immutable {@link ConfigValue}, never {@code null}.
+ */
+ public ConfigValue build(){
+ return new ConfigValue(this);
+ }
+
+ @Override
+ public String toString() {
+ return "PropertyValueBuilder{" +
+ "key='" + key + '\'' +
+ "value='" + value + '\'' +
+ ", metaEntry=" + metaEntry +
+ '}';
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/ConfigValueCombinationPolicy.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/ConfigValueCombinationPolicy.java b/code/base/src/main/java/org/apache/tamaya/base/ConfigValueCombinationPolicy.java
new file mode 100644
index 0000000..8005da7
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/ConfigValueCombinationPolicy.java
@@ -0,0 +1,71 @@
+/*
+ * 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.base;
+
+
+import javax.config.Config;
+import javax.config.spi.ConfigSource;
+
+/**
+ * Policy that determines how the final value of a configuration entry is evaluated. An instances of this
+ * interface can be registered to get control how multiple PropertySources are combined. This is useful in cases
+ * where the default overriding policy as implemented in {@link #DEFAULT_OVERRIDING_POLICY} is not matching
+ * the need of the current application, e.g. then entries containing multiple values should be combined to new
+ * values instead of overridden.
+ */
+public interface ConfigValueCombinationPolicy {
+
+ /**
+ * Default overriding collector, where each existing entry ({@code current} is overridden by a subsequent non-null
+ * entry evaluated by {@code propertySource.get(key)}.
+ */
+ ConfigValueCombinationPolicy DEFAULT_OVERRIDING_POLICY = (currentValue, key, propertySource) -> {
+ String value = propertySource.getValue(key);
+ String meta = propertySource.getValue(key+"[meta]");
+ return value!=null? value:currentValue;
+ };
+
+ /**
+ * @deprecated Use {@linkplain #DEFAULT_OVERRIDING_POLICY} instead. Will be removed in 1.0.
+ */
+ @Deprecated
+ ConfigValueCombinationPolicy DEFAULT_OVERRIDING_COLLECTOR = DEFAULT_OVERRIDING_POLICY;
+
+
+ /**
+ * Method that is called for each value evaluated by a PropertySource for the given key. This method is called
+ * either when a single key is accessed, e.g. by calling {@code org.apache.tamaya.Configuration.getXXX}, but also
+ * when the full configuration property map is accessed by calling
+ * {@link Config#getPropertyNames()}}.
+ *
+ * @param currentValue the current value, including metadata entries. If no such key is present the current value
+ * is null.
+ * The collector should either combine the existing value with value from {@code currentValue}
+ * or replace the value in {@code currentValue} with {@code valueRead}, hereby returning the
+ * result to be used as new {@code currentValue}.
+ * @param key The current key to be evaluated.
+ * @param propertySource The PropertySource that may return an value for the given key. The PropertySource given
+ * may be evaluated for additional meta-data, how the given values are to be combined.
+ * Note that the value returned by a PropertySource can be null. In that case
+ * {@code currentValue} should be returned in almost all cases.
+ * @return the value to be used for future evaluation, including metadata entries.
+ */
+ String collect(String currentValue, String key, ConfigSource propertySource);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/DefaultConfig.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/DefaultConfig.java b/code/base/src/main/java/org/apache/tamaya/base/DefaultConfig.java
index 665a605..2549474 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/DefaultConfig.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/DefaultConfig.java
@@ -21,10 +21,8 @@ package org.apache.tamaya.base;
import org.apache.tamaya.base.configsource.ConfigSourceManager;
import org.apache.tamaya.base.convert.ConverterManager;
-import org.apache.tamaya.spi.ConfigValue;
-import org.apache.tamaya.spi.Filter;
+import org.apache.tamaya.base.filter.Filter;
import org.apache.tamaya.base.filter.FilterManager;
-import org.apache.tamaya.spi.*;
import javax.config.Config;
import javax.config.spi.ConfigSource;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/DefaultConfigBuilder.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/DefaultConfigBuilder.java b/code/base/src/main/java/org/apache/tamaya/base/DefaultConfigBuilder.java
index 5a71ba4..6422c88 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/DefaultConfigBuilder.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/DefaultConfigBuilder.java
@@ -20,10 +20,8 @@ package org.apache.tamaya.base;
import org.apache.tamaya.base.configsource.*;
import org.apache.tamaya.base.convert.ConverterManager;
+import org.apache.tamaya.base.filter.Filter;
import org.apache.tamaya.base.filter.FilterManager;
-import org.apache.tamaya.spi.TamayaConfigBuilder;
-import org.apache.tamaya.spi.*;
-import org.apache.tamaya.spi.Filter;
import javax.config.Config;
import javax.config.spi.ConfigSource;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/DefaultServiceContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/DefaultServiceContext.java b/code/base/src/main/java/org/apache/tamaya/base/DefaultServiceContext.java
index 752fd3c..1411257 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/DefaultServiceContext.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/DefaultServiceContext.java
@@ -18,8 +18,6 @@
*/
package org.apache.tamaya.base;
-import org.apache.tamaya.spi.ServiceContext;
-
import javax.annotation.Priority;
import java.io.IOException;
import java.net.URL;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/Experimental.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/Experimental.java b/code/base/src/main/java/org/apache/tamaya/base/Experimental.java
new file mode 100644
index 0000000..1e28ccb
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/Experimental.java
@@ -0,0 +1,32 @@
+/*
+ * 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.base;
+
+import java.lang.annotation.*;
+
+/**
+ * This is a simple annotation for flaging out functionality or features the Tamaya team is not sure if it is already
+ * stabilized, so use it with some caution.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD,
+ ElementType.TYPE})
+public @interface Experimental {
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/ServiceContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/ServiceContext.java b/code/base/src/main/java/org/apache/tamaya/base/ServiceContext.java
new file mode 100644
index 0000000..c439a94
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/ServiceContext.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.base;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+
+
+/**
+ * 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();
+
+ static ClassLoader defaultClassLoader(){
+ ClassLoader classloader = Thread.currentThread().getContextClassLoader();
+ if(classloader==null){
+ classloader = ServiceContextManager.class.getClassLoader();
+ }
+ return classloader;
+ }
+
+ /**
+ * Access a service singleton via its type.
+ * If multiple implementations for the very serviceType exist then
+ * the one with the highest {@link javax.annotation.Priority} will be used.
+ *
+ * @param <T> the type of the service type.
+ * @param serviceType the service type.
+ * @return The instance to be used, or {@code null}
+ * @throws IllegalArgumentException if there are multiple service implementations with the maximum priority.
+ */
+ default <T> T getService(Class<T> serviceType){
+ return getService(serviceType, defaultClassLoader());
+ }
+
+ /**
+ * Access a service singleton via its type.
+ * If multiple implementations for the very serviceType exist then
+ * the one with the highest {@link javax.annotation.Priority} will be used.
+ *
+ * @param <T> the type of the service type.
+ * @param serviceType the service type.
+ * @param classLoader the class loader to be considered.
+ * @return The instance to be used, or {@code null}
+ * @throws IllegalArgumentException if there are multiple service implementations with the maximum priority.
+ */
+ <T> T getService(Class<T> serviceType, ClassLoader classLoader);
+
+ /**
+ * Factory method to create a type, hereby a new instance is created on each access.
+ * If multiple implementations for the very serviceType exist then
+ * the one with the highest {@link javax.annotation.Priority} will be used as the base
+ * for creating subsequent instances.
+ *
+ * @param <T> the type of the service type.
+ * @param serviceType the service type.
+ * @return The new instance to be used, or {@code null}
+ * @throws IllegalArgumentException if there are multiple service implementations with the maximum priority.
+ */
+ default <T> T create(Class<T> serviceType){
+ return create(serviceType, defaultClassLoader());
+ }
+
+ /**
+ * Factory method to create a type, hereby a new instance is created on each access.
+ * If multiple implementations for the very serviceType exist then
+ * the one with the highest {@link javax.annotation.Priority} will be used as the base
+ * for creating subsequent instances.
+ *
+ * @param <T> the type of the service type.
+ * @param serviceType the service type.
+ * @param classLoader the class loader to be considered.
+ * @return The new instance to be used, or {@code null}
+ * @throws IllegalArgumentException if there are multiple service implementations with the maximum priority.
+ */
+ <T> T create(Class<T> serviceType, ClassLoader classLoader);
+
+
+ /**
+ * 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 <T> the type of the list element returned by this method
+ * @return The instance to be used, never {@code null}
+ */
+ default <T> List<T> getServices(Class<T> serviceType){
+ return getServices(serviceType, defaultClassLoader());
+ }
+
+ /**
+ * 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 <T> the type of the list element returned by this method
+ * @return The instance to be used, never {@code null}
+ */
+ <T> List<T> getServices(Class<T> serviceType, ClassLoader classLoader);
+
+ /**
+ * Loads resources from the current runtime context. This method allows to use runtime
+ * specific code to load resources, e.g. within OSGI environments.
+ * @param resource the resource, not {@code null}.
+ * @param cl the desired classloader context, if null, the current thread context classloader is used.
+ * @return the resources found
+ * @throws IOException if load fails.
+ */
+ Enumeration<URL> getResources(String resource, ClassLoader cl) throws IOException;
+
+ /**
+ * Loads a resource from the current runtime context. This method allows to use runtime
+ * specific code to load a resource, e.g. within OSGI environments.
+ * @param resource the resource, not {@code null}.
+ * @param cl the desired classloader context, if null, the current thread context classloader is used.
+ * @return the resource found, or {@code null}.
+ */
+ URL getResource(String resource, ClassLoader cl);
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/ServiceContextManager.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/ServiceContextManager.java b/code/base/src/main/java/org/apache/tamaya/base/ServiceContextManager.java
new file mode 100644
index 0000000..50e0c3d
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/ServiceContextManager.java
@@ -0,0 +1,118 @@
+/*
+ * 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.base;
+
+import java.util.Objects;
+import java.util.ServiceLoader;
+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.
+ */
+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 (highestServiceContext == null) {
+ highestServiceContext = serviceContext;
+ } else if (serviceContext.ordinal() > highestOrdinal) {
+ highestServiceContext = serviceContext;
+ highestOrdinal = serviceContext.ordinal();
+ }
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException("ServiceContext not loadable", e);
+ }
+ if (highestServiceContext == null) {
+ throw new IllegalStateException("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 {@code null}.
+ * @return the currently used context after setting it.
+ */
+ public static ServiceContext set(ServiceContext serviceContextProvider) {
+ Objects.requireNonNull(serviceContextProvider);
+ ServiceContext currentContext = ServiceContextManager.serviceContextProviderDelegate;
+
+ 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;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/TamayaConfigBuilder.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/TamayaConfigBuilder.java b/code/base/src/main/java/org/apache/tamaya/base/TamayaConfigBuilder.java
new file mode 100644
index 0000000..40ebe94
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/TamayaConfigBuilder.java
@@ -0,0 +1,333 @@
+/*
+ * 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.base;
+
+import org.apache.tamaya.base.filter.Filter;
+import org.apache.tamaya.base.ConfigValueCombinationPolicy;
+
+import javax.config.spi.ConfigBuilder;
+import javax.config.spi.ConfigSource;
+import javax.config.spi.Converter;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A builder for creating new or adapting instances of {@link javax.config.Config}.
+ * Builders can be obtained in exactly two ways:
+ * <ol>
+ * <li>By accessing an empty builder instance from
+ * {@link javax.config.spi.ConfigProviderResolver#getBuilder()}.</li>
+ * </ol>
+ */
+public interface TamayaConfigBuilder extends ConfigBuilder, ConfigContextSupplier {
+
+ /**
+ * Create a new empty configuration builder.
+ * @return
+ */
+ static TamayaConfigBuilder create() {
+ return new DefaultConfigBuilder();
+ }
+
+ static TamayaConfigBuilder create(ConfigContextSupplier contextSupplier){
+ return new DefaultConfigBuilder(contextSupplier.getConfigContext());
+ }
+
+ static TamayaConfigBuilder from(ConfigBuilder configBuilder){
+ if(configBuilder instanceof TamayaConfigBuilder) {
+ return (TamayaConfigBuilder) configBuilder;
+ }else if(configBuilder instanceof ConfigContextSupplier){
+ return create((ConfigContextSupplier)configBuilder);
+ }
+ throw new IllegalArgumentException("Builder must implement ConfigContextSupplier.");
+ }
+
+ /**
+ * This method can be used for programmatically adding {@link ConfigSource}s.
+ * Hereby the property source is added to the tail of property sources with
+ * lowest priority regardless of its current ordinal value. To sort the property
+ * sources based on their ordinals call {@link #sortSources}.
+ *
+ * @param propertySources the PropertySources to add
+ * @return this builder, for chaining, never null.
+ * @throws IllegalArgumentException If a property source with a given name already
+ * exists.
+ */
+ TamayaConfigBuilder withSources(Collection<ConfigSource> propertySources);
+
+ /**
+ * Removes the given property sources, if existing. The existing order of property
+ * sources is preserved.
+ *
+ * @param propertySources the property sources to remove, not {@code null}.
+ * @return the builder for chaining.
+ */
+ TamayaConfigBuilder removeSources(ConfigSource... propertySources);
+
+ /**
+ * Removes the given property sources, if existing. The existing order of property
+ * sources is preserved.
+ *
+ * @param propertySources the property sources to remove, not {@code null}.
+ * @return the builder for chaining.
+ */
+ TamayaConfigBuilder removeSources(Collection<ConfigSource> propertySources);
+
+ /**
+ * Increases the priority of the given property source, by moving it towards the end
+ * of the chain of property sources. If the property source given is already at the end
+ * this method has no effect. This operation does not change any ordinal values.
+ *
+ * @param propertySource the property source to be incresed regarding its significance.
+ * @return the builder for chaining.
+ * @throws IllegalArgumentException If no such property source exists in the current
+ * chain.
+ */
+ TamayaConfigBuilder increasePriority(ConfigSource propertySource);
+
+ /**
+ * Decreases the priority of the given property source, by moving it towards the start
+ * of the chain of property sources. If the property source given is already the first
+ * this method has no effect. This operation does not change any ordinal values.
+ *
+ * @param propertySource the property source to be decresed regarding its significance.
+ * @return the builder for chaining.
+ * @throws IllegalArgumentException If no such property source exists in the current
+ * chain.
+ */
+ TamayaConfigBuilder decreasePriority(ConfigSource propertySource);
+
+ /**
+ * Increases the priority of the given property source to be maximal, by moving it to
+ * the tail of the of property source chain. If the property source given is
+ * already the last item this method has no effect. This operation does not change
+ * any ordinal values.
+ *
+ * @param propertySource the property source to be maximized regarding its significance.
+ * @return the builder for chaining.
+ * @throws IllegalArgumentException If no such property source exists in the current
+ * chain.
+ */
+ TamayaConfigBuilder highestPriority(ConfigSource propertySource);
+
+ /**
+ * Decreases the priority of the given property source to be minimal, by moving it to
+ * the start of the chain of property source chain. If the property source given is
+ * already the first item this method has no effect. This operation does not change
+ * any ordinal values.
+ *
+ * @param propertySource the property source to be minimized regarding its significance.
+ * @return the builder for chaining.
+ * @throws IllegalArgumentException If no such property source exists in the current
+ * chain.
+ */
+ TamayaConfigBuilder lowestPriority(ConfigSource propertySource);
+
+ /**
+ * Access the current chain of property sources. Items at the end of the list have
+ * precedence/more significance.
+ *
+ * @return the property source chain, never {@code null}.
+ */
+ List<ConfigSource> getSources();
+
+ /**
+ * Sorts the current registered property sources using the given comparator.
+ *
+ * NOTE: property sources at the beginning have minimal significance.
+ *
+ * @param comparator the comparator to be used, not {@code null}.
+ * @return this instance for chaining.
+ */
+ TamayaConfigBuilder sortSources(Comparator<ConfigSource> comparator);
+
+ /**
+ * Adds the given PropertyFilter instances, hereby the instances are added
+ * to the end of the list with highest priority. The ordering of existing
+ * property filters remains unchanged. To sort the property
+ * filters call {@link #sortFilter}.
+ *
+ * @param filters the filters to add
+ * @return this builder, for chaining, never null.
+ */
+ TamayaConfigBuilder withFilters(Filter... filters);
+
+ /**
+ * Adds the given PropertyFilter instances, hereby the instances are added
+ * to the end of the list with highest priority. The ordering of existing
+ * property filters remains unchanged. To sort the property
+ * filters call {@link #sortFilter}.
+ *
+ * @param filters the filters to add
+ * @return this builder, for chaining, never null.
+ */
+ TamayaConfigBuilder withFilters(Collection<Filter> filters);
+
+ /**
+ * Add all registered (default) property filters to the context built.
+ * @return this builder, for chaining, never null.
+ */
+ TamayaConfigBuilder addDiscoveredFilters();
+
+ /**
+ * Removes the given PropertyFilter instances, if existing. The order of the remaining
+ * filters is preserved.
+ *
+ * @param filters the filter to remove
+ * @return this builder, for chaining, never null.
+ */
+ TamayaConfigBuilder removeFilters(Filter... filters);
+
+ /**
+ * Removes the given PropertyFilter instances, if existing. The order of the remaining
+ * filters is preserved.
+ *
+ * @param filters the filter to remove
+ * @return this builder, for chaining, never null.
+ */
+ TamayaConfigBuilder removeFilters(Collection<Filter> filters);
+
+ /**
+ * Access the current chain of property filters. Items at the end of the list have
+ * precedence/more significance.
+ *
+ * @return the property source chain, never {@code null}.
+ */
+ List<Filter> getFilters();
+
+ /**
+ * This method can be used for adding {@link Converter}s.
+ * Converters are added at the end after any existing converters.
+ * For converters already registered for the current target type the
+ * method has no effect.
+ *
+ * @param converters the converters to add for this type
+ * @return this builder, for chaining, never null.
+ */
+ TamayaConfigBuilder withConverters(Collection<Converter<?>> converters);
+
+ /**
+ * This method can be used for adding {@link Converter}s.
+ * Converters are added at the end after any existing converters.
+ * For converters already registered for the current target type the
+ * method has no effect.
+ *
+ * @param typeToConvert the type for which the converters is for
+ * @param converters the converters to add for this type
+ * @param <T> the target type.
+ * @return this builder, for chaining, never null.
+ */
+ <T> TamayaConfigBuilder withConverters(Class<T> typeToConvert, Converter<T>... converters);
+
+ /**
+ * This method can be used for adding {@link Converter}s.
+ * Converters are added at the end after any existing converters.
+ * For converters already registered for the current target type the
+ * method has no effect.
+ *
+ * @param typeToConvert the type for which the converters is for
+ * @param converters the converters to add for this type
+ * @param <T> the target type.
+ * @return this builder, for chaining, never null.
+ */
+ <T> TamayaConfigBuilder withConverters(Class<T> typeToConvert, Collection<Converter<T>> converters);
+
+
+ /**
+ * Removes the given PropertyConverter instances for the given type,
+ * if existing.
+ *
+ * @param typeToConvert the type which the converters is for
+ * @param converters the converters to remove
+ * @param <T> the target type.
+ * @return this builder, for chaining, never null.
+ */
+ <T> TamayaConfigBuilder removeConverters(Class<T> typeToConvert, Converter<T>... converters);
+
+ /**
+ * Removes the given PropertyConverter instances for the given type,
+ * if existing.
+ *
+ * @param typeToConvert the type which the converters is for
+ * @param converters the converters to remove
+ * @param <T> the target type.
+ * @return this builder, for chaining, never null.
+ */
+ <T> TamayaConfigBuilder removeConverters(Class<T> typeToConvert, Collection<Converter<T>> converters);
+
+ /**
+ * Removes all converters for the given type, which actually renders a given type
+ * unsupported for type conversion.
+ *
+ * @param typeToConvert the type which the converters is for
+ * @return this builder, for chaining, never null.
+ */
+ <T> TamayaConfigBuilder removeConverters(Class<T> typeToConvert);
+
+ /**
+ * Access the current registered property converters.
+ *
+ * @return the current registered property converters.
+ */
+ Map<Type, List<Converter>> getConverter();
+
+ /**
+ * Sets the {@link ConfigValueCombinationPolicy} used to evaluate the final
+ * property values.
+ *
+ * @param policy the {@link ConfigValueCombinationPolicy} used, not {@code null}.
+ * @return this builder, for chaining, never null.
+ */
+ TamayaConfigBuilder withPropertyValueCombinationPolicy(ConfigValueCombinationPolicy policy);
+
+ /**
+ * Sorts the current registered property filters using the given comparator.
+ *
+ * NOTE: property filters at the beginning have minimal significance.
+ *
+ * @param comparator the comparator to be used, not {@code null}.
+ * @return this instance for chaining.
+ */
+ TamayaConfigBuilder sortFilter(Comparator<Filter> comparator);
+
+ @Override
+ TamayaConfigBuilder addDefaultSources();
+
+ @Override
+ TamayaConfigBuilder addDiscoveredSources();
+
+ @Override
+ TamayaConfigBuilder addDiscoveredConverters();
+
+ @Override
+ TamayaConfigBuilder forClassLoader(ClassLoader loader);
+
+ @Override
+ TamayaConfigBuilder withSources(ConfigSource... sources);
+
+ @Override
+ TamayaConfigBuilder withConverters(Converter<?>... converters);
+
+ <T> TamayaConfigBuilder withConverter(Class<T> type, Converter<T> converter);
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/TypeUtils.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/TypeUtils.java b/code/base/src/main/java/org/apache/tamaya/base/TypeUtils.java
new file mode 100644
index 0000000..f07d8a4
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/TypeUtils.java
@@ -0,0 +1,136 @@
+/*
+ * 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.base;
+
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Objects;
+
+/**
+ * Utility class for type handling.
+ */
+public final class TypeUtils {
+
+ private static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
+
+ /**
+ * Singleton constructor.
+ */
+ private TypeUtils() {
+ }
+
+
+ /**
+ * Checks the current implemented generic interfaces and evaluates the given single type parameter.
+ *
+ * @param clazz the class to check, not {@code null}.
+ * @param interfaceType the interface type to be checked, not {@code null}.
+ * @return the generic type parameters, or an empty array, if it cannot be evaluated.
+ */
+ public static Type[] getInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
+ Objects.requireNonNull(clazz, "Class parameter must be given.");
+ Objects.requireNonNull(interfaceType, "Interface parameter must be given.");
+
+ 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 {@code null}.
+ * @return the generic type parameter of the given single type generic interfaceType, or an empty array.
+ */
+ public static Type[] getTypeParameters(Type type) {
+ Objects.requireNonNull(type, "Type must be given.");
+
+ if (type instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ return parameterizedType.getActualTypeArguments();
+ }
+ return EMPTY_TYPE_ARRAY;
+ }
+
+ /**
+ * Returns basic raw Java type.
+ *
+ * @return the actual type represented by this object
+ */
+ @SuppressWarnings("unchecked")
+ public final Class getRawType(Type type) {
+ if (type instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) type;
+ return (Class) pt.getRawType();
+ } else if (type instanceof GenericArrayType) {
+ return Object[].class;
+ } else if (type instanceof Class) {
+ return (Class) type;
+ } else {
+ throw new RuntimeException("Illegal type for the Type Literal Class");
+ }
+ }
+
+ /**
+ * Returns actual type arguments, if present.
+ *
+ * @return the actual type represented by defined class, or an empty array.
+ */
+ public static final Type[] getActualTypeArguments(Type type) {
+ if (type instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) type;
+ return pt.getActualTypeArguments();
+ }
+ return new Type[0];
+ }
+
+
+ /**
+ * Get the actual parametrized types for a given parametrized super class type.
+ * @param type the type, not null.
+ * @param parametrizedClass the parametrized super class.
+ * @return the types, or an empty array.
+ * @throws IllegalArgumentException if no super class is an instance of the required parametrized type.
+ */
+ public static Type[] getActualTypeArguments(Class type, Class parametrizedClass) {
+ if (type == null) {
+ throw new RuntimeException("Class parameter type can not be null");
+ }
+
+ Type superClazz = type.getGenericSuperclass();
+
+ if (superClazz instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) superClazz;
+ return pt.getActualTypeArguments();
+ } else if (superClazz.equals(Object.class)) {
+ throw new IllegalArgumentException("Super class must be parametrized type");
+ } else {
+ return getActualTypeArguments((Class<?>) superClazz, parametrizedClass);
+ }
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/configsource/ConfigSourceManager.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/configsource/ConfigSourceManager.java b/code/base/src/main/java/org/apache/tamaya/base/configsource/ConfigSourceManager.java
index eff7e55..09f6b5b 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/configsource/ConfigSourceManager.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/configsource/ConfigSourceManager.java
@@ -18,8 +18,11 @@
*/
package org.apache.tamaya.base.configsource;
+import org.apache.tamaya.base.ConfigValueCombinationPolicy;
import org.apache.tamaya.base.FormatUtils;
-import org.apache.tamaya.spi.*;
+import org.apache.tamaya.base.ServiceContext;
+import org.apache.tamaya.base.ServiceContextManager;
+import org.apache.tamaya.base.filter.Filter;
import javax.config.Config;
import javax.config.spi.ConfigSource;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/configsource/JavaConfigurationConfigSource.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/configsource/JavaConfigurationConfigSource.java b/code/base/src/main/java/org/apache/tamaya/base/configsource/JavaConfigurationConfigSource.java
index 6fb3fc8..46c254d 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/configsource/JavaConfigurationConfigSource.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/configsource/JavaConfigurationConfigSource.java
@@ -18,7 +18,7 @@
*/
package org.apache.tamaya.base.configsource;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.base.ServiceContextManager;
import javax.config.spi.ConfigSource;
import java.io.IOException;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/configsource/PropertiesResourceConfigSource.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/configsource/PropertiesResourceConfigSource.java b/code/base/src/main/java/org/apache/tamaya/base/configsource/PropertiesResourceConfigSource.java
index 4e974df..2c7b05c 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/configsource/PropertiesResourceConfigSource.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/configsource/PropertiesResourceConfigSource.java
@@ -18,7 +18,7 @@
*/
package org.apache.tamaya.base.configsource;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.base.ServiceContextManager;
import java.io.InputStream;
import java.net.URL;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/convert/ConversionContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/convert/ConversionContext.java b/code/base/src/main/java/org/apache/tamaya/base/convert/ConversionContext.java
index df16eda..457a9d4 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/convert/ConversionContext.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/convert/ConversionContext.java
@@ -18,8 +18,6 @@
*/
package org.apache.tamaya.base.convert;
-import org.apache.tamaya.spi.TypeLiteral;
-
import javax.config.Config;
import javax.config.spi.Converter;
import java.lang.reflect.AnnotatedElement;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/convert/ConverterManager.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/convert/ConverterManager.java b/code/base/src/main/java/org/apache/tamaya/base/convert/ConverterManager.java
index f22f0ca..e8b28d5 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/convert/ConverterManager.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/convert/ConverterManager.java
@@ -20,10 +20,9 @@ package org.apache.tamaya.base.convert;
import org.apache.tamaya.base.FormatUtils;
import org.apache.tamaya.base.PriorityServiceComparator;
-import org.apache.tamaya.spi.ConfigContext;
-import org.apache.tamaya.spi.ConfigContextSupplier;
-import org.apache.tamaya.spi.ServiceContext;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.base.ConfigContextSupplier;
+import org.apache.tamaya.base.ServiceContext;
+import org.apache.tamaya.base.ServiceContextManager;
import javax.config.Config;
import javax.config.spi.Converter;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/filter/Filter.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/filter/Filter.java b/code/base/src/main/java/org/apache/tamaya/base/filter/Filter.java
new file mode 100644
index 0000000..76d46de
--- /dev/null
+++ b/code/base/src/main/java/org/apache/tamaya/base/filter/Filter.java
@@ -0,0 +1,51 @@
+/*
+ * 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.base.filter;
+
+
+/**
+ * <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.base.ServiceContext}. The ordinal
+ * hereby is defined by the corresponding {@code @Priority} annotation.</p>
+ * <p>Filters </p>
+ */
+@FunctionalInterface
+public interface Filter {
+
+ /**
+ * <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.</p>
+ * <h3>Implementation specification</h3>
+ * Implementations of this class must be
+ * <ul>
+ * <li>reentrant</li>
+ * <li>thread-safe</li>
+ * </ul>
+ * @param key the key, not null.
+ * @param value the value to be filtered, which also can be {@code null} if removed by another filter.
+ * @return the filtered value, or {@code null} if the value should be removed alltogether.
+ * @see org.apache.tamaya.base.ConfigValue
+ * @see org.apache.tamaya.base.ConfigValueBuilder
+ */
+ String filterProperty(String key, String value);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/filter/FilterComparator.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/filter/FilterComparator.java b/code/base/src/main/java/org/apache/tamaya/base/filter/FilterComparator.java
index dd2bd49..caf0ffb 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/filter/FilterComparator.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/filter/FilterComparator.java
@@ -18,8 +18,6 @@
*/
package org.apache.tamaya.base.filter;
-import org.apache.tamaya.spi.Filter;
-
import javax.annotation.Priority;
import java.io.Serializable;
import java.util.Comparator;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/filter/FilterContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/filter/FilterContext.java b/code/base/src/main/java/org/apache/tamaya/base/filter/FilterContext.java
index cdbcba5..d17a666 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/filter/FilterContext.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/filter/FilterContext.java
@@ -18,8 +18,6 @@
*/
package org.apache.tamaya.base.filter;
-import org.apache.tamaya.spi.Filter;
-
import javax.config.Config;
import java.util.HashMap;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/filter/FilterManager.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/filter/FilterManager.java b/code/base/src/main/java/org/apache/tamaya/base/filter/FilterManager.java
index 361f47c..ab52b59 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/filter/FilterManager.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/filter/FilterManager.java
@@ -19,10 +19,8 @@
package org.apache.tamaya.base.filter;
import org.apache.tamaya.base.FormatUtils;
-import org.apache.tamaya.spi.Filter;
-import org.apache.tamaya.spi.ConfigValue;
-import org.apache.tamaya.spi.ServiceContext;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.base.ServiceContext;
+import org.apache.tamaya.base.ServiceContextManager;
import javax.config.Config;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/base/filter/RegexPropertyFilter.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/base/filter/RegexPropertyFilter.java b/code/base/src/main/java/org/apache/tamaya/base/filter/RegexPropertyFilter.java
index 3e46803..9210247 100644
--- a/code/base/src/main/java/org/apache/tamaya/base/filter/RegexPropertyFilter.java
+++ b/code/base/src/main/java/org/apache/tamaya/base/filter/RegexPropertyFilter.java
@@ -18,9 +18,6 @@
*/
package org.apache.tamaya.base.filter;
-import org.apache.tamaya.spi.ConfigValue;
-import org.apache.tamaya.spi.Filter;
-
import java.util.Arrays;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/09472084/code/base/src/main/java/org/apache/tamaya/spi/ConfigContext.java
----------------------------------------------------------------------
diff --git a/code/base/src/main/java/org/apache/tamaya/spi/ConfigContext.java b/code/base/src/main/java/org/apache/tamaya/spi/ConfigContext.java
deleted file mode 100644
index 7c77e12..0000000
--- a/code/base/src/main/java/org/apache/tamaya/spi/ConfigContext.java
+++ /dev/null
@@ -1,154 +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 javax.config.spi.ConfigSource;
-import javax.config.spi.Converter;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-/**
- * Central SPI for programmatically dealing with the setup of the configuration system.
- * This includes adding and enlisting {@link javax.config.spi.ConfigSource}s,
- * managing {@link javax.config.spi.Converter}s, ConfigFilters, etc.
- */
-public interface ConfigContext {
-
- /**
- * 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<ConfigSource> getSources();
-
-// /**
-// * Access a {@link ConfigSource} using its (unique) name.
-// * @param name the propoerty source's name, not {@code null}.
-// * @return the propoerty source found, or {@code null}.
-// */
-// default ConfigSource getSource(String name) {
-// for(ConfigSource ps: getSources()){
-// if(name.equals(ps.getName())){
-// return ps;
-// }
-// }
-// return null;
-// }
-
- /**
- * Access the current PropertyFilter instances.
- * @return the list of registered PropertyFilters, never null.
- */
- List<Filter> getFilters();
-
- /**
- * <p>
- * This method returns the Map of registered PropertyConverters
- * per type.
- * The List for each type is ordered via their {@link javax.annotation.Priority} and
- * cladd name.
- * </p>
- *
- * <p>A simplified scenario could be like:</p>
- * <pre>
- * {
- * Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
- * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
- * Integer.class -> {DynamicDefaultConverter}
- * }
- * </pre>
- *
- * @return map with sorted list of registered PropertySources per type.
- */
- Map<Type, List<Converter>> getConverters();
-
- /**
- * <p>
- * This method returns the registered PropertyConverters for a given type.
- * The List for each type is ordered via their {@link javax.annotation.Priority}.
- * </p>
- *
- * <p>
- * PropertyConverters with a higher Priority come first. The PropertyConverter with the
- * lowest Priority comes last.
- * If two PropertyConverter have the same ordinal number they will get sorted
- * using their class name just to ensure the user at least gets the same ordering
- * after a JVM restart.
- * </p>
- *
- * <p>
- * Additionally if a PropertyProvider is accessed, which is not registered the implementation
- * should try to figure out, if there could be a default implementation as follows:</p>
- * <ol>
- * <li>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
- * instanceOf(String), fomr(String)}</li>
- * <li>Look for a matching constructor: {@code T(String)}.</li>
- * </ol>
- *
- * <p>
- * If a correspoding factory method or constructor could be found, a corresponding
- * PropertyConverter should be created and registered automatically for the given
- * type.
- * </p>
- *
- * <p> The scenario could be like:</p>
- *
- * <pre>
- * {
- * Date.class -> {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
- * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
- * Integer.class -> {DynamicDefaultConverter}
- * }
- * </pre>
- *
- * <p>
- * The converters returned for a type should be used as a chain, whereas the result of the
- * first converters that is able to convert the configured value, is taken as the chain's result.
- * No more converters are called after a converters has successfully converted the input into
- * the required target type.
- * </p>
- *
- * @param type type of the desired converters
- * @return a sorted list of registered PropertySources per type, or null.
- */
- default List<Converter> getConverters(Type type){
- return Optional.ofNullable(getConverters().get(type)).orElse(Collections.emptyList());
- }
-
- /**
- * Access the {@link ConfigValueCombinationPolicy} used to evaluate the final
- * property values.
- * @return the {@link ConfigValueCombinationPolicy} used, never null.
- */
- default ConfigValueCombinationPolicy getConfigValueCombinationPolicy(){
- return ConfigValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
- }
-
-}
-