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 2014/11/26 19:07:09 UTC
[04/11] incubator-tamaya git commit: Initial import from GitHub.
Added PGP public key.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/properties/PropertyProviders.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/PropertyProviders.java b/core/src/main/java/org/apache/tamaya/core/properties/PropertyProviders.java
new file mode 100644
index 0000000..517b1d9
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/properties/PropertyProviders.java
@@ -0,0 +1,469 @@
+/*
+ * 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.core.properties;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.tamaya.MetaInfo;
+import org.apache.tamaya.MetaInfoBuilder;
+import org.apache.tamaya.PropertyProvider;
+
+import java.net.URI;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+/**
+ * Accessor factory for several standard {@link org.apache.tamaya.PropertyProvider} instances, usable for creating {@code Configuration}
+ * parts.
+ */
+public final class PropertyProviders {
+
+ private static final PropertyProvider EMPTY_PROPERTYPROVIDER = from(Collections.emptyMap());
+ private static final PropertyProvider ENV_PROPERTYPROVIDER = new EnvironmentPropertyProvider();
+
+ private static final Logger LOG = LogManager.getLogger(PropertyProviders.class);
+
+ /**
+ * Private singleton constructor.
+ */
+ private PropertyProviders() {
+ }
+
+ /**
+ * Creates a new {@link }PropertyMap} using the given command line arguments
+ *
+ * @param args the command line arguments, not null.
+ * @return a new {@link }PropertyMap} instance with the given arguments contained as properties.
+ */
+ public static PropertyProvider fromArgs(String... args) {
+ return fromArgs(MetaInfo.of("Built from Args"), args);
+ }
+
+ /**
+ * Creates a new {@link }PropertyMap} using the given command line arguments
+ *
+ * @param metaInfo the meta information to be provided additionally.
+ * @param args the command line arguments, not null.
+ * @return a new {@link }PropertyMap} instance with the given arguments contained as properties.
+ */
+ public static PropertyProvider fromArgs(MetaInfo metaInfo, String... args) {
+ Objects.requireNonNull(metaInfo);
+ // TODO read the CLI with some better library, e.g. move parsing service to ext. service SPI
+ Map<String, String> properties = new HashMap<>();
+ for (int base = 0; base < args.length; base++) {
+ if (args[base].startsWith("--")) {
+ String argKey = args[base].substring(2);
+ String value = "true"; // flag only
+ if (base != args.length - 1) {
+ if (args[base + 1].startsWith("-")) {
+ base++;
+ int eqIndex = argKey.indexOf('=');
+ if (eqIndex > 0) {
+ value = argKey.substring(eqIndex + 1);
+ argKey = argKey.substring(0, eqIndex);
+ }
+ } else {
+ value = args[base + 1];
+ base += 2;
+ }
+ }
+ properties.put(argKey, value);
+ } else if (args[base].startsWith("-")) {
+ String argKey = args[base].substring(1);
+ String value = "true"; // flag only
+ if (base != args.length - 1) {
+ if (args[base + 1].startsWith("-")) {
+ base++;
+ int eqIndex = argKey.indexOf('=');
+ if (eqIndex > 0) {
+ value = argKey.substring(eqIndex + 1);
+ argKey = argKey.substring(0, eqIndex);
+ }
+ } else {
+ value = args[base + 1];
+ base += 2;
+ }
+ }
+ properties.put(argKey, value);
+ }
+ }
+ return from(metaInfo, properties);
+ }
+
+ /**
+ * Creates a new read-only {@link org.apache.tamaya.PropertyProvider} by reading the according path resources. The effective resources read
+ * hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+ * Properties read from resources evaluated on
+ * paths with lower order are overriding any duplicate values from previous paths hereby.
+ *
+ * @param paths the paths to be resolved by the {@code PathResolverService} , not null.
+ * @return a new {@link }PropertyMap} instance with the given paths contained as properties.
+ */
+ public static PropertyProvider fromPaths(String... paths) {
+ return fromPaths(MetaInfo.of("Built from Paths"), paths);
+ }
+
+
+ /**
+ * Creates a new read-only {@link org.apache.tamaya.PropertyProvider} by reading the according path resources. The effective resources read
+ * hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+ * Properties read from resources evaluated on
+ * paths with lower order are overriding any duplicate values from previous paths hereby.
+ *
+ * @param paths the paths to be resolved by the {@code PathResolverService} , not null.
+ * @return a new {@link }PropertyMap} instance with the given paths contained as properties.
+ */
+ public static PropertyProvider fromPaths(Collection<String> paths) {
+ return fromPaths(MetaInfo.of("Built from Paths"), paths);
+ }
+
+ /**
+ * Creates a new read-only {@link org.apache.tamaya.PropertyProvider} by reading the according path resources. The effective resources read
+ * hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+ * Properties read from resources evaluated on
+ * paths with lower order are overriding any duplicate values from previous paths hereby.
+ *
+ * @param metaInfo the meat information to be provided additionally.
+ * @param paths the paths to be resolved by the {@code PathResolverService} , not null.
+ * @return a new {@link }PropertyMap} instance with the given paths contained as properties.
+ */
+ public static PropertyProvider fromPaths(MetaInfo metaInfo, String... paths) {
+ return fromPaths(metaInfo, Arrays.asList(paths));
+ }
+
+ /**
+ * Creates a new read-only {@link org.apache.tamaya.PropertyProvider} by reading the according path resources. The effective resources read
+ * hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+ * Properties read from resources evaluated on
+ * paths with lower order are overriding any duplicate values from previous paths hereby.
+ *
+ * @param metaInfo the meat information to be provided additionally.
+ * @param paths the paths to be resolved by the {@code PathResolverService} , not null.
+ * @return a new {@link }PropertyMap} instance with the given paths contained as properties.
+ */
+ public static PropertyProvider fromPaths(MetaInfo metaInfo, Collection<String> paths) {
+ return new PathBasedPropertyProvider(metaInfo, paths);
+ }
+
+ /**
+ * Creates a new read-only {@link org.apache.tamaya.PropertyProvider} based on the resources defined by the given paths. The effective resources
+ * read hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+ *
+ * @param uris the uris to be read, not null.
+ * @return a new {@link }PropertyMap} instance based on the given paths/resources found.
+ */
+ public static PropertyProvider fromUris(URI... uris) {
+ return fromUris(MetaInfo.of("Built from URIs"), uris);
+ }
+
+ /**
+ * Creates a new read-only {@link org.apache.tamaya.PropertyProvider} based on the resources defined by the given paths. The effective resources
+ * read hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+ *
+ * @param uris the uris to be read, not null.
+ * @return a new {@link }PropertyMap} instance based on the given paths/resources found.
+ */
+ public static PropertyProvider fromUris(Collection<URI> uris) {
+ return fromUris(MetaInfo.of("Built from URIs"), uris);
+ }
+
+ /**
+ * Creates a new read-only {@link org.apache.tamaya.PropertyProvider} based on the resources defined by the given paths. The effective resources
+ * read hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+ *
+ * @param metaInfo the meat information to be provided additionally.
+ * @param uris the uris to be read, not null.
+ * @return a new {@link }PropertyMap} instance based on the given paths/resources found.
+ */
+ public static PropertyProvider fromUris(MetaInfo metaInfo, URI... uris) {
+ Objects.requireNonNull(metaInfo);
+ return fromUris(metaInfo, Arrays.asList(uris));
+ }
+
+ /**
+ * Creates a new read-only {@link org.apache.tamaya.PropertyProvider} based on the resources defined by the given paths. The effective resources
+ * read hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
+ *
+ * @param metaInfo the meat information to be provided additionally.
+ * @param uris the uris to be read, not null.
+ * @return a new {@link }PropertyMap} instance based on the given paths/resources found.
+ */
+ public static PropertyProvider fromUris(MetaInfo metaInfo, Collection<URI> uris) {
+ return new URIBasedPropertyProvider(metaInfo, uris);
+ }
+
+ /**
+ * Creates a new read-only {@link PropertyProvider} by using the given Map.
+ *
+ * @param map the properties to be included, not null.
+ * @return a new {@link }PropertyMap} instance with the given properties from the Map instance passed.
+ */
+ public static PropertyProvider from(Map<String, String> map) {
+ return from(MetaInfo.of("Built from Map"), map);
+ }
+
+
+ /**
+ * Creates a new read-only {@link PropertyProvider} by using the given Map.
+ *
+ * @param metaInfo the meat information to be provided additionally.
+ * @param map the properties to be included, not null.
+ * @return a new {@link }PropertyMap} instance with the given properties from the Map instance passed.
+ */
+ public static PropertyProvider from(MetaInfo metaInfo, Map<String, String> map) {
+ return new MapBasedPropertyProvider(metaInfo, map);
+ }
+
+ /**
+ * Create meta information for CLI arguments passed.
+ *
+ * @param args the CLI arguments, not null.
+ * @return the corresponding meta information.
+ */
+ private static MetaInfo createArgsMetaInfo(String... args) {
+ MetaInfoBuilder metaBuilder = MetaInfoBuilder.of();
+ return metaBuilder.setType("cli").set("args", Arrays.toString(args)).build();
+ }
+
+
+ /**
+ * Create meta information for CLI arguments passed.
+ *
+ * @param paths the paths to be resolved by the {@code PathResolverService} , not null.
+ * @return the corresponding meta information.
+ */
+ private static MetaInfo createPathMetaInfo(String... paths) {
+ MetaInfoBuilder metaBuilder = MetaInfoBuilder.of();
+ return metaBuilder.setSourceExpressions(paths).build();
+ }
+
+ /**
+ * Get an empty and immutable PropertyProvider instance.
+ *
+ * @return an empty and immutable PropertyProvider instance, never null.
+ */
+ public static PropertyProvider empty() {
+ return EMPTY_PROPERTYPROVIDER;
+ }
+
+ /**
+ * Get an empty and immutable PropertyProvider instance.
+ *
+ * @return an empty and mutable PropertyProvider instance, never null.
+ */
+ public static PropertyProvider emptyMutable() {
+ return PropertyProviders.from(new ConcurrentHashMap<>());
+ }
+
+ /**
+ * Get an empty and immutable PropertyProvider instance. The meta-information contains the given String
+ * under the key 'info'.
+ *
+ * @return an empty and immutable PropertyProvider instance, never null, with the given Strings as info meta-data..
+ */
+ public static PropertyProvider empty(MetaInfo metaInfo) {
+ return from(metaInfo, Collections.emptyMap());
+ }
+
+ /**
+ * Get an empty and mutable PropertyProvider instance. The meta-information contains the given String
+ * under the key 'info'.
+ *
+ * @return an empty and immutable PropertyProvider instance, never null, with the given Strings as info meta-data..
+ */
+ public static PropertyProvider emptyMutable(MetaInfo metaInfo) {
+ return from(metaInfo, new ConcurrentHashMap<>());
+ }
+
+ /**
+ * Returns a read-only {@link PropertyProvider} reflecting the current runtime environment properties.
+ *
+ * @return a new read-only {@link PropertyProvider} instance based on the current runtime environment properties.
+ */
+ public static PropertyProvider fromEnvironmentProperties() {
+ return ENV_PROPERTYPROVIDER;
+ }
+
+ /**
+ * Creates a new read-only {@link PropertyProvider} reflecting the current system properties.
+ *
+ * @return a new read-only {@link PropertyProvider} instance based on the current system properties.
+ */
+ public static PropertyProvider fromSystemProperties() {
+ return new SystemPropertiesPropertyProvider();
+ }
+
+ /**
+ * Converts a given {@link org.apache.tamaya.PropertyProvider} instance into a serializable and immutable form,
+ * so it can be sent over a network connection.
+ *
+ * @param provider the PropertyProvider to be freezed.
+ * @return the serializable instance.
+ */
+ public static PropertyProvider freezed(PropertyProvider provider) {
+ return FreezedPropertyProvider.of(provider);
+ }
+
+ /**
+ * Creates a new {@link PropertyProvider} containing all property maps given, hereby later maps in the array override
+ * properties from previous instances.
+ *
+ * @param propertyMaps the maps to be included, not null.
+ * @return the union instance containing all given maps.
+ */
+ public static PropertyProvider union(PropertyProvider... propertyMaps) {
+ return union(AggregationPolicy.OVERRIDE, propertyMaps);
+ }
+
+ /**
+ * Creates a new {@link PropertyProvider} containing all property maps given, hereby using the given AggregationPolicy.
+ *
+ * @param policy the AggregationPolicy to be used, not null.
+ * @param propertyMaps the maps to be included, not null.
+ * @return the aggregated instance containing all given maps.
+ */
+ public static PropertyProvider union(AggregationPolicy policy, PropertyProvider... propertyMaps) {
+ return new AggregatedPropertyProvider(null, policy, propertyMaps);
+ }
+
+ /**
+ * Creates a new {@link PropertyProvider} that is mutable by adding a map based instance that overrides
+ * values from the original map.
+ * @param provider the provider to be made mutable, not null.
+ * @return the mutable instance.
+ */
+ public static PropertyProvider mutable(PropertyProvider provider) {
+ PropertyProvider mutableProvider = PropertyProviders.emptyMutable();
+ return mutableUnion(mutableProvider, AggregationPolicy.OVERRIDE, provider, mutableProvider);
+ }
+
+ /**
+ * Creates a new {@link PropertyProvider} containing all property maps given, hereby later maps in the array override
+ * properties from previous instances.
+ * @param mutableProvider the provider used for delegating change requests.
+ * @param propertyMaps the maps to be included, not null.
+ * @return the union instance containing all given maps.
+ */
+ public static PropertyProvider mutableUnion(PropertyProvider mutableProvider, PropertyProvider... propertyMaps) {
+ return mutableUnion(mutableProvider, AggregationPolicy.OVERRIDE, propertyMaps);
+ }
+
+ /**
+ * Creates a new {@link PropertyProvider} containing all property maps given, hereby using the given AggregationPolicy.
+ * @param mutableProvider the provider used for delegating change requests.
+ * @param policy the AggregationPolicy to be used, not null.
+ * @param propertyMaps the maps to be included, not null.
+ * @return the aggregated instance containing all given maps.
+ */
+ public static PropertyProvider mutableUnion(PropertyProvider mutableProvider, AggregationPolicy policy, PropertyProvider... propertyMaps) {
+ return new AggregatedPropertyProvider(mutableProvider, policy, propertyMaps);
+ }
+
+ /**
+ * Creates a new {@link PropertyProvider} containing only properties that are shared by all given maps,
+ * hereby later maps in the array override properties from previous instances.
+ *
+ * @param propertyMaps the maps to be included, not null.
+ * @return the intersecting instance containing all given maps.
+ */
+ public static PropertyProvider intersected(AggregationPolicy policy, PropertyProvider... propertyMaps) {
+ return new IntersectingPropertyProvider(policy, propertyMaps);
+ }
+
+ /**
+ * Creates a new {@link PropertyProvider} containing only properties that are shared by all given maps,
+ * hereby later maps in the array override properties from previous instances.
+ *
+ * @param propertyMaps the maps to be included, not null.
+ * @return the intersecting instance containing all given maps.
+ */
+ public static PropertyProvider intersected(PropertyProvider... propertyMaps) {
+ return new IntersectingPropertyProvider(AggregationPolicy.OVERRIDE, propertyMaps);
+ }
+
+ /**
+ * Creates a new {@link PropertyProvider} containing only properties from the target instance, that are not contained
+ * in one of the other maps passed.
+ *
+ * @param target the base map, not null.
+ * @param subtrahendSets the maps to be subtracted, not null.
+ * @return the intersecting instance containing all given maps.
+ */
+ public static PropertyProvider subtracted(PropertyProvider target, PropertyProvider... subtrahendSets) {
+ return new SubtractingPropertyProvider(target, subtrahendSets);
+ }
+
+
+ /**
+ * Creates a filtered {@link PropertyProvider} (a view) of a given base {@link }PropertyMap}. The filter hereby is
+ * applied dynamically on access, so also runtime changes of the base map are reflected appropriately.
+ *
+ * @param propertyMap the base map instance, not null.
+ * @param filter the filtger to be applied, not null.
+ * @return the new filtering instance.
+ */
+ public static PropertyProvider filtered(Predicate<String> filter, PropertyProvider propertyMap) {
+ return new FilteredPropertyProvider(propertyMap, filter);
+ }
+
+ /**
+ * Creates a new contextual {@link PropertyProvider}. Contextual maps delegate to different instances of PropertyMap depending
+ * on the keys returned from the isolationP
+ *
+ * @param mapSupplier the supplier creating new provider instances
+ * @param isolationKeySupplier the supplier providing contextual keys based on the current environment.
+ */
+ public static PropertyProvider contextual(Supplier<PropertyProvider> mapSupplier,
+ Supplier<String> isolationKeySupplier) {
+ return new ContextualPropertyProvider(mapSupplier, isolationKeySupplier);
+ }
+
+
+ /**
+ * Creates a filtered {@link PropertyProvider} (a view) of a given base {@link }PropertyMap}. The filter hereby is
+ * applied dynamically on access, so also runtime changes of the base map are reflected appropriately.
+ *
+ * @param mainMap the main map instance, not null.
+ * @param parentMap the delegated parent map instance, not null.
+ * @return the new delegating instance.
+ */
+ public static PropertyProvider delegating(PropertyProvider mainMap, Map<String, String> parentMap) {
+ return new DelegatingPropertyProvider(mainMap, parentMap);
+ }
+
+ /**
+ * Creates a {@link org.apache.tamaya.PropertyProvider} where all keys of a current map,
+ * existing in another map are replaced
+ * with the ones from the other {@link org.apache.tamaya.PropertyProvider}. The filter hereby is
+ * applied dynamically on access, so also runtime changes of the base map are reflected appropriately.
+ * Keys not existing in the {@code mainMap}, but present in {@code replacementMao} will be hidden.
+ *
+ * @param mainMap the main map instance, which keys, present in {@code replacementMap} will be replaced
+ * with the ones
+ * in {@code replacementMap}, not null.
+ * @param replacementMap the map instance, that will replace all corresponding entries in {@code mainMap}, not null.
+ * @return the new delegating instance.
+ */
+ public static PropertyProvider replacing(PropertyProvider mainMap, Map<String, String> replacementMap) {
+ return new ReplacingPropertyProvider(mainMap, replacementMap);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java b/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java
new file mode 100644
index 0000000..40630cc
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/properties/ReplacingPropertyProvider.java
@@ -0,0 +1,111 @@
+/*
+ * 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.core.properties;
+
+import org.apache.tamaya.ConfigChangeSet;
+import org.apache.tamaya.MetaInfo;
+import org.apache.tamaya.MetaInfoBuilder;
+import org.apache.tamaya.PropertyProvider;
+
+import java.util.*;
+
+/**
+ * Implementation for a {@link org.apache.tamaya.PropertyProvider} that is an aggregate of
+ * multiple child instances, where all existing key/values in a replacementMap will
+ * replace values in a main map, if present there.
+ */
+class ReplacingPropertyProvider implements PropertyProvider{
+
+ private static final long serialVersionUID = -1419376385695224799L;
+ private PropertyProvider mainMap;
+ private Map<String,String> replacingMap;
+ private MetaInfo metaInfo;
+
+ /**
+ * Creates a mew instance, with aggregation polilcy
+ * {@code AggregationPolicy.OVERRIDE}.
+ *
+ * @param mainMap The main ConfigMap.
+ * @param replacingMap The replacing ConfigMap.
+ */
+ public ReplacingPropertyProvider(PropertyProvider mainMap, Map<String,String> replacingMap){
+ Objects.requireNonNull(replacingMap);
+ this.replacingMap = replacingMap;
+ Objects.requireNonNull(mainMap);
+ this.mainMap = mainMap;
+ this.metaInfo = MetaInfoBuilder.of().setType("replacing").set("mainProvider", mainMap.toString())
+ .set("replacing", replacingMap.toString()).build();
+ }
+
+ @Override
+ public void load(){
+ mainMap.load();
+ }
+
+ @Override
+ public boolean containsKey(String key){
+ return mainMap.containsKey(key);
+ }
+
+ @Override
+ public Map<String,String> toMap(){
+ Map<String,String> result = new HashMap<>(replacingMap);
+ for(Map.Entry<String,String> en : mainMap.toMap().entrySet()){
+ if(!replacingMap.containsKey(en.getKey())){
+ result.put(en.getKey(), en.getValue());
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public MetaInfo getMetaInfo(){
+ return this.metaInfo;
+ }
+
+ @Override
+ public Optional<String> get(String key){
+ String val = replacingMap.get(key);
+ if(val == null){
+ return mainMap.get(key);
+ }
+ return Optional.ofNullable(val);
+ }
+
+ @Override
+ public Set<String> keySet(){
+ return mainMap.keySet();
+ }
+
+ /**
+ * Apply a config change to this item. Hereby the change must be related to the same instance.
+ * @param change the config change
+ * @throws org.apache.tamaya.ConfigException if an unrelated change was passed.
+ * @throws UnsupportedOperationException when the configuration is not writable.
+ */
+ @Override
+ public void apply(ConfigChangeSet change){
+ this.mainMap.apply(change);
+ }
+
+ @Override
+ public String toString(){
+ return super.toString() + "(mainMap=" + mainMap + ", replacingMap=" + replacingMap + ")";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/properties/Store.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/Store.java b/core/src/main/java/org/apache/tamaya/core/properties/Store.java
new file mode 100644
index 0000000..711824e
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/properties/Store.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.core.properties;
+
+import java.lang.ref.WeakReference;
+import java.util.*;
+
+/**
+ * This store encapsulates an list of WeakReferences to items.
+ * It cleans up the list from null references, when an item is removed, or an Iterator is created.
+ * Created by Anatole on 10.04.2014.
+ */
+public class Store<T>implements Iterable<T> {
+
+ private List<WeakReference<T>> weakItems = new ArrayList<>();
+
+ private List<T> items = new ArrayList<>();
+
+ private final Object LOCK = new Object();
+
+ public void add(T item){
+ Objects.requireNonNull(item);
+ this.items.add(item);
+ }
+
+ public void addWeak(T item){
+ Objects.requireNonNull(item);
+ this.weakItems.add(new WeakReference<>(item));
+ }
+
+ public void remove(T item){
+ Objects.requireNonNull(item);
+ synchronized(LOCK){
+ for(Iterator<WeakReference<T>> iter = weakItems.iterator(); iter.hasNext();iter.next()){
+ WeakReference<T> wr = iter.next();
+ T t = wr.get();
+ if(t==null || t.equals(item)){
+ iter.remove();
+ }
+ }
+ for(Iterator<T> iter = items.iterator(); iter.hasNext();iter.next()){
+ T t = iter.next();
+ if(t==null || t.equals(item)){
+ iter.remove();
+ }
+ }
+ }
+ }
+
+ public List<T> toList(){
+ List<T> newList = new ArrayList<>();
+ synchronized(LOCK){
+ Iterator<T> iter = items.iterator();
+ while(iter.hasNext()){
+ T t = iter.next();
+ newList.add(t);
+ }
+ for (WeakReference<T> wr : weakItems) {
+ T t = wr.get();
+ if (t == null) {
+ iter.remove();
+ } else {
+ newList.add(t);
+ }
+ }
+ }
+ return newList;
+ }
+
+ @Override
+ public Iterator<T> iterator(){
+ return toList().iterator();
+ }
+
+ @Override
+ public String toString(){
+ return "Store{" +
+ "items=" + items +
+ ", weakItems=" + weakItems +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java b/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java
new file mode 100644
index 0000000..95791f1
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/properties/SubtractingPropertyProvider.java
@@ -0,0 +1,75 @@
+/*
+ * 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.core.properties;
+
+import org.apache.tamaya.ConfigChangeSet;
+import org.apache.tamaya.MetaInfoBuilder;
+import org.apache.tamaya.PropertyProvider;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+class SubtractingPropertyProvider extends AbstractPropertyProvider{
+
+ private static final long serialVersionUID = 4301042530074932562L;
+ private PropertyProvider unit;
+ private Collection<PropertyProvider> subtrahends;
+
+ public SubtractingPropertyProvider(PropertyProvider configuration, PropertyProvider... subtrahends){
+ super(MetaInfoBuilder.of(configuration.getMetaInfo()).setType("sutracted").set("subtrahends", Arrays.toString(subtrahends)).build());
+ Objects.requireNonNull(configuration);
+ this.unit = configuration;
+ this.subtrahends = Arrays.asList(subtrahends);
+ }
+
+ private boolean filter(Map.Entry<String,String> entry){
+ for(PropertyProvider prov: subtrahends){
+ if(prov.containsKey(entry.getKey())){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public Map<String,String> toMap(){
+ return this.unit.toMap().entrySet().stream().filter(this::filter).collect(Collectors.toMap(
+ (en) -> en.getKey(),
+ (en) -> en.getValue()
+ ));
+ }
+
+ @Override
+ public void load(){
+ unit.load();
+ super.load();
+ }
+
+ /**
+ * Apply a config change to this item. Hereby the change must be related to the same instance.
+ * @param change the config change
+ * @throws org.apache.tamaya.ConfigException if an unrelated change was passed.
+ * @throws UnsupportedOperationException when the configuration is not writable.
+ */
+ @Override
+ public void apply(ConfigChangeSet change){
+ this.unit.apply(change);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/properties/SystemPropertiesPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/SystemPropertiesPropertyProvider.java b/core/src/main/java/org/apache/tamaya/core/properties/SystemPropertiesPropertyProvider.java
new file mode 100644
index 0000000..8f186be
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/properties/SystemPropertiesPropertyProvider.java
@@ -0,0 +1,52 @@
+/*
+ * 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.core.properties;
+
+import org.apache.tamaya.MetaInfoBuilder;
+import org.apache.tamaya.core.env.ConfiguredSystemProperties;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+class SystemPropertiesPropertyProvider extends AbstractPropertyProvider{
+
+
+ private static final long serialVersionUID = -5935940312707001199L;
+
+ public SystemPropertiesPropertyProvider(){
+ super(MetaInfoBuilder.of().setType("sys-properties").build());
+ }
+
+ @Override
+ public Map<String,String> toMap(){
+ Properties sysProps = System.getProperties();
+ if(sysProps instanceof ConfiguredSystemProperties){
+ sysProps = ((ConfiguredSystemProperties)sysProps).getInitialProperties();
+ }
+ Map<String,String> props = new HashMap<>();
+ for (Map.Entry<Object,Object> en : sysProps.entrySet()) {
+ props.put(en.getKey().toString(), en.getValue().toString());
+ }
+ return Collections.unmodifiableMap(props);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/properties/UriBasedPropertyProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/properties/UriBasedPropertyProvider.java b/core/src/main/java/org/apache/tamaya/core/properties/UriBasedPropertyProvider.java
new file mode 100644
index 0000000..0e81769
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/properties/UriBasedPropertyProvider.java
@@ -0,0 +1,68 @@
+/*
+ * 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.core.properties;
+
+import org.apache.tamaya.MetaInfo;
+import org.apache.tamaya.MetaInfoBuilder;
+import org.apache.tamaya.core.config.ConfigurationFormats;
+import org.apache.tamaya.spi.Bootstrap;
+import org.apache.tamaya.core.spi.ConfigurationFormat;
+
+import java.net.URI;
+import java.util.*;
+
+/**
+ * Created by Anatole on 16.10.2014.
+ */
+final class URIBasedPropertyProvider extends AbstractPropertyProvider {
+
+ private List<URI> uris = new ArrayList<>();
+ private Map<String,String> properties = new HashMap<>();
+
+ public URIBasedPropertyProvider(MetaInfo metaInfo, Collection<URI> uris) {
+ super(metaInfo);
+ Objects.requireNonNull(uris);
+ this.uris.addAll(uris);
+ init();
+ }
+
+ private void init(){
+ List<String> sources = new ArrayList<>();
+ for(URI uri : uris){
+ ConfigurationFormat format = ConfigurationFormats.getFormat(uri);
+ if(format != null){
+ try{
+ properties.putAll(format.readConfiguration(uri));
+ sources.add(uri.toString());
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+ }
+ MetaInfoBuilder metaInfoBuilder = MetaInfoBuilder.of(getMetaInfo());
+ super.metaInfo = metaInfoBuilder
+ .setSources(sources.toString()).build();
+ }
+
+ @Override
+ public Map<String, String> toMap() {
+ return properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/AdapterProviderSpi.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/AdapterProviderSpi.java b/core/src/main/java/org/apache/tamaya/core/spi/AdapterProviderSpi.java
new file mode 100644
index 0000000..1638eec
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/AdapterProviderSpi.java
@@ -0,0 +1,37 @@
+/*
+ * 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.core.spi;
+
+import org.apache.tamaya.PropertyAdapter;
+import java.util.function.Function;
+
+/**
+ * This service provides different {@link org.apache.tamaya.PropertyAdapter} instances for types.
+ */
+public interface AdapterProviderSpi{
+
+ /**
+ * Called, when a given {@link org.apache.tamaya.Configuration} has to be evaluated.
+ *
+ * @return the corresponding {@link java.util.function.Function<String, T>}, or {@code null}, if
+ * not available for the given target type.
+ */
+ <T> PropertyAdapter<T> getAdapter(Class<T> type);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormat.java b/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormat.java
new file mode 100644
index 0000000..1ebe566
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormat.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.core.spi;
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * Implementations of this class encapsulate the mechanism how to read a
+ * resource URI including interpreting the format correctly (e.g. xml vs.
+ * properties).
+ */
+public interface ConfigurationFormat{
+
+ /**
+ * Returns a unique identifier that identifies each format.
+ *
+ * @return the unique format id, mever null.
+ */
+ public String getFormatName();
+
+ /**
+ * Check if the given {@link java.net.URI} and path xpression qualify that this format should be
+ * able to read them, e.g. checking for compatible file endings.
+ *
+ * @param resource the configuration location, not null
+ * @return {@code true} if the given resource is in a format supported by
+ * this instance.
+ */
+ boolean isAccepted(URI resource);
+
+ /**
+ * Reads a {@link javax.config.PropertyMap} from the given URI, using this format.
+ *
+ * @param resource the configuration location, not null
+ * @return the corresponding {@link java.util.Map}, never {@code null}.
+ */
+ Map<String,String> readConfiguration(URI resource);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormatsSingletonSpi.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormatsSingletonSpi.java b/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormatsSingletonSpi.java
new file mode 100644
index 0000000..44c88ec
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormatsSingletonSpi.java
@@ -0,0 +1,59 @@
+/*
+ * 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.core.spi;
+
+import java.net.URI;
+import java.util.Collection;
+
+/**
+ * Created by Anatole on 17.09.2014.
+ */
+public interface ConfigurationFormatsSingletonSpi{
+ /**
+ * Access a {@link org.apache.tamaya.core.spi.ConfigurationFormat}.
+ *
+ * @param formatName the format name
+ * @return the corresponding {@link org.apache.tamaya.core.spi.ConfigurationFormat}, or {@code null}, if
+ * not available for the given environment.
+ */
+ ConfigurationFormat getFormat(String formatName);
+
+ /**
+ * Get a collection of the keys of the registered {@link ConfigurationFormat} instances.
+ *
+ * @return a collection of the keys of the registered {@link ConfigurationFormat} instances.
+ */
+ Collection<String> getFormatNames();
+
+ /**
+ * Evaluate the matching format for a given resource.
+ *
+ * @param resource The resource
+ * @return a matching configuration format, or {@code null} if no matching format could be determined.
+ */
+ ConfigurationFormat getFormat(URI resource);
+
+ default ConfigurationFormat getPropertiesFormat(){
+ return getFormat("properties");
+ }
+
+ default ConfigurationFormat getXmlPropertiesFormat(){
+ return getFormat("xml-properties");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationProviderSpi.java b/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationProviderSpi.java
new file mode 100644
index 0000000..121bf94
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationProviderSpi.java
@@ -0,0 +1,41 @@
+/*
+ * 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.core.spi;
+
+import org.apache.tamaya.Configuration;
+
+/**
+* This configuration provider SPI allows to register the effective factory logic to create and manage a configuration
+* instance. Hereby the qualifiers determine the type of configuration. By default
+*/
+public interface ConfigurationProviderSpi{
+
+ /**
+ * Returns the name of the configuration provided.
+ * @return the name of the configuration provided, not empty.
+ */
+ String getConfigName();
+
+ /**
+ * Get the {@link Configuration}, if available.
+ * @return according configuration, or null, if none is available for the given environment.
+ */
+ Configuration getConfiguration();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java b/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java
new file mode 100644
index 0000000..992b337
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/EnvironmentProvider.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.core.spi;
+
+import org.apache.tamaya.Environment;
+
+import java.util.Set;
+
+/**
+ * SPI for components that define a concrete type of {@link org.apache.tamaya.Environment}.
+ * The chain of environment providers determine the current {@link Environment} active
+ * and its parent instances.
+ * Created by Anatole on 14.10.2014.
+ */
+public interface EnvironmentProvider {
+
+ /**
+ * Get the environment type this provider is responsible for.
+ * @return the environment.
+ */
+ String getEnvironmentType();
+
+ /**
+ * Evaluates if an environment is currently active.
+ * @return
+ */
+ boolean isEnvironmentActive();
+
+ /**
+ * Access (or create) a new environment for the given context.
+ * @param parentEnvironment the parent environment to b e set
+ * @return the environment, or null.
+ */
+ Environment getEnvironment(Environment parentEnvironment);
+
+ /**
+ * Get all currently known environment contexts for this environment type.
+ * @return all currently known environment contexts, never null. Environment
+ * providers may prevent abritrary access to environment from outside of the
+ * regarding runtime context by just not including the context information
+ * in this call's result.
+ * @return all currently known environment contexts, never null.
+ */
+ Set<String> getEnvironmentContexts();
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/ExpressionEvaluator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/ExpressionEvaluator.java b/core/src/main/java/org/apache/tamaya/core/spi/ExpressionEvaluator.java
new file mode 100644
index 0000000..f46d69c
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/ExpressionEvaluator.java
@@ -0,0 +1,27 @@
+/*
+ * 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.core.spi;
+
+/**
+ * Created by Anatole on 12.10.2014.
+ */
+@FunctionalInterface
+public interface ExpressionEvaluator {
+ String evaluate(String expression);
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/ExpressionResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/ExpressionResolver.java b/core/src/main/java/org/apache/tamaya/core/spi/ExpressionResolver.java
new file mode 100644
index 0000000..f2a32b7
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/ExpressionResolver.java
@@ -0,0 +1,50 @@
+/*
+ * 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.core.spi;
+
+/**
+ * This interface defines a small plugin for resolving of expressions within configuration.
+ * Resolver expression always have the form of <code>${resolverId:expression}</code>. The
+ * {@code resolverId} hereby references the resolver to be used to replace the according
+ * {@code expression}. Also it is well possible to mix different resolvers, e.g. using
+ * an expression like <code>${ref1:expression1} bla bla ${ref2:expression2}</code>.
+ * Finally when no resolver id is passed, the default resolver should be used.
+ */
+public interface ExpressionResolver {
+
+ /**
+ * Get a (unique) resolver id used as a prefix for qualifying the resolver to be used for
+ * resolving an expression.
+ *
+ * @return the (unique) resolver id, never null, not empty.
+ */
+ String getResolverId();
+
+ /**
+ * Resolve the expression. The expression should be stripped from any surrounding parts.
+ * E.g. <code>${myresolver:blabla to be interpreted AND executed.}</code> should be passed
+ * as {@code blabla to be interpreted AND executed.} only.
+ *
+ * @param expression the stripped expression.
+ * @return the resolved expression.
+ * @throws org.apache.tamaya.ConfigException when the expression passed is not resolvable, e.g. due to syntax issues
+ * or data not present or valid.
+ */
+ String resolve(String expression);
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/ObjectConfiguratorService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/ObjectConfiguratorService.java b/core/src/main/java/org/apache/tamaya/core/spi/ObjectConfiguratorService.java
new file mode 100644
index 0000000..e26aa07
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/ObjectConfiguratorService.java
@@ -0,0 +1,37 @@
+/*
+ * 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.core.spi;
+
+
+import org.apache.tamaya.Configuration;
+
+/**
+ * Service used for resolving configuration annotations.
+ */
+public interface ObjectConfiguratorService{
+
+ /**
+ * Inject fields annotated for configuration.
+ *
+ * @param instance
+ * The instance to be configured.
+ */
+ void configure(Object instance, Configuration configuration);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java b/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java
new file mode 100644
index 0000000..fef8c9c
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java
@@ -0,0 +1,63 @@
+/*
+ * 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.core.spi;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tamaya.PropertyAdapter;
+
+public interface PropertyAdapterService{
+
+ public default PropertyAdapter<URL> getURLAdapter(){
+ return PropertyAdapter.class.cast(getClassAdapter(URL.class));
+ }
+
+ public default PropertyAdapter<InputStream> getClasspathResourceAdapter(){
+ return PropertyAdapter.class.cast(getClassAdapter(InputStream.class));
+ }
+
+ public default PropertyAdapter<File> getFileAdapter(){
+ return PropertyAdapter.class.cast(getClassAdapter(File.class));
+ }
+
+ public default PropertyAdapter<Set<String>> getSetAdapter(){
+ return PropertyAdapter.class.cast(getClassAdapter(Set.class));
+ }
+
+ public default PropertyAdapter<Map<String, String>> getMapAdapter(){
+ return PropertyAdapter.class.cast(getClassAdapter(Map.class));
+ }
+
+ public default PropertyAdapter<List<String>> getListAdapter(){
+ return PropertyAdapter.class.cast(getClassAdapter(List.class));
+ }
+
+ public default <T> PropertyAdapter<Class<? extends T>> getClassAdapter(Class<T> requiredType){
+ return getClassAdapter(requiredType, Thread.currentThread().getContextClassLoader());
+ }
+
+ public <T> PropertyAdapter<Class<? extends T>> getClassAdapter(Class<T> requiredType,
+ ClassLoader... classLoaders);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java b/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java
new file mode 100644
index 0000000..2cca547
--- /dev/null
+++ b/core/src/main/java/org/apache/tamaya/core/spi/ResourceLoader.java
@@ -0,0 +1,86 @@
+/*
+ * 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.core.spi;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Stream;
+
+/**
+ * Interface to be implemented by containers that decouples loading of classpath resources from the effective
+ * classloader architecture of a runtime environment. Implementations of this class encapsulate the mechanism of
+ * determining the
+ * concrete resources available base on an expression defining the configuration
+ * locations. A an example the expression {@code cfg/global/*.xml} defines a
+ * location for reading global configuration in the classpath. A resources
+ * interprets this expression and evaluates the concrete resources to be read,
+ * e.g. {@code cfg/global/default.xml, cfg/global/myApp.xml}.
+ * Created by Anatole on 16.06.2014.
+ */
+public interface ResourceLoader{
+
+ /**
+ * Get the prefixes supportedby this loader.
+ *
+ * @return the supported prefixes, not empty.
+ */
+ Collection<String> getResolverIds();
+
+ /**
+ * Called, when a given expression has to be resolved.
+ *
+ * @param expressions the expressions to be resolved, not empty.
+ * @return the corresponding collection of {@link java.net.URI}s defining the
+ * concrete resources to be read by a {@link org.apache.tamaya.core.spi.ConfigurationFormat}
+ * .
+ */
+ List<URI> getResources(String... expressions);
+
+ /**
+ * Called, when a given expression has to be resolved.
+ *
+ * @param expressions the expressions to be resolved, not empty.
+ * @return the corresponding collection of {@link java.net.URI}s defining the
+ * concrete resources to be read by a {@link org.apache.tamaya.core.spi.ConfigurationFormat}
+ * .
+ */
+ List<URI> getResources(Stream<String> expressions);
+
+ /**
+ * Called, when a given expression has to be resolved.
+ *
+ * @param expressions the expressions to be resolved, not empty.
+ * @return the corresponding collection of {@link java.net.URI}s defining the
+ * concrete resources to be read by a {@link org.apache.tamaya.core.spi.ConfigurationFormat}
+ * .
+ */
+ List<URI> getResources(ClassLoader classLoader, String... expressions);
+
+ /**
+ * Called, when a given expression has to be resolved.
+ *
+ * @param expressions the expressions to be resolved, not empty.
+ * @return the corresponding collection of {@link java.net.URI}s defining the
+ * concrete resources to be read by a {@link org.apache.tamaya.core.spi.ConfigurationFormat}
+ * .
+ */
+ List<URI> getResources(ClassLoader classLoader, Stream<String> expressions);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/java-config-1.0.0.xsd
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/java-config-1.0.0.xsd b/core/src/main/resources/META-INF/java-config-1.0.0.xsd
new file mode 100644
index 0000000..dbc0d67
--- /dev/null
+++ b/core/src/main/resources/META-INF/java-config-1.0.0.xsd
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://java-config.java.net/metamodel/1.0.0"
+ xmlns:tns="http://java-config.java.net/metamodel/1.0.0"
+ elementFormDefault="qualified">
+
+ <element name="java-config">
+ <complexType>
+ <sequence>
+ <element name="metaModel" minOccurs="1" maxOccurs="1">
+ <complexType>
+ <sequence>
+ <element name="configParts">
+ <complexType>
+ <sequence>
+ <element name="configPart" type="tns:configPart" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ <attribute name="id" type="string"></attribute>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="configPart">
+ <sequence>
+ <sequence>
+ <element name="properties" type="tns:properties"></element>
+ </sequence>
+ <sequence>
+ <element name="childParts" type="tns:childParts"></element>
+ </sequence>
+ </sequence>
+ <attribute name="key" type="string"></attribute>
+ <attribute name="partType" type="string"></attribute>
+ <attribute name="propertyMapSpec" type="string"></attribute>
+ </complexType>
+
+ <complexType name="properties">
+ <sequence>
+ <element name="comment" type="tns:entry"></element>
+ <element name="entry" type="tns:entry"></element>
+ </sequence>
+ </complexType>
+ <complexType name="entry">
+ <attribute name="key" type="string"></attribute>
+ </complexType>
+
+ <complexType name="childParts">
+ <sequence>
+ <element name="childPart" type="tns:entry">
+ <complexType>
+ <attribute name="psrtType" type="string"></attribute>
+ <attribute name="keyRef" type="string"></attribute>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+</schema>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/java-config.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/java-config.xml b/core/src/main/resources/META-INF/java-config.xml
new file mode 100644
index 0000000..045091b
--- /dev/null
+++ b/core/src/main/resources/META-INF/java-config.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<java-config xmlns="http://java.net/projects/javaconfig/java-config/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="java-config-1.0.0.xsd">
+ <metaModel id="default">
+ <configParts>
+ <configPart key="sys-properties" partType="javax.config.PropertyMap" propertyMapSpec="org.apache.tamaya.core.properties.SystemPropertiesPropertyMap"/>
+ <configPart key="env-properties" partType="javax.config.PropertyMap" propertyMapSpec="org.apache.tamaya.core.properties.EnvironmentPropertyMap"/>
+ <configPart key="--system--" partType="org.apache.tamaya.Configuration" propertyMapSpec="union">
+ <childPart partType="javax.config.PropertyMap" keyRef="sys-properties"/>
+ <childPart partType="javax.config.PropertyMap" keyRef="env-properties"/>
+ </configPart>
+ </configParts>
+ </metaModel>
+</java-config>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/meta-model.properties
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/meta-model.properties b/core/src/main/resources/META-INF/meta-model.properties
new file mode 100644
index 0000000..dfff972
--- /dev/null
+++ b/core/src/main/resources/META-INF/meta-model.properties
@@ -0,0 +1,39 @@
+#
+# 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.
+#
+
+## Register default configuration formats
+format.xml-properties.spec=org.apache.tamaya.org.apache.tamaya.internal.format.PropertiesXmlFormat
+format.properties.spec=org.apache.tamaya.org.apache.tamaya.internal.format.PropertiesFormat
+
+## Define default readers (reading sources)
+reader.classpath.spec=org.apache.tamaya.core.properties.ClasspathPropertyProvider
+reader.file.spec=org.apache.tamaya.core.properties.FilePropertyMap
+
+## Define property maps
+propertymap.environment.spec=union
+propertymap.environment.policy=override
+propertymap.environment.content=env-props[/env],sys-props[/sys],cli[/cli],network[/net]
+propertymap.env-props.spec=org.apache.tamaya.core.properties.EnvironmentPropertyMap
+propertymap.sys-props.spec=org.apache.tamaya.core.properties.SystemPropertiesPropertyMap
+propertymap.network.spec=org.apache.tamaya.core.properties.NetworkPropertyMap
+propertymap.cli.spec=org.apache.tamaya.core.properties.CLIPropertyMap
+
+## Define root configurations
+configuration.default.content=environment[/]
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.core.internal.resources.PathResolver
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.internal.resources.PathResolver b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.internal.resources.PathResolver
new file mode 100644
index 0000000..e8ba016
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.internal.resources.PathResolver
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+org.apache.tamaya.core.internal.resources.AntPathClasspathResolver
+org.apache.tamaya.core.internal.resources.AntPathClasspathsResolver
+org.apache.tamaya.core.internal.resources.AntPathFileResolver
+org.apache.tamaya.core.internal.resources.AntPathFilesResolver
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormat
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormat b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormat
new file mode 100644
index 0000000..39e5aad
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormat
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+org.apache.tamaya.core.internal.format.PropertiesFormat
+org.apache.tamaya.core.internal.format.PropertiesXmlFormat
+org.apache.tamaya.core.internal.format.IniFormat
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormatsSingletonSpi
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormatsSingletonSpi b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormatsSingletonSpi
new file mode 100644
index 0000000..598520b
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormatsSingletonSpi
@@ -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 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.
+#
+org.apache.tamaya.core.internal.format.DefaultConfigFormatsSingletonSpi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationProviderSpi b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationProviderSpi
new file mode 100644
index 0000000..6891ff4
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationProviderSpi
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy 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.
+#
+org.apache.tamaya.core.internal.DefaultConfigProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.EnvironmentProvider
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.EnvironmentProvider b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.EnvironmentProvider
new file mode 100644
index 0000000..dd5e129
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.EnvironmentProvider
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+org.apache.tamaya.core.internal.env.InitialEnvironmentProvider
+org.apache.tamaya.core.internal.env.SystemClassLoaderEnvironmentProvider
+org.apache.tamaya.core.internal.env.ClassLoaderDependentEarEnvironmentProvider
+org.apache.tamaya.core.internal.env.ClassLoaderDependentApplicationEnvironmentProvider
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ExpressionResolver
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ExpressionResolver b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ExpressionResolver
new file mode 100644
index 0000000..c8a55bf
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ExpressionResolver
@@ -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 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.
+#
+org.apache.tamaya.core.internal.el.SystemPropertyResolver
+org.apache.tamaya.core.internal.el.EnvironmentPropertyResolver
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ResourceLoader
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ResourceLoader b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ResourceLoader
new file mode 100644
index 0000000..6472947
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ResourceLoader
@@ -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 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.
+#
+org.apache.tamaya.core.internal.resources.DefaultPathResourceLoader
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationManagerSingletonSpi
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationManagerSingletonSpi b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationManagerSingletonSpi
new file mode 100644
index 0000000..34847a4
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationManagerSingletonSpi
@@ -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 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.
+#
+org.apache.tamaya.core.internal.DefaultConfigurationManagerSingletonSpi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.EnvironmentManagerSingletonSpi
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.EnvironmentManagerSingletonSpi b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.EnvironmentManagerSingletonSpi
new file mode 100644
index 0000000..bb7aacc
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.EnvironmentManagerSingletonSpi
@@ -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 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.
+#
+org.apache.tamaya.core.internal.env.SingleEnvironmentManager
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdaptersSingletonSpi
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdaptersSingletonSpi b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdaptersSingletonSpi
new file mode 100644
index 0000000..44814d9
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdaptersSingletonSpi
@@ -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 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.
+#
+org.apache.tamaya.core.internal.DefaultPropertyAdaptersSingletonSpi
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/cf59ebbd/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.StagesSingletonSpi
----------------------------------------------------------------------
diff --git a/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.StagesSingletonSpi b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.StagesSingletonSpi
new file mode 100644
index 0000000..75f2dad
--- /dev/null
+++ b/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.StagesSingletonSpi
@@ -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 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.
+#
+org.apache.tamaya.core.internal.DefaultStagesSingletonSpi