You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by st...@apache.org on 2014/12/27 14:57:53 UTC
[09/34] incubator-tamaya git commit: first step: move all sources to
a 'dormant' directory
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormatSpi.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormatSpi.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormatSpi.java
new file mode 100644
index 0000000..1c41820
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationFormatSpi.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.core.properties.ConfigurationFormat;
+import org.apache.tamaya.core.resource.Resource;
+
+import java.util.Collection;
+
+/**
+ * Created by Anatole on 17.09.2014.
+ */
+public interface ConfigurationFormatSpi {
+ /**
+ * Access a {@link org.apache.tamaya.core.properties.ConfigurationFormat}.
+ *
+ * @param formatName the format name
+ * @return the corresponding {@link org.apache.tamaya.core.properties.ConfigurationFormat}, or {@code null}, if
+ * not available for the given environment.
+ */
+ ConfigurationFormat getFormat(String formatName);
+
+ /**
+ * Get a collection current the keys current the registered {@link org.apache.tamaya.core.properties.ConfigurationFormat} instances.
+ *
+ * @return a collection current the keys current 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(Resource 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/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationProviderSpi.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationProviderSpi.java
new file mode 100644
index 0000000..e60a53d
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ConfigurationProviderSpi.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.core.spi;
+
+import org.apache.tamaya.Configuration;
+
+/**
+* This configuration provider SPI allows to register the effective factory logic to of and manage a configuration
+* instance. Hereby the qualifiers determine the type current configuration. By default
+*/
+public interface ConfigurationProviderSpi{
+
+ /**
+ * Returns the name current the configuration provided.
+ * @return the name current 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();
+
+ /**
+ * Reloads the provider for the current context.
+ */
+ void reload();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/DefaultServiceComparator.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/DefaultServiceComparator.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/DefaultServiceComparator.java
new file mode 100644
index 0000000..2fb719c
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/DefaultServiceComparator.java
@@ -0,0 +1,85 @@
+/*
+ * 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.util.*;
+
+/**
+ * Simple comparator based on a Collection of {@link OrdinalProvider} instances.
+ */
+final class DefaultServiceComparator implements Comparator<Object>{
+
+ /**
+ * List of ordinal providers loaded.
+ */
+ private List<OrdinalProvider> ordinalProviders = new ArrayList<>();
+
+ DefaultServiceComparator(Collection<? extends OrdinalProvider> providers){
+ ordinalProviders.addAll(Objects.requireNonNull(providers));
+ ordinalProviders.sort(this::compare);
+ }
+
+ private int compare(OrdinalProvider provider1, OrdinalProvider provider2){
+ int o1 = getOrdinal(provider1);
+ int o2 = getOrdinal(provider2);
+ int order = o1-o2;
+ if(order < 0){
+ return -1;
+ }
+ else if(order > 0){
+ return 1;
+ }
+ return 0;
+ }
+
+ private int getOrdinal(OrdinalProvider provider){
+ if(provider instanceof Orderable){
+ return ((Orderable)provider).order();
+ }
+ return 0;
+ }
+
+ public int getOrdinal(Object service){
+ for(OrdinalProvider provider: ordinalProviders){
+ OptionalInt ord = provider.getOrdinal(service.getClass());
+ if(ord.isPresent()){
+ return ord.getAsInt();
+ }
+ }
+ if(service instanceof Orderable){
+ return ((Orderable)service).order();
+ }
+ return 0;
+ }
+
+
+ @Override
+ public int compare(Object o1, Object o2) {
+ int ord1 = getOrdinal(o1);
+ int ord2 = getOrdinal(o2);
+ int order = ord1-ord2;
+ if(order < 0){
+ return -1;
+ }
+ else if(order > 0){
+ return 1;
+ }
+ return 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/DefaultServiceContextProvider.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/DefaultServiceContextProvider.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/DefaultServiceContextProvider.java
new file mode 100644
index 0000000..9a2fb1b
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/DefaultServiceContextProvider.java
@@ -0,0 +1,112 @@
+/*
+ * 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.spi.ServiceContext;
+
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * This class implements the (default) {@link org.apache.tamaya.spi.ServiceContext} interface and hereby uses the JDK
+ * {@link java.util.ServiceLoader} to load the services required.
+ */
+@SuppressWarnings({"rawtypes", "unchecked"})
+class DefaultServiceContextProvider implements ServiceContext {
+ /** List current services loaded, per class. */
+ private final ConcurrentHashMap<Class, List<Object>> servicesLoaded = new ConcurrentHashMap<>();
+ /** Singletons. */
+ private final ConcurrentHashMap<Class, Optional<?>> singletons = new ConcurrentHashMap<>();
+ /** Comparator for ordering of multiple services found. */
+ private DefaultServiceComparator serviceComparator;
+
+ public DefaultServiceContextProvider(){
+ serviceComparator = new DefaultServiceComparator(getServices(OrdinalProvider.class, Collections.emptyList()));
+ }
+
+ @Override
+ public <T> Optional<T> getService(Class<T> serviceType) {
+ Optional<T> cached = (Optional<T>)singletons.get(serviceType);
+ if(cached==null) {
+ List<? extends T> services = getServices(serviceType, Collections.emptyList());
+ if (services.isEmpty()) {
+ cached = Optional.empty();
+ }
+ else{
+ cached = Optional.of(services.get(0));
+ }
+ singletons.put(serviceType, cached);
+ }
+ return cached;
+ }
+
+ /**
+ * Loads and registers services.
+ *
+ * @param serviceType
+ * The service type.
+ * @param <T>
+ * the concrete type.
+ * @param defaultList
+ * the list current items returned, if no services were found.
+ * @return the items found, never {@code null}.
+ */
+ @Override
+ public <T> List<? extends T> getServices(final Class<T> serviceType, final List<? extends T> defaultList) {
+ List<T> found = (List<T>) servicesLoaded.get(serviceType);
+ if (found != null) {
+ return found;
+ }
+ return loadServices(serviceType, defaultList);
+ }
+
+ /**
+ * Loads and registers services.
+ *
+ * @param serviceType The service type.
+ * @param <T> the concrete type.
+ * @param defaultList the list current items returned, if no services were found.
+ *
+ * @return the items found, never {@code null}.
+ */
+ private <T> List<? extends T> loadServices(final Class<T> serviceType, final List<? extends T> defaultList) {
+ try {
+ List<T> services = new ArrayList<>();
+ for (T t : ServiceLoader.load(serviceType)) {
+ services.add(t);
+ }
+ if(services.isEmpty()){
+ services.addAll(defaultList);
+ }
+ if(!serviceType.equals(OrdinalProvider.class)) {
+ services.sort(serviceComparator);
+ }
+ services = Collections.unmodifiableList(services);
+ final List<T> previousServices = (List<T>) servicesLoaded.putIfAbsent(serviceType, (List<Object>)services);
+ return previousServices != null ? previousServices : services;
+ } catch (Exception e) {
+ Logger.getLogger(DefaultServiceContextProvider.class.getName()).log(Level.WARNING,
+ "Error loading services current type " + serviceType, e);
+ return defaultList;
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/ExpressionEvaluator.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/ExpressionEvaluator.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ExpressionEvaluator.java
new file mode 100644
index 0000000..5baa956
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ExpressionEvaluator.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.core.spi;
+
+import org.apache.tamaya.Configuration;
+
+/**
+ * This interfaces provides a model for expression evaluation. This enables transparently plugin expression languages
+ * as needed. In a Java EE context full fledged EL may be used, whereas in ME only simple replacement mechanisms
+ * are better suited to the runtime requirements.
+ */
+@FunctionalInterface
+public interface ExpressionEvaluator {
+ /**
+ * Evaluates the given expression.
+ * @param expression the expression to be evaluated, not null.
+ * @param configurations the configurations to be used for evaluating the values for injection into {@code instance}.
+ * If no items are passed, the default configuration is used.
+ * @return the evaluated expression.
+ */
+ String evaluate(String expression, Configuration... configurations);
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/ExpressionResolver.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/ExpressionResolver.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ExpressionResolver.java
new file mode 100644
index 0000000..a6ba9bb
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ExpressionResolver.java
@@ -0,0 +1,55 @@
+/*
+ * 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 interface defines a small plugin for resolving current expressions within configuration.
+ * Resolver expression always have the form current <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 fromMap 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.
+ * @param configurations overriding configurations to be used for evaluating the values for injection into {@code instance}.
+ * If no such config is passed, the default configurations provided by the current
+ * registered providers are used.
+ * @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, Configuration... configurations);
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/ObjectConfiguratorSpi.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/ObjectConfiguratorSpi.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ObjectConfiguratorSpi.java
new file mode 100644
index 0000000..9f38792
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/ObjectConfiguratorSpi.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 ObjectConfiguratorSpi {
+
+ /**
+ * 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/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/Orderable.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/Orderable.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/Orderable.java
new file mode 100644
index 0000000..5397776
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/Orderable.java
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+/**
+ * Interface that can be optionally implemented by SPI components to be loaded into
+ * the Tamaya's ServiceContext. The ordinal provided will be used to determine
+ * priority and precedence, when multiple components implement the same
+ * service interface.
+ */
+@FunctionalInterface
+public interface Orderable {
+ /**
+ * Get the ordinal keys for the component, by default 0.
+ * @return the ordinal keys
+ */
+ int order();
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/OrdinalProvider.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/OrdinalProvider.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/OrdinalProvider.java
new file mode 100644
index 0000000..2d7f057
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/OrdinalProvider.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 java.util.OptionalInt;
+
+/**
+ * The ordinal provider is an optional component that provides an abstraction for ordering/prioritizing
+ * services loaded. This can be used to determine, which SPI should be used, if multiple instances are
+ * available, or for ordering chain of services.
+ * @see org.apache.tamaya.spi.ServiceContext
+ */
+public interface OrdinalProvider {
+ /**
+ * Evaluate the ordinal number for the given type.
+ * @param type the target type, not null.
+ * @return the ordinal, if not defined, 0 should be returned.
+ */
+ OptionalInt getOrdinal(Class<?> type);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/PathResolver.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/PathResolver.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/PathResolver.java
new file mode 100644
index 0000000..04b5b02
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/PathResolver.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.core.spi;
+
+import org.apache.tamaya.core.resource.Resource;
+
+import java.util.Collection;
+
+/**
+ * Created by Anatole on 16.06.2014.
+ */
+public interface PathResolver{
+
+ /**
+ * Get the (unique) resolver prefix.
+ *
+ * @return the resolver prefix, never null.
+ */
+ public String getResolverId();
+
+ /**
+ * Resolve the given expression.
+ *
+ * @param expressions expressions, never null.
+ * @return the resolved URIs, never null.
+ */
+ public Collection<Resource> resolve(ClassLoader classLoader, Collection<String> expressions);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterProviderSpi.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterProviderSpi.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterProviderSpi.java
new file mode 100644
index 0000000..b8e7122
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterProviderSpi.java
@@ -0,0 +1,36 @@
+/*
+ * 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;
+
+/**
+ * This service provides different {@link org.apache.tamaya.PropertyAdapter} instances for types.
+ */
+public interface PropertyAdapterProviderSpi {
+
+ /**
+ * 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> getPropertyAdapter(Class<T> type);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java b/dormant/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java
new file mode 100644
index 0000000..9270636
--- /dev/null
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/spi/PropertyAdapterService.java
@@ -0,0 +1,64 @@
+///*
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// */
+//package org.apache.tamaya.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.Codec;
+//
+//@SuppressWarnings("unchecked")
+//public interface PropertyAdapterService{
+//
+// public default Codec<URL> getURLAdapter(){
+// return Codec.class.cast(getClassAdapter(URL.class));
+// }
+//
+// public default Codec<InputStream> getClasspathResourceAdapter(){
+// return Codec.class.cast(getClassAdapter(InputStream.class));
+// }
+//
+// public default Codec<File> getFileAdapter(){
+// return Codec.class.cast(getClassAdapter(File.class));
+// }
+//
+// public default Codec<Set<String>> getSetAdapter(){
+// return Codec.class.cast(getClassAdapter(Set.class));
+// }
+//
+// public default Codec<Map<String, String>> getMapAdapter(){
+// return Codec.class.cast(getClassAdapter(Map.class));
+// }
+//
+// public default Codec<List<String>> getListAdapter(){
+// return Codec.class.cast(getClassAdapter(List.class));
+// }
+//
+// public default <T> Codec<Class<? extends T>> getClassAdapter(Class<T> requiredType){
+// return getClassAdapter(requiredType, Thread.currentThread().getContextClassLoader());
+// }
+//
+// public <T> Codec<Class<? extends T>> getClassAdapter(Class<T> requiredType,
+// ClassLoader... classLoaders);
+//
+//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.config.ConfigurationFormat
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.config.ConfigurationFormat b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.config.ConfigurationFormat
new file mode 100644
index 0000000..7aa2407
--- /dev/null
+++ b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.config.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 current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.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/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.resource.ResourceLoader
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.resource.ResourceLoader b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.resource.ResourceLoader
new file mode 100644
index 0000000..c245d54
--- /dev/null
+++ b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.resource.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 current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.internal.resources.DefaultResourceLoader
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormatSpi
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormatSpi b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormatSpi
new file mode 100644
index 0000000..e81bd2b
--- /dev/null
+++ b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationFormatSpi
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.internal.format.DefaultConfigurationFormatSpi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationProviderSpi b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationProviderSpi
new file mode 100644
index 0000000..9865949
--- /dev/null
+++ b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ConfigurationProviderSpi
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.internal.config.SystemPropertiesConfigProvider
+org.apache.tamaya.core.internal.config.EnvPropertiesConfigProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ExpressionResolver
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ExpressionResolver b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.ExpressionResolver
new file mode 100644
index 0000000..b4499f6
--- /dev/null
+++ b/dormant/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 current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.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/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.PathResolver
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.PathResolver b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.PathResolver
new file mode 100644
index 0000000..e13b388
--- /dev/null
+++ b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.PathResolver
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.internal.resources.AntPathClasspathResolver
+org.apache.tamaya.core.internal.resources.AntPathFileResolver
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.PropertyProviderBuilderSpi
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.PropertyProviderBuilderSpi b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.PropertyProviderBuilderSpi
new file mode 100644
index 0000000..bcab3ea
--- /dev/null
+++ b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.core.spi.PropertyProviderBuilderSpi
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.properties.PropertySourceFactory
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi
new file mode 100644
index 0000000..2764092
--- /dev/null
+++ b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationSpi
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.internal.config.DefaultConfigurationSpi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi
new file mode 100644
index 0000000..0554453
--- /dev/null
+++ b/dormant/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyAdapterSpi
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy current the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.tamaya.core.internal.config.DefaultPropertyAdapterSpi
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/resources/log4j2.xml b/dormant/core/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..22e9c16
--- /dev/null
+++ b/dormant/core/src/main/resources/log4j2.xml
@@ -0,0 +1,31 @@
+<?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 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.
+-->
+<Configuration status="WARN">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="warn">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java b/dormant/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
new file mode 100644
index 0000000..2ee83a9
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/DefaultConfigurationManagerSingletonSpiSingletonSpiTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tamaya.annotation.ConfiguredProperty;
+import org.apache.tamaya.annotation.DefaultValue;
+import org.apache.tamaya.core.internal.config.DefaultConfigurationSpi;
+import org.junit.Test;
+
+/**
+ * Test class for {@link org.apache.tamaya.core.internal.config.DefaultConfigurationSpi}.
+ */
+public class DefaultConfigurationManagerSingletonSpiSingletonSpiTest {
+
+
+ @Test
+ public void testSEConfigurationService() {
+ new DefaultConfigurationSpi();
+ }
+
+ @Test
+ public void testGetConfigurationString() {
+ Configuration config = Configuration.current("default");
+ assertNotNull(config);
+ assertTrue(config.toString().contains("default"));
+ assertNotNull(config.getName());
+ assertTrue(config.getName().contains("default"));
+ System.out.println("CONFIG: " + config);
+ assertEquals(System.getProperty("java.version"),
+ config.get("java.version").get());
+
+ config = Configuration.current("system.properties");
+ assertNotNull(config);
+ assertNotNull(config.getName());
+ assertTrue(config.getName().contains("system.properties"));
+ assertEquals(System.getProperty("java.version"),
+ config.get("java.version").get());
+ }
+
+ @Test
+ public void testIsConfigurationDefined() {
+ assertTrue(Configuration.isAvailable("test"));
+ assertFalse(Configuration.isAvailable("sdksajdsajdlkasj dlkjaslkd"));
+ }
+
+ @Test
+ public void testAddRemoveGlobalConfigChangeListener() {
+// Configuration.addConfigChangeListener(LISTENER);
+// Configuration.removeConfigChangeListener(LISTENER);
+// Configuration.addConfigChangeListener(LISTENER);
+// Configuration.addConfigChangeListener(LISTENER);
+// Configuration.removeConfigChangeListener(LISTENER);
+// Configuration.removeConfigChangeListener(LISTENER);
+// Configuration.removeConfigChangeListener(LISTENER);
+ }
+
+ @Test
+ public void testConfigure() {
+ ConfigureTest test = new ConfigureTest();
+ Configuration.configure(test);
+ assertEquals(test.mustBeTrue, true);
+ assertEquals(test.val1, "YES, it works!");
+ }
+
+ private static class ConfigureTest {
+ @ConfiguredProperty
+ @DefaultValue("YES, it works!")
+ String val1;
+
+ @ConfiguredProperty
+ @DefaultValue("true")
+ boolean mustBeTrue;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/JavaOneDemo.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/JavaOneDemo.java b/dormant/core/src/test/java/org/apache/tamaya/JavaOneDemo.java
new file mode 100644
index 0000000..77cbf94
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/JavaOneDemo.java
@@ -0,0 +1,74 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tamaya.core.ConfigurationFunctions;
+import org.apache.tamaya.core.properties.PropertySourceBuilder;
+import org.junit.Test;
+
+/**
+ * Created by Anatole on 30.09.2014.
+ */
+public class JavaOneDemo {
+
+ @Test
+ public void testFromSystemProperties() {
+ PropertySource prov = PropertySourceBuilder.of("Sys-conf").addSystemProperties().build();
+ assertNotNull(prov);
+ for (Map.Entry<Object, Object> en : System.getProperties().entrySet()) {
+ assertEquals(en.getValue(), prov.get(en.getKey().toString()).get());
+ }
+ }
+
+ @Test
+ public void testProgrammatixPropertySet() {
+ System.out.println(PropertySourceBuilder.of("test").addPaths("test", "classpath:test.properties"));
+ }
+
+ @Test
+ public void testProgrammaticConfig() {
+// ConfigurationFormat format = ConfigurationFormats.getPropertiesFormat();
+ Map<String, String> cfgMap = new HashMap<>();
+ cfgMap.put("param1", "value1");
+ cfgMap.put("a", "Adrian"); // overrides Anatole
+ Configuration config = Configuration.from(PropertySourceBuilder.of("myTestConfig").addPaths(
+ "classpath:test.properties").addPaths("classpath:cfg/test.xml")
+ .addArgs(new String[]{"-arg1", "--fullarg", "fullValue", "-myflag"})
+ .addMap(cfgMap).build());
+ System.out.println(config.query(ConfigurationFunctions.getAreas()));
+ System.out.println("---");
+ System.out.println(config.query(ConfigurationFunctions.getAreas(s -> s.startsWith("another"))));
+ System.out.println("---");
+ System.out.println(config.query(ConfigurationFunctions.getTransitiveAreas()));
+ System.out.println("---");
+ System.out.println(config.query(ConfigurationFunctions.getTransitiveAreas(s -> s.startsWith("another"))));
+ System.out.println("---");
+ System.out.println(config);
+ System.out.print("--- b=");
+ System.out.println(config.get("b"));
+// System.out.println("--- only a,b,c)");
+// System.out.println(PropertySourceBuilder.of(config).filter((f) -> f.equals("a") || f.equals("b") || f.equals("c")).build());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/core/config/ConfiguredSystemPropertiesTest.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/core/config/ConfiguredSystemPropertiesTest.java b/dormant/core/src/test/java/org/apache/tamaya/core/config/ConfiguredSystemPropertiesTest.java
new file mode 100644
index 0000000..7790d8b
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/core/config/ConfiguredSystemPropertiesTest.java
@@ -0,0 +1,94 @@
+///*
+// * 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.config;
+//
+//import static org.junit.Assert.assertTrue;
+//
+//import java.util.Properties;
+//
+//import org.apache.tamaya.core.env.ConfiguredSystemProperties;
+//import org.junit.Test;
+//
+///**
+// * Created by Anatole on 02.10.2014.
+// */
+//public class ConfiguredSystemPropertiesTest {
+//
+// @Test
+// public void testInstall(){
+//// Configuration config = Configuration.current();
+// Properties props = System.getProperties();
+// assertTrue(props.getClass().getName().equals(Properties.class.getName()));
+// System.out.println("Props("+props.getClass().getName()+"): " + props);
+// ConfiguredSystemProperties.install();
+// props = System.getProperties();
+// System.out.println("Props("+props.getClass().getName()+"): " + props);
+// assertTrue(props.getClass().getName().equals(ConfiguredSystemProperties.class.getName()));
+// ConfiguredSystemProperties.uninstall();
+// props = System.getProperties();
+// assertTrue(props.getClass().getName().equals(Properties.class.getName()));
+// }
+//}
+///*
+// * 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.config;
+//
+//import static org.junit.Assert.assertTrue;
+//
+//import java.util.Properties;
+//
+//import org.apache.tamaya.core.env.ConfiguredSystemProperties;
+//import org.junit.Test;
+//
+///**
+// * Created by Anatole on 02.10.2014.
+// */
+//public class ConfiguredSystemPropertiesTest {
+//
+// @Test
+// public void testInstall(){
+//// Configuration config = Configuration.current();
+// Properties props = System.getProperties();
+// assertTrue(props.getClass().getName().equals(Properties.class.getName()));
+// System.out.println("Props("+props.getClass().getName()+"): " + props);
+// ConfiguredSystemProperties.install();
+// props = System.getProperties();
+// System.out.println("Props("+props.getClass().getName()+"): " + props);
+// assertTrue(props.getClass().getName().equals(ConfiguredSystemProperties.class.getName()));
+// ConfiguredSystemProperties.uninstall();
+// props = System.getProperties();
+// assertTrue(props.getClass().getName().equals(Properties.class.getName()));
+// }
+//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/core/config/MutableConfigTest.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/core/config/MutableConfigTest.java b/dormant/core/src/test/java/org/apache/tamaya/core/config/MutableConfigTest.java
new file mode 100644
index 0000000..b02a58f
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/core/config/MutableConfigTest.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.config;
+//
+//import org.apache.tamaya.Configuration;
+//import org.junit.Test;
+//
+//import java.beans.PropertyChangeEvent;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+//import static org.junit.Assert.assertFalse;
+//
+///**
+// * Simple test for a mutable Configuration instance.
+// */
+//public class MutableConfigTest {
+//
+// @Test
+// public void accessMutableConfig() {
+// Configuration config = Configuration.current("mutableTestConfig");
+// ConfigChangeSet changeSet = ConfigChangeSetBuilder.of(config).put("testCase", "accessMutableConfig")
+// .put("execTime", System.currentTimeMillis()).put("execution", "once").build();
+// List<PropertyChangeEvent> changes = new ArrayList<>();
+// Configuration.addChangeListener(change -> {
+// if (change.getPropertySource() == config) {
+// changes.addAll(change.getEvents());
+// }
+// });
+// config.applyChanges(changeSet);
+// assertFalse(changes.isEmpty());
+// System.out.println(changes);
+// }
+//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/core/internal/config/FilesPropertiesConfigProviderTest.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/core/internal/config/FilesPropertiesConfigProviderTest.java b/dormant/core/src/test/java/org/apache/tamaya/core/internal/config/FilesPropertiesConfigProviderTest.java
new file mode 100644
index 0000000..5aeeec5
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/core/internal/config/FilesPropertiesConfigProviderTest.java
@@ -0,0 +1,69 @@
+package org.apache.tamaya.core.internal.config;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.core.spi.ConfigurationProviderSpi;
+import org.junit.Before;
+import org.junit.Test;
+
+public class FilesPropertiesConfigProviderTest {
+
+
+ private ConfigurationProviderSpi configurationProvider;
+
+ @Before
+ public void init() throws InterruptedException {
+ configurationProvider = new FilesPropertiesConfigProvider();
+ }
+
+ @Test
+ public void getTest() throws InterruptedException{
+ Configuration configuration = configurationProvider.getConfiguration();
+ assertEquals(configuration.get("team").get(), "Bahia");
+ assertFalse(configuration.get("ignore").isPresent());
+ }
+
+ @Test
+ public void shouldUpdateAsync() throws Exception {
+ createPropertiesFile("newFile.properties", "language=java");
+ Configuration configuration = configurationProvider.getConfiguration();
+
+ Thread.sleep(100L);
+ assertEquals(configuration.get("language").get(), "java");
+
+ }
+
+ @Test
+ public void shoulIgnoreAsync() throws Exception {
+ createPropertiesFile("newFile.ini", "name=otavio");
+ Configuration configuration = configurationProvider.getConfiguration();
+
+ Thread.sleep(100L);
+ assertFalse(configuration.get("otavio").isPresent());
+
+ }
+
+ private void createPropertiesFile(String fileName, String context) throws URISyntaxException,
+ FileNotFoundException, IOException {
+ URL resource = FilesPropertiesConfigProviderTest.class.getResource("/META-INF/configuration/");
+ Path directory = Paths.get(resource.toURI());
+ File file = new File(directory.toFile(), fileName);
+ try (OutputStream stream = new FileOutputStream(file)) {
+ stream.write(context.getBytes());
+ file.deleteOnExit();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/core/properties/PropertySourceBuilderTest.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/core/properties/PropertySourceBuilderTest.java b/dormant/core/src/test/java/org/apache/tamaya/core/properties/PropertySourceBuilderTest.java
new file mode 100644
index 0000000..4a846f9
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/core/properties/PropertySourceBuilderTest.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.PropertySource;
+import org.junit.Test;
+
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Created by Anatole on 30.09.2014.
+ */
+public class PropertySourceBuilderTest {
+
+ @Test
+ public void testFromEnvironmentProperties(){
+ PropertySource prov = PropertySourceBuilder.of("test").addEnvironmentProperties().build();
+ assertNotNull(prov);
+ for(Map.Entry<String,String> en:System.getenv().entrySet()){
+ assertEquals(en.getValue(), prov.get(en.getKey()).get());
+ }
+ }
+
+ @Test
+ public void testFromSystemProperties(){
+ PropertySource prov = PropertySourceBuilder.of("test").addSystemProperties().build();
+ assertNotNull(prov);
+ for(Map.Entry<Object,Object> en:System.getProperties().entrySet()){
+ assertEquals(en.getValue(), prov.get(en.getKey().toString()).get());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/internal/MutableTestConfigProvider.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/internal/MutableTestConfigProvider.java b/dormant/core/src/test/java/org/apache/tamaya/internal/MutableTestConfigProvider.java
new file mode 100644
index 0000000..bf8d709
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/internal/MutableTestConfigProvider.java
@@ -0,0 +1,90 @@
+///*
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// */
+//package org.apache.tamaya.internal;
+//
+//import java.util.Collections;
+//import java.util.HashMap;
+//import java.util.Map;
+//import java.util.concurrent.ConcurrentHashMap;
+//
+//import org.apache.tamaya.Configuration;
+//import org.apache.tamaya.core.spi.ConfigurationProviderSpi;
+//
+///**
+// * Simple test provider that creates a mutable instance of a configuration, just using a simple map instance.
+// */
+//public class MutableTestConfigProvider implements ConfigurationProviderSpi{
+// /** The config name. */
+// private static final String CONFIG_NAME = "mutableTestConfig";
+// /** The config provided. */
+// private MutableConfiguration testConfig;
+//
+// /**
+// * COnsatructor.
+// */
+// public MutableTestConfigProvider(){
+// Map<String, String> dataMap = new HashMap<>();
+// dataMap.put("dad", "Anatole");
+// dataMap.put("mom", "Sabine");
+// dataMap.put("sons.1", "Robin");
+// dataMap.put("sons.2", "Luke");
+// dataMap.put("sons.3", "Benjamin");
+//// PropertySource provider = PropertySourceBuilder.of(CONFIG_NAME).addMap(dataMap).build();
+// testConfig = new MutableConfiguration(dataMap, CONFIG_NAME);
+// }
+//
+// @Override
+// public String getConfigName(){
+// return CONFIG_NAME;
+// }
+//
+// @Override
+// public Configuration getConfiguration(){
+// return testConfig;
+// }
+//
+// @Override
+// public void reload() {
+//
+// }
+//
+// /**
+// * Implements a simple mutable config based on a Mao instance.
+// */
+// private final class MutableConfiguration extends AbstractConfiguration{
+//
+// private static final long serialVersionUID = 8811989470609598218L;
+// private final Map<String,String> data = new ConcurrentHashMap<>();
+//
+// MutableConfiguration(Map<String,String> data, String name){
+// super(name);
+// this.data.putAll(data);
+// }
+//
+// @Override
+// public Map<String, String> getProperties() {
+// return Collections.unmodifiableMap(data);
+// }
+//
+// @Override
+// public Configuration toConfiguration(){
+// return this;
+// }
+// }
+//}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/internal/TestConfigProvider.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/internal/TestConfigProvider.java b/dormant/core/src/test/java/org/apache/tamaya/internal/TestConfigProvider.java
new file mode 100644
index 0000000..ddbe4af
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/internal/TestConfigProvider.java
@@ -0,0 +1,69 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.PropertySource;
+import org.apache.tamaya.core.properties.PropertySourceBuilder;
+import org.apache.tamaya.core.spi.ConfigurationProviderSpi;
+
+import org.apache.tamaya.Configuration;
+
+import java.util.*;
+
+/**
+ * Created by Anatole on 29.09.2014.
+ */
+public class TestConfigProvider implements ConfigurationProviderSpi{
+
+ private Configuration testConfig;
+
+ public TestConfigProvider(){
+ final Map<String,String> config = new HashMap<>();
+ config.put("a.b.c.key1", "keys current a.b.c.key1");
+ config.put("a.b.c.key2", "keys current a.b.c.key2");
+ config.put("a.b.key3", "keys current a.b.key3");
+ config.put("a.b.key4", "keys current a.b.key4");
+ config.put("a.key5", "keys current a.key5");
+ config.put("a.key6", "keys current a.key6");
+ config.put("int1", "123456");
+ config.put("int2", "111222");
+ config.put("booleanT", "true");
+ config.put("double1", "1234.5678");
+ config.put("BD", "123456789123456789123456789123456789.123456789123456789123456789123456789");
+ config.put("testProperty", "keys current testProperty");
+ config.put("runtimeVersion", "${java.version}");
+ testConfig = Configuration.from(PropertySourceBuilder.of("test").addMap(
+ config).build());
+ }
+
+ @Override
+ public String getConfigName(){
+ return "test";
+ }
+
+ @Override
+ public Configuration getConfiguration(){
+ return testConfig;
+ }
+
+ @Override
+ public void reload() {
+ // nothing todo here
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/package-info.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/package-info.java b/dormant/core/src/test/java/org/apache/tamaya/package-info.java
new file mode 100644
index 0000000..cbf5a3d
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/package-info.java
@@ -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 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.
+ */
+
+/**
+ * Created by Anatole on 02.12.2014.
+ */
+package org.apache.tamaya;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/AutoConfiguredClass.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/AutoConfiguredClass.java b/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/AutoConfiguredClass.java
new file mode 100644
index 0000000..f18271a
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/AutoConfiguredClass.java
@@ -0,0 +1,91 @@
+/*
+ * 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.samples.annotations;
+
+import org.apache.tamaya.annotation.DefaultValue;
+import org.apache.tamaya.annotation.NoConfig;
+import org.apache.tamaya.annotation.ObservesConfigChange;
+
+import java.beans.PropertyChangeEvent;
+import java.math.BigDecimal;
+
+/**
+ * Test example of a configured tyĆ¼ that is using default config key resolution.
+ */
+public class AutoConfiguredClass {
+
+ private String testProperty;
+
+ @DefaultValue("The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.")
+ String value1;
+
+ @NoConfig
+ private String value2;
+
+ @DefaultValue("N/A")
+ private String runtimeVersion;
+
+ @DefaultValue("${java.version}")
+ private String javaVersion2;
+
+ @DefaultValue("5")
+ private Integer int1;
+
+ private int int2;
+
+ @ObservesConfigChange
+ public void changeListener1(PropertyChangeEvent configChange){
+ // will be called
+ }
+
+ public String getTestProperty() {
+ return testProperty;
+ }
+
+ public String getValue1() {
+ return value1;
+ }
+
+ public String getValue2() {
+ return value2;
+ }
+
+ public String getRuntimeVersion() {
+ return runtimeVersion;
+ }
+
+ public String getJavaVersion2() {
+ return javaVersion2;
+ }
+
+ public Integer getInt1() {
+ return int1;
+ }
+
+ public int getInt2() {
+ return int2;
+ }
+
+ public String toString(){
+ return super.toString() + ": testProperty="+testProperty+", value1="+value1+", value2="+value2
+ +", int1="+int1+", int2="+int2
+ +", runtimeVersion="+runtimeVersion+", javaVersion2="+javaVersion2;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/AutoConfiguredTest.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/AutoConfiguredTest.java b/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/AutoConfiguredTest.java
new file mode 100644
index 0000000..8b1c7dd
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/AutoConfiguredTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.samples.annotations;
+
+import jdk.nashorn.internal.runtime.regexp.joni.Config;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.core.properties.PropertySourceBuilder;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeTrue;
+
+/**
+ * Created by Anatole on 08.09.2014.
+ */
+public class AutoConfiguredTest {
+
+
+ @Test
+ public void testTemplateWithEnvironmentVariableOnUnixoidSystem(){
+ AutoConfiguredClass config = new AutoConfiguredClass();
+ Configuration.configure(config, Configuration.from(PropertySourceBuilder.of("default").addPaths("classpath:cfg/autoloaded.xml").build()));
+ System.out.println(config);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/ConfigTemplate.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/ConfigTemplate.java b/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/ConfigTemplate.java
new file mode 100644
index 0000000..9dfa5d0
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/ConfigTemplate.java
@@ -0,0 +1,67 @@
+/*
+ * 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.samples.annotations;
+
+import org.apache.tamaya.annotation.ConfiguredProperty;
+import org.apache.tamaya.annotation.DefaultValue;
+
+import java.math.BigDecimal;
+
+/**
+ * Created by Anatole on 08.09.2014.
+ */
+public interface ConfigTemplate {
+
+ @ConfiguredProperty
+ String testProperty();
+
+ @ConfiguredProperty(keys = "Foo")
+ @DefaultValue("The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.")
+ String value1();
+
+ // COMPUTERNAME is only under Windows available
+ @ConfiguredProperty
+ @DefaultValue("${env:COMPUTERNAME}")
+ String computerName();
+
+ @ConfiguredProperty(keys = "HOME")
+ String homeDir();
+
+ @ConfiguredProperty
+ @DefaultValue("N/A")
+ String runtimeVersion();
+
+ @ConfiguredProperty
+ @DefaultValue("${sys:java.version}")
+ String javaVersion2();
+
+ @ConfiguredProperty
+ @DefaultValue("5")
+ Integer int1();
+
+ @ConfiguredProperty
+ @DefaultValue("2233")
+ int int2();
+
+ @ConfiguredProperty
+ boolean booleanT();
+
+ @ConfiguredProperty(keys = "BD")
+ BigDecimal bigNumber();
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d9964c64/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/ConfiguredClass.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/ConfiguredClass.java b/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/ConfiguredClass.java
new file mode 100644
index 0000000..c01ee63
--- /dev/null
+++ b/dormant/core/src/test/java/org/apache/tamaya/samples/annotations/ConfiguredClass.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.samples.annotations;
+
+import org.apache.tamaya.annotation.ObservesConfigChange;
+import org.apache.tamaya.annotation.ConfiguredProperty;
+import org.apache.tamaya.annotation.DefaultValue;
+
+import java.beans.PropertyChangeEvent;
+import java.math.BigDecimal;
+
+/**
+ * Created by Anatole on 08.09.2014.
+ */
+public class ConfiguredClass{
+
+ @ConfiguredProperty
+ private String testProperty;
+
+ @ConfiguredProperty(keys = "a.b.c.key1")
+ @ConfiguredProperty(keys = "a.b.c.key2")
+ @ConfiguredProperty(keys = "a.b.c.key3")
+ @DefaultValue("The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.")
+ String value1;
+
+ @ConfiguredProperty(config="test", keys = "foo")
+ @ConfiguredProperty(keys = "a.b.c.key2")
+ private String value2;
+
+ @ConfiguredProperty
+ @DefaultValue("N/A")
+ private String runtimeVersion;
+
+ @ConfiguredProperty
+ @DefaultValue("${sys:java.version}")
+ private String javaVersion2;
+
+ @ConfiguredProperty
+ @DefaultValue("5")
+ private Integer int1;
+
+ @ConfiguredProperty(config = "test")
+ private int int2;
+
+ @ConfiguredProperty(config = "test")
+ private boolean booleanT;
+
+ @ConfiguredProperty(config="test", keys ="BD")
+ private BigDecimal bigNumber;
+
+ @ObservesConfigChange
+ public void changeListener1(PropertyChangeEvent configChange){
+ // will be called
+ }
+
+ public String getTestProperty() {
+ return testProperty;
+ }
+
+ public String getValue1() {
+ return value1;
+ }
+
+ public String getValue2() {
+ return value2;
+ }
+
+ public String getRuntimeVersion() {
+ return runtimeVersion;
+ }
+
+ public String getJavaVersion2() {
+ return javaVersion2;
+ }
+
+ public Integer getInt1() {
+ return int1;
+ }
+
+ public int getInt2() {
+ return int2;
+ }
+
+ public boolean isBooleanT() {
+ return booleanT;
+ }
+
+ public BigDecimal getBigNumber() {
+ return bigNumber;
+ }
+
+ public String toString(){
+ return super.toString() + ": testProperty="+testProperty+", value1="+value1+", value2="+value2
+ +", int1="+int1+", int2="+int2+", booleanT="+booleanT+", bigNumber="+bigNumber
+ +", runtimeVersion="+runtimeVersion+", javaVersion2="+javaVersion2;
+ }
+
+}