You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2015/12/20 13:47:53 UTC
[3/3] incubator-tamaya git commit: Moved API module to ./code/
Moved API module to ./code/
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/84d52f16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/84d52f16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/84d52f16
Branch: refs/heads/master
Commit: 84d52f16b7bf37f8e69f9206c6172bd3c93c3988
Parents: 9915f3d
Author: Oliver B. Fischer <pl...@apache.org>
Authored: Sun Dec 20 13:47:46 2015 +0100
Committer: Oliver B. Fischer <pl...@apache.org>
Committed: Sun Dec 20 13:47:46 2015 +0100
----------------------------------------------------------------------
api/pom.xml | 72 ------
.../java/org/apache/tamaya/ConfigException.java | 44 ----
.../java/org/apache/tamaya/ConfigOperator.java | 37 ---
.../java/org/apache/tamaya/ConfigQuery.java | 36 ---
.../java/org/apache/tamaya/Configuration.java | 139 -----------
.../apache/tamaya/ConfigurationProvider.java | 93 --------
.../java/org/apache/tamaya/TypeLiteral.java | 202 ----------------
.../apache/tamaya/spi/ConfigurationContext.java | 155 ------------
.../tamaya/spi/ConfigurationContextBuilder.java | 166 -------------
.../tamaya/spi/ConfigurationProviderSpi.java | 74 ------
.../apache/tamaya/spi/ConversionContext.java | 233 -------------------
.../apache/tamaya/spi/PropertyConverter.java | 40 ----
.../org/apache/tamaya/spi/PropertyFilter.java | 49 ----
.../org/apache/tamaya/spi/PropertySource.java | 125 ----------
.../tamaya/spi/PropertySourceProvider.java | 43 ----
.../spi/PropertyValueCombinationPolicy.java | 63 -----
.../org/apache/tamaya/spi/ServiceContext.java | 57 -----
.../tamaya/spi/ServiceContextManager.java | 125 ----------
.../org/apache/tamaya/ConfigExceptionTest.java | 45 ----
.../org/apache/tamaya/ConfigurationTest.java | 64 -----
.../org/apache/tamaya/TestConfiguration.java | 129 ----------
.../tamaya/TestConfigurationProvider.java | 56 -----
.../java/org/apache/tamaya/TypeLiteralTest.java | 61 -----
.../apache/tamaya/spi/ServiceContextTest.java | 98 --------
.../apache/tamaya/spi/TestServiceContext.java | 90 -------
...g.apache.tamaya.spi.ConfigurationProviderSpi | 19 --
.../org.apache.tamaya.spi.ServiceContext | 19 --
code/api/pom.xml | 72 ++++++
.../java/org/apache/tamaya/ConfigException.java | 44 ++++
.../java/org/apache/tamaya/ConfigOperator.java | 37 +++
.../java/org/apache/tamaya/ConfigQuery.java | 36 +++
.../java/org/apache/tamaya/Configuration.java | 139 +++++++++++
.../apache/tamaya/ConfigurationProvider.java | 93 ++++++++
.../java/org/apache/tamaya/TypeLiteral.java | 202 ++++++++++++++++
.../apache/tamaya/spi/ConfigurationContext.java | 155 ++++++++++++
.../tamaya/spi/ConfigurationContextBuilder.java | 166 +++++++++++++
.../tamaya/spi/ConfigurationProviderSpi.java | 74 ++++++
.../apache/tamaya/spi/ConversionContext.java | 233 +++++++++++++++++++
.../apache/tamaya/spi/PropertyConverter.java | 40 ++++
.../org/apache/tamaya/spi/PropertyFilter.java | 49 ++++
.../org/apache/tamaya/spi/PropertySource.java | 125 ++++++++++
.../tamaya/spi/PropertySourceProvider.java | 43 ++++
.../spi/PropertyValueCombinationPolicy.java | 63 +++++
.../org/apache/tamaya/spi/ServiceContext.java | 57 +++++
.../tamaya/spi/ServiceContextManager.java | 125 ++++++++++
.../org/apache/tamaya/ConfigExceptionTest.java | 45 ++++
.../org/apache/tamaya/ConfigurationTest.java | 64 +++++
.../org/apache/tamaya/TestConfiguration.java | 129 ++++++++++
.../tamaya/TestConfigurationProvider.java | 56 +++++
.../java/org/apache/tamaya/TypeLiteralTest.java | 61 +++++
.../apache/tamaya/spi/ServiceContextTest.java | 98 ++++++++
.../apache/tamaya/spi/TestServiceContext.java | 90 +++++++
...g.apache.tamaya.spi.ConfigurationProviderSpi | 19 ++
.../org.apache.tamaya.spi.ServiceContext | 19 ++
code/pom.xml | 12 +
pom.xml | 5 -
56 files changed, 2346 insertions(+), 2339 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/pom.xml
----------------------------------------------------------------------
diff --git a/api/pom.xml b/api/pom.xml
deleted file mode 100644
index 3d3871d..0000000
--- a/api/pom.xml
+++ /dev/null
@@ -1,72 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-all</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tamaya-api</artifactId>
- <name>Apache Tamaya API</name>
- <packaging>bundle</packaging>
-
- <description>
- The API for accessing configuration data.
- </description>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya,
- org.apache.tamaya.spi
- </Export-Package>
- <!--<Require-Capability>-->
- <!--osgi.extender;-->
- <!--filter:="(osgi.extender=osgi.serviceloader.processor)",-->
- <!--osgi.serviceloader;-->
- <!--filter:="(org.apache.tamaya.spi.ServiceContext)";-->
- <!--cardinality:=multiple;-->
- <!--filter:="(org.apache.tamaya.spi.ConfigurationProviderSpi)";-->
- <!--cardinality:=multiple-->
- <!--</Require-Capability>-->
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/ConfigException.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/ConfigException.java b/api/src/main/java/org/apache/tamaya/ConfigException.java
deleted file mode 100644
index bac2ef4..0000000
--- a/api/src/main/java/org/apache/tamaya/ConfigException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-/**
- * Exception class (runtime exception) for configuration issues.
- */
-public class ConfigException extends RuntimeException{
-
- private static final long serialVersionUID = -5886094818057522680L;
-
- /**
- * Creates a new configuration exception.
- * @param message the exception message, not null.
- */
- public ConfigException(String message){
- super(message);
- }
-
- /**
- * Creates a new configuration exception.
- * @param message the exception message, not null.
- * @param t the throwable.
- */
- public ConfigException(String message, Throwable t){
- super(message, t);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/ConfigOperator.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/ConfigOperator.java b/api/src/main/java/org/apache/tamaya/ConfigOperator.java
deleted file mode 100644
index 2295b07..0000000
--- a/api/src/main/java/org/apache/tamaya/ConfigOperator.java
+++ /dev/null
@@ -1,37 +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;
-
-/**
- * Models a function that maps a given {@link org.apache.tamaya.Configuration} to another {@link org.apache.tamaya.Configuration}. This can be used
- * to modell additional functionality and applying it to a given {@link org.apache.tamaya.Configuration} instance by calling
- * the {@link org.apache.tamaya.Configuration#with(org.apache.tamaya.ConfigOperator)} method.
- */
-public interface ConfigOperator {
-
- /**
- * Creates a new {@link org.apache.tamaya.Configuration} based on the given Configuration. Operators basically acts similar to
- * decorators, whereas operated instances may have non compatible behaviour, e.g. by applying security constraints
- * or view restrictions.
- *
- * @param config the input configuration, not null.
- * @return the operated configuration, never null.
- */
- Configuration operate(Configuration config);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/ConfigQuery.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/ConfigQuery.java b/api/src/main/java/org/apache/tamaya/ConfigQuery.java
deleted file mode 100644
index 9ef0179..0000000
--- a/api/src/main/java/org/apache/tamaya/ConfigQuery.java
+++ /dev/null
@@ -1,36 +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;
-
-/**
- * Models a function that maps a given {@link Configuration} to something else. This can be used
- * to model additional functionality and applying it to a given {@link Configuration} instance by
- * calling the {@link Configuration#query(ConfigQuery)} method.
- */
-public interface ConfigQuery<T> {
-
- /**
- * Creates a result based on the given Configuration. Queries basically acts similar to
- * operators, whereas they returns any kind of result.
- *
- * @param config the input configuration, not null.
- * @return the query result.
- */
- T query(Configuration config);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/Configuration.java b/api/src/main/java/org/apache/tamaya/Configuration.java
deleted file mode 100644
index deaaed9..0000000
--- a/api/src/main/java/org/apache/tamaya/Configuration.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-import java.util.Map;
-
-
-/**
- * A configuration models a aggregated set current properties, identified by a unique key, but adds higher level access functions to
- * a {@link org.apache.tamaya.spi.PropertySource}. Hereby in most cases a configuration is a wrapper around a composite
- * {@link org.apache.tamaya.spi.PropertySource} instance, which may combine multiple child config in well defined tree like structure,
- * where nodes define logically the rules current priority, filtering, combination and overriding.
- * <br/>
- * <h3>Implementation Requirements</h3>
- * Implementations current this interface must be
- * <ul>
- * <li>Thread safe.
- * <li>Immutable
- * </ul>
- * It is not recommended that implementations also are serializable, since the any configuration can be <i>freezed</i>
- * by reading out its complete configuration map into a serializable and remotable structure. This helps significantly
- * simplifying the development current this interface, e.g. for being backed up by systems and stores that are not part current
- * this library at all.
- */
-public interface Configuration {
-
- /**
- * Access a property.
- *
- * @param key the property's key, not null.
- * @return the property's keys.
- */
- String get(String key);
-
- /**
- * Access a property.
- *
- * @param key the property's key, not null.
- * @param defaultValue value to be returned, if no value is present.
- * @return the property's keys.
- */
- String getOrDefault(String key, String defaultValue);
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @param type The target type required, not null.
- * @param defaultValue value to be used, if no value is present.
- * @return the property value, never null..
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- <T> T getOrDefault(String key, Class<T> type, T defaultValue);
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @param type The target type required, not null.
- * @return the property value, never null..
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- <T> T get(String key, Class<T> type);
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @param type The target type required, not null.
- * @return the property value, never null..
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- <T> T get(String key, TypeLiteral<T> type);
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @param type The target type required, not null.
- * @param defaultValue default value to be used, if no value is present.
- * @return the property value, never null..
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue);
-
- /**
- * Access all current known Configuration properties as a full {@code Map<String,String>}.
- * Be aware that entries from non scannable parts of the registered {@link org.apache.tamaya.spi.PropertySource}
- * instances may not be contained in the result, but nevertheless be accessible calling one of the
- * {@code get(...)} methods.
- */
- Map<String,String> getProperties();
-
- /**
- * Extension point for adjusting configuration.
- *
- * @param operator A configuration operator, e.g. a filter, or an adjuster
- * combining configurations.
- * @return the new adjusted configuration returned by the {@code operator}, never {@code null}.
- */
- Configuration with(ConfigOperator operator);
-
- /**
- * Query a configuration.
- *
- * @param query the query, never {@code null}.
- * @return the result returned by the {@code query}
- */
- <T> T query(ConfigQuery<T> query);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
deleted file mode 100644
index 9e8f294..0000000
--- a/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spi.ConfigurationProviderSpi;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-/**
- * Static access to the {@link Configuration} for the very application.
- */
-public final class ConfigurationProvider {
-
- private static final ConfigurationProviderSpi PROVIDER_SPI = loadSpi();
-
- private static ConfigurationProviderSpi loadSpi() {
- ConfigurationProviderSpi spi = ServiceContextManager.getServiceContext()
- .getService(ConfigurationProviderSpi.class);
- if(spi==null){
- throw new IllegalStateException("ConfigurationProviderSpi not available.");
- }
- return spi;
- }
-
- private ConfigurationProvider() {
- // just to prevent initialisation
- }
-
- /**
- * Access the current configuration.
- *
- * @return the corresponding Configuration instance, never null.
- */
- public static Configuration getConfiguration() {
- return PROVIDER_SPI.getConfiguration();
- }
-
- /**
- * Get access to the current ConfigurationContext.
- *
- * @return the current ConfigurationContext, never null.
- */
- public static ConfigurationContext getConfigurationContext() {
- return PROVIDER_SPI.getConfigurationContext();
- }
-
- /**
- * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new
- * instance. This can be used to update the context with a new one, e.g. because some of the configuration
- * data has changed and should be updated. It is the responsibility of the ConfigurationProvider to trigger
- * corresponding update events for the current {@link org.apache.tamaya.Configuration}, so observing
- * listeners can do whatever is appropriate to react to any given configuration changes.
- *
- * @param context the new ConfigurationContext to be applied.
- * @throws java.lang.UnsupportedOperationException if the current provider is read-only and does not support
- * applying a new ConfigurationContext.
- */
- public static void setConfigurationContext(ConfigurationContext context) {
- PROVIDER_SPI.setConfigurationContext(context);
- }
-
- /**
- * Create a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance. This method creates
- * a new builder instance that is not related to any concrete {@link org.apache.tamaya.spi.ConfigurationContext}.
- * You can use {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} to change the
- * current configuration context.
- *
- * @return a new, empty {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
- * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
- * @see org.apache.tamaya.spi.ConfigurationContext
- */
- public static ConfigurationContextBuilder getConfigurationContextBuilder() {
- return PROVIDER_SPI.getConfigurationContextBuilder();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/TypeLiteral.java b/api/src/main/java/org/apache/tamaya/TypeLiteral.java
deleted file mode 100644
index be2d008..0000000
--- a/api/src/main/java/org/apache/tamaya/TypeLiteral.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-import java.io.Serializable;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-
-/**
- * <p>Class for instantiation of objects that represent parameterized types
- * with current parameters.</p>
- * <p>
- * <p>An object that represents a parameterized type may be obtained by
- * subclassing <tt>TypeLiteral</tt>.</p>
- * <p>
- * <pre>
- * TypeLiteral<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 Type definedType;
-
- /**
- * Constructor.
- * @param definedType the defined type.
- */
- protected TypeLiteral(Type definedType) {
- this.definedType = definedType;
- }
-
- /**
- * Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
- */
- protected TypeLiteral() {
- this.definedType = getDefinedType(this.getClass());
- }
-
- /**
- * Creates a new TypeLiteral based on a given type.
- *
- * @param type the type , not null.
- * @param <R> the literal generic type.
- * @return the corresponding TypeLiteral, never null.
- */
- public static <R> TypeLiteral<R> of(Type type) {
- return new TypeLiteral<>(type);
- }
-
- /**
- * Checks the current implemented generic interfaces and evaluates the given single type parameter.
- *
- * @param clazz the class to check, not null.
- * @param interfaceType the interface type to be checked, not null.
- * @return the generic type parameter, or null, if it cannot be evaluated.
- */
- public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
- for (Type type : clazz.getGenericInterfaces()) {
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- if(parameterizedType.getRawType().equals(interfaceType)){
- return parameterizedType.getActualTypeArguments();
- }
- }
- }
- return EMPTY_TYPE_ARRAY;
- }
-
- /**
- * Method that checks the class's type for a generic interface implementation type.
- *
- * @param type the type, not null.
- * @return the generic type parameter of the given single type generic interfaceType, or null.
- */
- public static Type[] getTypeParameters(Type type) {
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- return parameterizedType.getActualTypeArguments();
- }
- return EMPTY_TYPE_ARRAY;
- }
-
- public final Type getType() {
- return definedType;
- }
-
- /**
- * Returns basic raw Java type.
- *
- * @return the actual type represented by this object
- */
- public final Class<T> getRawType() {
- Class<T> rawType = null;
-
- if (this.definedType instanceof Class) {
- rawType = (Class<T>) this.definedType;
- } else if (this.definedType instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) this.definedType;
- rawType = (Class<T>) pt.getRawType();
-
- } else if (this.definedType instanceof GenericArrayType) {
- rawType = (Class<T>) Object[].class;
- } else {
- throw new RuntimeException("Illegal type for the Type Literal Class");
- }
-
- return rawType;
- }
-
-
- protected Type getDefinedType(Class<?> clazz) {
- Type type = null;
-
- if (clazz == null) {
- throw new RuntimeException("Class parameter clazz can not be null");
- }
-
- Type superClazz = clazz.getGenericSuperclass();
-
- if (superClazz.equals(Object.class)) {
- throw new RuntimeException("Super class must be parametrized type");
- } else if (superClazz instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) superClazz;
- Type[] actualArgs = pt.getActualTypeArguments();
-
- if (actualArgs.length == 1) {
- type = actualArgs[0];
-
- } else {
- throw new RuntimeException("More than one parametric type");
- }
-
- } else {
- type = getDefinedType((Class<?>) superClazz);
- }
-
- return type;
- }
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((definedType == null) ? 0 : definedType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TypeLiteral<?> other = (TypeLiteral<?>) obj;
- if (definedType == null) {
- if (other.definedType != null) {
- return false;
- }
- } else if (!definedType.equals(other.definedType)) {
- return false;
- }
- return true;
- }
-
-
- @Override
- public String toString() {
- return "TypeLiteral{" +
- "type=" + definedType +
- '}';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
deleted file mode 100644
index f0b7265..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ /dev/null
@@ -1,155 +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.TypeLiteral;
-
-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 org.apache.tamaya.spi.PropertySource}s,
- * managing {@link PropertyConverter}s, ConfigFilters, etc.
- */
-public interface ConfigurationContext {
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesToAdd the PropertySources to add
- */
- void addPropertySources(PropertySource... propertySourcesToAdd);
-
- /**
- * This method returns the current list of registered PropertySources ordered via their ordinal.
- * PropertySources with a lower ordinal come last. The PropertySource with the
- * highest ordinal comes first.
- * If two PropertySources have the same ordinal number they will get sorted
- * using their class name just to ensure the user at least gets the same ordering
- * after a JVM restart, hereby names before are added last.
- * PropertySources are loaded when this method is called the first time, which basically is
- * when the first time configuration is accessed.
- *
- * @return a sorted list of registered PropertySources. The returned list need not be modifiable
- */
- List<PropertySource> getPropertySources();
-
-
- /**
- * This method can be used for programmatically adding {@link PropertyConverter}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param typeToConvert the type which the converter is for
- * @param propertyConverter the PropertyConverters to add for this type
- */
- <T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter);
-
- /**
- * <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. Refer also to {@link #getPropertyConverters()}.
- * </p>
- * <p>
- * A simplified scenario could be like:
- * <pre>
- * {
- * Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
- * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
- * Integer.class -> {DynamicDefaultConverter}
- * }
- * </pre>
- * </p>
- *
- * @return map with sorted list of registered PropertySources per type.
- */
- Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters();
-
- /**
- * <p>
- * This method returns the registered PropertyConverters for a given type.
- * The List for each type is ordered via their {@link javax.annotation.Priority}.
- * </p>
- *
- * <p>
- * 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:
- * <ol>
- * <le>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
- * instanceOf(String), fomr(String)}</le>
- * <le>Look for a matching constructor: {@code T(String)}.</le>
- * </ol>
- * If a correspoding factory method or constructor could be found, a corresponding
- * PropertyConverter should be created and registered automatically for the given
- * type.
- * </p>
- *
- * <p>
- * The scenario could be like:
- * <pre>
- * {
- * Date.class -> {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
- * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
- * Integer.class -> {DynamicDefaultConverter}
- * }
- * </pre>
- * </p>
- *
- * <p>
- * The converters returned for a type should be used as a chain, whereas the result of the
- * first converter that is able to convert the configured value, is taken as the chain's result.
- * No more converters are called after a converter has successfully converted the input into
- * the required target type.
- * </p>
- *
- * @return a sorted list of registered PropertySources per type.
- */
- <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> type);
-
- /**
- * Access the current PropertyFilter instances.
- * @return the list of registered PropertyFilters, never null.
- */
- List<PropertyFilter> getPropertyFilters();
-
- /**
- * Access the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used to evaluate the final
- * property values.
- * @return the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used, never null.
- */
- PropertyValueCombinationPolicy getPropertyValueCombinationPolicy();
-
- /**
- * Creates a {@link ConfigurationContextBuilder} preinitialized with the data from this instance.
- * @return a new builder instance, never null.
- */
- ConfigurationContextBuilder toBuilder();
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java b/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
deleted file mode 100644
index d0c39d6..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
+++ /dev/null
@@ -1,166 +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.TypeLiteral;
-
-import java.util.Collection;
-
-/**
- * A builder for creating new or adapting instances of {@link ConfigurationContext}.
- * Builders can be obtained in exactly two ways:
- * <ol>
- * <li>By accessing a preinitialized builder from an existing {@link ConfigurationContext},
- * by calling {@link org.apache.tamaya.spi.ConfigurationContext#toBuilder()}.</li>
- * <li>By accessing an empty builder instance from
- * {@link org.apache.tamaya.ConfigurationProvider#getConfigurationContextBuilder()}.</li>
- * </ol>
- * After all changes are applied to a builder a new {@link ConfigurationContext} instance can
- * be created and can be applied by calling
- * {@link org.apache.tamaya.ConfigurationProvider#setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)}. Since this method can
- * throw an UnsupportedOperationException, you should check before if changing the current ConfigurationContext
- * programmatically is supported by calling
- * {@link org.apache.tamaya.ConfigurationProvider#isConfigurationContextSettable()}.
- */
-public interface ConfigurationContextBuilder {
-
- /**
- * Init this builder instance with the given {@link ConfigurationContext} instance. This
- * method will replace any existing data in the current builder with the data contained in the given
- * {@link ConfigurationContext}.
- *
- * @param context the {@link ConfigurationContext} instance to be used, not null.
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder setContext(ConfigurationContext context);
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesToAdd the PropertySources to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertySources(PropertySource... propertySourcesToAdd);
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesToAdd the PropertySources to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySourcesToAdd);
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesNames the PropertySource names of the sources to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertySources(String... propertySourcesNames);
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesNames the PropertySource names of the sources to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertySources(Collection<String> propertySourcesNames);
-
- /**
- * Adds the given PropertyFilter instances.
- *
- * @param filters the filters to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters);
-
- /**
- * Adds the given PropertyFilter instances.
- *
- * @param filters the filters to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters);
-
- /**
- * Removes the given PropertyFilter instances.
- *
- * @param filters the filters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters);
-
- /**
- * Removes the given PropertyFilter instances.
- *
- * @param filters the filters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters);
-
- /**
- * This method can be used for programmatically adding {@link PropertyConverter}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param typeToConvert the type which the converter is for
- * @param propertyConverter the PropertyConverters to add for this type
- * @return this builder, for chaining, never null.
- */
- <T> ConfigurationContextBuilder addPropertyConverter(TypeLiteral<T> typeToConvert,
- PropertyConverter<T> propertyConverter);
-
- /**
- * Removes the given PropertyConverter instances.
- *
- * @param typeToConvert the type which the converter is for
- * @param converters the converters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
- PropertyConverter<?>... converters);
-
- /**
- * Removes the given PropertyConverter instances.
- *
- * @param typeToConvert the type which the converter is for
- * @param converters the converters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
- Collection<PropertyConverter<?>> converters);
-
- /**
- * Sets the {@link PropertyValueCombinationPolicy} used to evaluate the final
- * property values.
- *
- * @param policy the {@link PropertyValueCombinationPolicy} used, not null
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy);
-
- /**
- * Builds a {@link ConfigurationContext} based on the data set.
- */
- ConfigurationContext build();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java b/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
deleted file mode 100644
index bb87372..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import org.apache.tamaya.Configuration;
-
-/**
- * SPI that must be implemented to provide the component that manages all {@link org.apache.tamaya.Configuration}
- * instances in a system. In SE this may be a true singleton containing exact one {@link org.apache.tamaya.Configuration}
- * instance, whereas in Java EE and other more complex environments instances may be returned depending the current
- * runtime context.
- */
-public interface ConfigurationProviderSpi {
-
- /**
- * Access the current {@link org.apache.tamaya.Configuration}.
- *
- * @return the current {@link org.apache.tamaya.Configuration} instance, never null.
- */
- Configuration getConfiguration();
-
- /**
- * Get access to the current {@link ConfigurationContext}.
- *
- * @return the current {@link ConfigurationContext}, never null.
- */
- ConfigurationContext getConfigurationContext();
-
- /**
- * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new
- * instance. This can be used to update the context with a new one, e.g. because some of the configuration
- * data has changed and must be updated. It is the responsibility of the ConfigurationProvider to trigger
- * corresponding update event for the current {@link org.apache.tamaya.spi.ConfigurationContext} or
- * {@link org.apache.tamaya.Configuration}.
- *
- * @param context the new ConfigurationContext to be applied.
- * @throws java.lang.UnsupportedOperationException if the current provider is read-only.
- */
- void setConfigurationContext(ConfigurationContext context);
-
- /**
- * Method that allows to determine if a new {@link org.apache.tamaya.spi.ConfigurationContext} can be applied
- * programmatically.
- *
- * @return true, if {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} is supported
- * by the current implementation.
- * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
- */
- boolean isConfigurationContextSettable();
-
- /**
- * Creates a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance.
- *
- * @return a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
- */
- ConfigurationContextBuilder getConfigurationContextBuilder();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java b/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java
deleted file mode 100644
index 037f7aa..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java
+++ /dev/null
@@ -1,233 +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.Configuration;
-import org.apache.tamaya.TypeLiteral;
-
-import java.lang.reflect.AnnotatedElement;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * A conversion context containing all the required values for implementing conversion. Use the included #Builder
- * for creating new instances of. This class is thread-safe to use. Adding supported formats is synchronized.
- * @see PropertyConverter
- */
-public class ConversionContext {
-
- private Configuration configuration;
- private String key;
- private TypeLiteral<?> targetType;
- private AnnotatedElement annotatedElement;
- private List<String> supportedFormats = new ArrayList<>();
-
- /**
- * Private constructor used from builder.
- * @param builder the builder, not null.
- */
- protected ConversionContext(Builder builder){
- this.key = builder.key;
- this.annotatedElement = builder.annotatedElement;
- this.targetType = builder.targetType;
- this.supportedFormats.addAll(builder.supportedFormats);
- this.configuration = builder.configuration;
- }
-
- /**
- * Get the key accessed. This information is very useful to evaluate additional metadata needed to determine/
- * control further aspects of the conversion.
- * @return the key. This may be null in case where a default value has to be converted and no unique underlying
- * key/value configuration is present..
- */
- public String getKey(){
- return key;
- }
-
- /**
- * Get the target type required.
- * @return the target type required.
- */
- public TypeLiteral<?> getTargetType(){
- return targetType;
- }
-
- /**
- * Get the annotated element, if conversion is performed using injection mechanisms.
- * @return the annotated element, or null..
- */
- public AnnotatedElement getAnnotatedElement(){
- return annotatedElement;
- }
-
- /**
- * Get the configuration, which is targeted.
- * @return the configuration instance, or null.
- */
- public Configuration getConfiguration(){
- return configuration;
- }
-
- /**
- * Allows to add information on the supported/tried formats, which can be shown to the user, especially when
- * conversion failed. Adding of formats is synchronized, all formats are added in order to the overall list.
- * This means formats should be passed in order of precedence.
- * @param converterType the converter, which implements the formats provided.
- * @param formatDescriptors the format descriptions in a human readable form, e.g. as regular expressions.
- */
- public void addSupportedFormats(Class<? extends PropertyConverter> converterType, String... formatDescriptors){
- synchronized (supportedFormats){
- for(String format: formatDescriptors) {
- supportedFormats.add(format + " (" + converterType.getSimpleName() + ")");
- }
- }
- }
-
- /**
- * Get the supported/tried formats in precedence order. The contents of this method depends on the
- * {@link PropertyConverter} instances involved in a conversion.
- * @return the supported/tried formats, never null.
- */
- public List<String> getSupportedFormats(){
- synchronized (supportedFormats){
- return new ArrayList<>(supportedFormats);
- }
- }
-
- @Override
- public String toString() {
- return "ConversionContext{" +
- "configuration=" + configuration +
- ", key='" + key + '\'' +
- ", targetType=" + targetType +
- ", annotatedElement=" + annotatedElement +
- ", supportedFormats=" + supportedFormats +
- '}';
- }
-
- /**
- * Builder to create new instances of {@link ConversionContext}.
- */
- public static final class Builder{
- /** The backing configuration. */
- private Configuration configuration;
- /** The accessed key, or null. */
- private String key;
- /** The target type. */
- private TypeLiteral<?> targetType;
- /** The injection target (only set with injection used). */
- private AnnotatedElement annotatedElement;
- /** The ordered list of formats tried. */
- private Set<String> supportedFormats = new HashSet<>();
-
- /**
- * Creates a new Builder instance.
- * @param targetType the target type
- */
- public Builder(TypeLiteral<?> targetType) {
- this(null, null, targetType);
- }
-
- /**
- * Creates a new Builder instance.
- * @param key the requested key, may be null.
- * @param targetType the target type
- */
- public Builder(String key, TypeLiteral<?> targetType) {
- this(null, key, targetType);
- }
-
- /**
- * Creates a new Builder instance.
- * @param configuration the configuration, not null.
- * @param key the requested key, may be null.
- */
- public Builder(Configuration configuration, String key, TypeLiteral<?> targetType){
- this.key = key;
- this.configuration = configuration;
- this.targetType = Objects.requireNonNull(targetType);
- }
-
- /**
- * Sets the key.
- * @param key the key, not null.
- * @return the builder instance, for chaining
- */
- public Builder setKey(String key){
- this.key = Objects.requireNonNull(key);
- return this;
- }
-
- /**
- * Sets the configuration.
- * @param configuration the configuration, not null
- * @return the builder instance, for chaining
- */
- public Builder setConfiguration(Configuration configuration){
- this.configuration = Objects.requireNonNull(configuration);
- return this;
- }
-
- /**
- * Sets the annotated element, when configuration is injected.
- * @param annotatedElement the annotated element, not null
- * @return the builder instance, for chaining
- */
- public Builder setAnnotatedElement(AnnotatedElement annotatedElement){
- this.annotatedElement = Objects.requireNonNull(annotatedElement);
- return this;
- }
-
- /**
- * Add the formats provided by a {@link PropertyConverter}. This method should be called by each converter
- * performing/trying conversion, so the user can be given feedback on the supported formats on failure.
- * @param converterType the converter type, not null.
- * @param formatDescriptors the formats supported in a human readable form, e.g. as regular expressions.
- * @return the builder instance, for chaining
- */
- public Builder addSupportedFormats(Class<? extends PropertyConverter> converterType, String... formatDescriptors){
- for(String format: formatDescriptors) {
- supportedFormats.add(format + " (" + converterType.getSimpleName() + ")");
- }
- return this;
- }
-
- /**
- * Builds a new context instance.
- * @return a new context, never null.
- */
- public ConversionContext build(){
- return new ConversionContext(this);
- }
-
- @Override
- public String toString() {
- return "Builder{" +
- "configuration=" + configuration +
- ", key='" + key + '\'' +
- ", targetType=" + targetType +
- ", annotatedElement=" + annotatedElement +
- ", supportedFormats=" + supportedFormats +
- '}';
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java b/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
deleted file mode 100644
index 02ca904..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
+++ /dev/null
@@ -1,40 +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;
-
-
-/**
- * Interface for an property that converts a configured String into something else.
- * This is used for implementing type conversion from a property (String) to a certain target
- * type. Hereby the target type can be multivalued (eg collections) or complex if needed.
- */
-public interface PropertyConverter<T>{
-
- /**
- * Convert the given configuration keys from it' String representation into the required target type.
- * The context instance passed also allows to add a list of supported formats, which is very handy in case a
- * value could not be converted. This list of supported formats can then shown to the user to give some hints
- * how a value could be configured.
- * @param context the {@link ConversionContext}, containing the String value and the requested configuration key.
- * @return converted keys
- * @see ConversionContext#addSupportedFormats(Class, String...)
- */
- T convert(String value, ConversionContext context);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java b/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
deleted file mode 100644
index 55f4295..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
+++ /dev/null
@@ -1,49 +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>
- */
-public interface PropertyFilter {
-
- /**
- * <p>Maps the current {@code valueToBeFiltered} value to a new value. The resulting value will be used as the result
- * passed to the user.</p>
- * <p>If a filter is currently not available, it should just pass the input map to the method's
- * output.</p>
- * <p>Returning {@code null} will remove the entry.</p>
- * <h3>Implementation specification</h3>
- * Implementations of this class must be
- * <ul>
- * <li>reentrant</li>
- * <li>thread-safe</li>
- * </ul>
- *
- * @param key the key accessed, not null.
- * @param valueToBeFiltered the value to be filtered, not null.
- * @return the filtered value, or {@code null} if the value should be removed alltogether.
- */
- String filterProperty(String key, String valueToBeFiltered);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertySource.java b/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
deleted file mode 100644
index 4457919..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
+++ /dev/null
@@ -1,125 +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.Map;
-
-
-/**
- * This interface models a provider that serves configuration properties. The contained
- * properties may be read fromMap single or several sources (composite).<br/>
- * PropertySources are the building blocks of the final configuration.
- * <p/>
- * <h3>Implementation Requirements</h3>
- * <p></p>Implementations current this interface must be
- * <ul>
- * <li>Thread safe.</li>
- * </ul>
- * </p>
- * <p>
- * <p>A PropertySourceProvider will get picked up via the
- * {@link java.util.ServiceLoader} mechanism and can be registered via
- * META-INF/services/org.apache.tamaya.spi.PropertySource
- * </p>
- * <p>
- * If you like to register multiple PropertySources at the same time
- * you can use the {@link org.apache.tamaya.spi.PropertySourceProvider}
- * interface.
- * </p>
- */
-public interface PropertySource {
-
- /**
- * property name to override default tamaya ordinals
- */
- static final String TAMAYA_ORDINAL = "tamaya.ordinal";
-
-
- /**
- * Lookup order:
- * TODO rethink whole default PropertySources and ordering:
- * TODO introduce default values or constants for ordinals
- * <ol>
- * <li>System properties (ordinal 400)</li>
- * <li>Environment properties (ordinal 300)</li>
- * <li>JNDI values (ordinal 200)</li>
- * <li>Properties file values (/META-INF/applicationConfiguration.properties) (ordinal 100)</li>
- * </ol>
- * <p/>
- * <p><b>Important Hints for custom implementations</b>:</p>
- * <p>
- * If a custom implementation should be invoked <b>before</b> the default implementations, use a value > 400
- * </p>
- * <p>
- * If a custom implementation should be invoked <b>after</b> the default implementations, use a value < 100
- * </p>
- * <p/>
- * <p>Reordering of the default order of the config-sources:</p>
- * <p>Example: If the properties file/s should be used <b>before</b> the other implementations,
- * you have to configure an ordinal > 400. That means, you have to add e.g. deltaspike_ordinal=401 to
- * /META-INF/apache-deltaspike.properties . Hint: In case of property files every file is handled as independent
- * config-source, but all of them have ordinal 400 by default (and can be reordered in a fine-grained manner.</p>
- *
- * @return the 'importance' aka ordinal of the configured values. The higher, the more important.
- * //X TODO think about making this a default method which returns default priority
- */
- int getOrdinal();
-
-
- /**
- * Get the name of the property source. The name should be unique for the type of source, whereas the id is used
- * to ensure unique identity, either locally or remotely.
- * @return the configuration's name, never null.
- */
- String getName();
-
- /**
- * Access a property.
- *
- * //X TODO discuss if the key can be null
- * @param key the property's key, not null.
- * @return the property's keys.
- */
- String get(String key);
-
- /**
- * Access the current properties as Map. The resulting Map may not return all items accessible, e.g.
- * when the underlying storage does not support iteration of its entries.
- *
- * @return the a corresponding map, never null.
- * //X TODO or should we just do getPropertyKeys()? Think about security (key) vs easier merging (full map)?
- */
- Map<String,String> getProperties();
-
- /**
- * Determines if this config source could be scanned for its list of properties.
- *
- * <p>
- * PropertySources which are not scannable might not be able to find all the
- * configured values to provide via {@link #getProperties()}. This can e.g. happen
- * if the underlying storage doesn't support listing.
- * </p>
- *
- * @return {@code true} if this PropertySource could be scanned for its list of properties,
- * {@code false} if it should not be scanned.
- */
- boolean isScannable();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java b/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
deleted file mode 100644
index 42e3b4d..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
+++ /dev/null
@@ -1,43 +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.Collection;
-
-/**
- * <p>Implement this interfaces to provide a PropertySource provider which
- * is able to register multiple PropertySources. This is e.g. needed if
- * there are multiple property files of a given config file name.</p>
- *
- * <p>If a PropertySource like JNDI only exists once, then there is no need
- * to implement it via the PropertySourceProvider but should directly
- * expose a {@link PropertySource}.</p>
- *
- * <p>A PropertySourceProvider will get picked up via the
- * {@link java.util.ServiceLoader} mechanism and must get registered via
- * META-INF/services/org.apache.tamaya.spi.PropertySourceProvider</p>
- */
-public interface PropertySourceProvider {
-
- /**
- * @return For each e.g. property file, we return a single PropertySource
- * or an empty list if no PropertySource exists.
- */
- Collection<PropertySource> getPropertySources();
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java b/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
deleted file mode 100644
index dbda457..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/PropertyValueCombinationPolicy.java
+++ /dev/null
@@ -1,63 +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;
-
-/**
- * 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_COLLECTOR} 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 PropertyValueCombinationPolicy {
-
- /**
- * Default overriding collector, where each existing entry ({@code current} is overridden by a subsequent non-null
- * entry evaluated by {@code propertySource.get(key)}.
- */
- public static final PropertyValueCombinationPolicy DEFAULT_OVERRIDING_COLLECTOR = new PropertyValueCombinationPolicy(){
-
- @Override
- public String collect(String currentValue, String key, PropertySource propertySource) {
- String value = propertySource.get(key);
- return value!=null?value:currentValue;
- }
-
- };
-
- /**
- * 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 org.apache.tamaya.Configuration#getProperties()}.
- *
- * @param currentValue the current value, including 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.
- */
- String collect(String currentValue, String key, PropertySource propertySource);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java b/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
deleted file mode 100644
index cdd481e..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
+++ /dev/null
@@ -1,57 +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.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();
-
- /**
- * 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 serviceType the service type.
- * @return The instance to be used, or {@code null}
- * @throws org.apache.tamaya.ConfigException if there are multiple service implementations with the maximum priority.
- */
- <T> T getService(Class<T> serviceType);
-
- /**
- * Access a list current services, given its type. The bootstrap mechanism should
- * order the instance for precedence, hereby the most significant should be
- * first in order.
- *
- * @param serviceType
- * the service type.
- * @return The instance to be used, never {@code null}
- */
- <T> List<T> getServices(Class<T> serviceType);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java b/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
deleted file mode 100644
index 259493c..0000000
--- a/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
+++ /dev/null
@@ -1,125 +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;
-
-import org.apache.tamaya.ConfigException;
-
-
-/**
- * This singleton provides access to the services available in the current {@link ServiceContext}. The
- * behaviour can be adapted, by calling {@link ServiceContextManager#set(ServiceContext)} before accessing any
- * services.
- */
-public final class ServiceContextManager {
-
- /** The logger used. */
- private static final Logger LOG = Logger.getLogger(ServiceContextManager.class.getName());
-
- /**
- * The ServiceProvider used.
- */
- private static volatile ServiceContext serviceContextProviderDelegate;
-
- /**
- * Private singletons constructor.
- */
- private ServiceContextManager() {
- }
-
- /**
- * Load the {@link ServiceContext} to be used.
- *
- * @return {@link ServiceContext} to be used for loading the services.
- */
- private static ServiceContext loadDefaultServiceProvider() {
- ServiceContext highestServiceContext = null;
- try {
- int highestOrdinal = 0;
- for (ServiceContext serviceContext : ServiceLoader.load(ServiceContext.class)) {
- if (serviceContext.ordinal() > highestOrdinal) {
- highestServiceContext = serviceContext;
- highestOrdinal = serviceContext.ordinal();
- }
- }
- } catch (Exception e) {
- throw new ConfigException("ServiceContext not loadable", e);
- }
-// if (highestServiceContext==null){
-// String serviceContext = System.getProperty(ServiceContext.class.getName());
-// if(serviceContext != null){
-// try{
-// highestServiceContext = (ServiceContext)Class.forName(serviceContext).newInstance();
-// } catch (Exception e) {
-// throw new ConfigException("Configured ServiceContext not loadable: " + serviceContext, e);
-// }
-// }
-// }
- if (highestServiceContext==null){
- throw new ConfigException("No ServiceContext found");
- }
- LOG.info("Using Service Context of type: " + highestServiceContext.getClass().getName());
- return highestServiceContext;
- }
-
- /**
- * Replace the current {@link ServiceContext} in use.
- *
- * @param serviceContextProvider the new {@link ServiceContext}, not null.
- */
- public static ServiceContext set(ServiceContext serviceContextProvider) {
- ServiceContext currentContext = ServiceContextManager.serviceContextProviderDelegate;
- Objects.requireNonNull(serviceContextProvider);
-
- synchronized (ServiceContextManager.class) {
- if (ServiceContextManager.serviceContextProviderDelegate == null) {
- ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
- LOG.log(Level.INFO, "Using ServiceProvider: " + serviceContextProvider.getClass().getName());
- } else {
- LOG.log(Level.WARNING, "Replacing ServiceProvider " +
- ServiceContextManager.serviceContextProviderDelegate.getClass().getName() +
- " with: " + serviceContextProvider.getClass().getName());
- ServiceContextManager.serviceContextProviderDelegate = serviceContextProvider;
- }
- }
-
- return currentContext;
- }
-
- /**
- * Ge {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
- *
- * @return the {@link ServiceContext} used.
- */
- public static ServiceContext getServiceContext() {
- if (serviceContextProviderDelegate == null) {
- synchronized (ServiceContextManager.class) {
- if (serviceContextProviderDelegate == null) {
- serviceContextProviderDelegate = loadDefaultServiceProvider();
- }
- }
- }
- return serviceContextProviderDelegate;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java b/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
deleted file mode 100644
index fa7da0a..0000000
--- a/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests instantiating {@link ConfigException}.
- */
-public class ConfigExceptionTest {
-
- @Test
- public void testCreationMessage(){
- ConfigException ex = new ConfigException("test");
- assertNull(ex.getCause());
- assertEquals(ex.getMessage(), "test");
- }
-
- @Test
- public void testCreationMessageThrowable(){
- Exception e = new IllegalStateException("blabla");
- ConfigException ex = new ConfigException("test", e);
- assertTrue(ex.getCause() == e);
- assertEquals("test", ex.getMessage());
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/84d52f16/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/ConfigurationTest.java b/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
deleted file mode 100644
index 11a16b9..0000000
--- a/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- * Test class that tests the default methods implemented on {@link org.apache.tamaya.Configuration}. The provided
- * {@link org.apache.tamaya.TestConfiguration} is implemeted with maximal use of the default methods.
- */
-public class ConfigurationTest {
-
- @Test
- public void testget() throws Exception {
- assertEquals(Boolean.TRUE, ConfigurationProvider.getConfiguration().get("booleanTrue", Boolean.class));
- assertEquals(Boolean.FALSE, ConfigurationProvider.getConfiguration().get("booleanFalse", Boolean.class));
- assertEquals((int)Byte.MAX_VALUE, (int)ConfigurationProvider.getConfiguration().get("byte", Byte.class));
- assertEquals((int)Integer.MAX_VALUE, (int)ConfigurationProvider.getConfiguration().get("int", Integer.class));
- assertEquals((long)Long.MAX_VALUE, (long)ConfigurationProvider.getConfiguration().get("long", Long.class));
- assertEquals((double)Float.MAX_VALUE, (double)ConfigurationProvider.getConfiguration().get("float", Float.class), 0.0d);
- assertEquals((double)Double.MAX_VALUE, (double)ConfigurationProvider.getConfiguration().get("double", Double.class), 0.0d);
- }
-
- @Test
- public void testGetBoolean() throws Exception {
- assertTrue(ConfigurationProvider.getConfiguration().get("booleanTrue", Boolean.class));
- assertFalse(ConfigurationProvider.getConfiguration().get("booleanFalse", Boolean.class));
- assertFalse(ConfigurationProvider.getConfiguration().get("foorBar", Boolean.class));
- }
-
- @Test
- public void testGetInteger() throws Exception {
- assertEquals(Integer.MAX_VALUE,(int) ConfigurationProvider.getConfiguration().get("int", Integer.class));
- }
-
- @Test
- public void testGetLong() throws Exception {
- assertEquals(Long.MAX_VALUE,(long) ConfigurationProvider.getConfiguration().get("long", Long.class));
- }
-
- @Test
- public void testGetDouble() throws Exception {
- assertEquals(Double.MAX_VALUE,(double) ConfigurationProvider.getConfiguration().get("double", Double.class), 0.0d);
- }
-
-
-}
\ No newline at end of file