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 2015/01/05 01:37:29 UTC
[2/2] incubator-tamaya git commit: TAMAYA-47: Activate some modules
for overall tamaya build.
TAMAYA-47: Activate some modules for overall tamaya build.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/ed3f7063
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/ed3f7063
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/ed3f7063
Branch: refs/heads/master
Commit: ed3f706387da753ab70748ab087612c6e84d2c83
Parents: 99997f3
Author: anatole <an...@apache.org>
Authored: Mon Jan 5 01:37:01 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Mon Jan 5 01:37:01 2015 +0100
----------------------------------------------------------------------
.../org/apache/tamaya/ConfigurationTest.java | 7 ++
.../src/main/java/old/ConfigurationBuilder.java | 8 +-
.../config/FallbackSimpleConfigProvider.java | 2 +-
.../factories/PropertySourcesBuilder.java | 8 +-
modules/formats/pom.xml | 40 ++++++++
.../tamaya/format/ConfigurationFormat.java | 8 +-
.../apache/tamaya/format/PropertiesFormat.java | 20 ++--
.../tamaya/format/PropertiesXmlFormat.java | 20 ++--
modules/injection/pom.xml | 11 +-
.../tamaya/inject/ConfiguredProperties.java | 4 +-
.../tamaya/inject/ConfiguredProperty.java | 9 +-
.../org/apache/tamaya/inject/DefaultAreas.java | 4 +-
.../org/apache/tamaya/inject/DefaultValue.java | 2 +-
.../org/apache/tamaya/inject/DynamicValue.java | 8 +-
.../org/apache/tamaya/inject/LoadPolicy.java | 2 +-
.../java/org/apache/tamaya/inject/NoConfig.java | 2 +-
.../tamaya/inject/ObservesConfigChange.java | 6 +-
.../tamaya/inject/WithConfigOperator.java | 2 +-
.../apache/tamaya/inject/WithLoadPolicy.java | 4 +-
.../tamaya/inject/WithPropertyAdapter.java | 45 --------
.../tamaya/inject/WithPropertyConverter.java | 46 +++++++++
.../internal/ConfigChangeCallbackMethod.java | 10 +-
.../ConfigTemplateInvocationHandler.java | 4 +-
.../inject/internal/ConfigurationInjector.java | 2 +-
.../tamaya/inject/internal/ConfiguredField.java | 21 ++--
.../inject/internal/ConfiguredSetterMethod.java | 48 ++++-----
.../tamaya/inject/internal/ConfiguredType.java | 2 +-
.../tamaya/inject/internal/InjectionUtils.java | 79 ++++++++++----
.../internal/WeakConfigListenerManager.java | 2 +-
.../inject/spi/ConfigurationFactorySpi.java | 60 -----------
.../tamaya/inject/spi/ConfigurationSpi.java | 98 ------------------
.../tamaya/inject/spi/PropertyAdapterSpi.java | 72 -------------
modules/pom.xml | 8 +-
.../internal/DefaultExpressionEvaluator.java | 7 +-
.../internal/EnvironmentPropertyResolver.java | 2 -
.../internal/ExpressionResolutionFilter.java | 91 +++++++++++++++++
.../internal/SystemPropertyResolver.java | 1 -
.../resolver/spi/ExpressionEvaluator.java | 17 ++++
.../tamaya/resolver/spi/ExpressionResolver.java | 2 -
...ache.tamaya.resolver.spi.ExpressionEvaluator | 19 ++++
.../tamaya/resolver/MyResolutionTest.java | 18 ++++
.../tamaya/resolver/MyTestPropertySource.java | 18 ++++
...AbstractPathBasedPropertySourceProvider.java | 91 +++++++++++++++++
.../AbstractResourcePropertySourceProvider.java | 101 ++++++++++++++++++
.../PathBasedPropertySourceProvider.java | 93 -----------------
.../org/apache/tamaya/resource/Resource.java | 13 +--
.../apache/tamaya/resource/ResourceLoader.java | 90 ----------------
.../ResourcePropertySourceProvider.java | 102 -------------------
.../tamaya/resource/ResourceResolver.java | 90 ++++++++++++++++
.../resource/internal/ClassPathResource.java | 27 +++--
.../internal/DefaultResourceLoader.java | 93 -----------------
.../internal/DefaultResourceResolver.java | 93 +++++++++++++++++
.../tamaya/resource/internal/FileResource.java | 18 +++-
.../resource/internal/InputStreamResource.java | 4 +-
.../tamaya/resource/internal/UrlResource.java | 11 +-
pom.xml | 1 +
56 files changed, 855 insertions(+), 811 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/tamaya/ConfigurationTest.java b/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
index 71ece83..0e62205 100644
--- a/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
+++ b/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
@@ -68,4 +68,11 @@ public class ConfigurationTest {
public void testQuery() throws Exception {
assertEquals("myFooResult", Configuration.current().query(c -> "myFooResult"));
}
+
+ @org.junit.Test
+ public void testGetAdapted() throws Exception {
+ assertEquals("yes", Configuration.current().get("booleanTrue", (v) -> Boolean.parseBoolean(v)?"yes":"no").get());
+ assertEquals("no", Configuration.current().get("booleanFalse", (v) -> Boolean.parseBoolean(v)?"yes":"no").get());
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/dormant/core/src/main/java/old/ConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/old/ConfigurationBuilder.java b/dormant/core/src/main/java/old/ConfigurationBuilder.java
index 6d50d0e..a68e6f4 100644
--- a/dormant/core/src/main/java/old/ConfigurationBuilder.java
+++ b/dormant/core/src/main/java/old/ConfigurationBuilder.java
@@ -157,7 +157,7 @@ public final class ConfigurationBuilder {
}
/**
- * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according path resources. The effective resources read
+ * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according path format. The effective format read
* hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
* Properties read are aggregated using the current aggregation policy active.
*
@@ -171,7 +171,7 @@ public final class ConfigurationBuilder {
/**
- * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according path resources. The effective resources read
+ * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according path format. The effective format read
* hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
* Properties read are aggregated using the current aggregation policy active.
*
@@ -184,7 +184,7 @@ public final class ConfigurationBuilder {
}
/**
- * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according URL resources.
+ * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according URL format.
* Properties read are aggregated using the current aggregation policy active.
*
* @param urls the urls to be read, not null.
@@ -196,7 +196,7 @@ public final class ConfigurationBuilder {
}
/**
- * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according URL resources.
+ * Creates a new read-only {@link org.apache.tamaya.PropertySource} by reading the according URL format.
* Properties read are aggregated using the current aggregation policy active.
*
* @param urls the urls to be read, not null.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/dormant/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java b/dormant/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java
index 240fc8a..dc34c55 100644
--- a/dormant/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/internal/config/FallbackSimpleConfigProvider.java
@@ -9,7 +9,7 @@ import org.apache.tamaya.core.properties.PropertySourcesBuilder;
/**
* Implementation of a default config provider used as fallback, if no {@link old.ConfigurationProviderSpi}
* instance is registered for providing the {@code default} {@link org.apache.tamaya.Configuration}. The providers loads the follwing
- * config resources:
+ * config format:
* <ul>
* <li>Classpath: META-INF/cfg/default/**/*.xml, META-INF/cfg/default/**/*.properties, META-INF/cfg/default/**/*.ini</li>
* <li>Classpath: META-INF/cfg/config/#42;#42;/#42;.xml, META-INF/cfg/config/#42;#42;/#42;.properties, META-INF/cfg/config/#42;#42;/#42;.ini</li>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/dormant/core/src/main/java/org/apache/tamaya/core/properties/factories/PropertySourcesBuilder.java
----------------------------------------------------------------------
diff --git a/dormant/core/src/main/java/org/apache/tamaya/core/properties/factories/PropertySourcesBuilder.java b/dormant/core/src/main/java/org/apache/tamaya/core/properties/factories/PropertySourcesBuilder.java
index 712e3f6..7914eef 100644
--- a/dormant/core/src/main/java/org/apache/tamaya/core/properties/factories/PropertySourcesBuilder.java
+++ b/dormant/core/src/main/java/org/apache/tamaya/core/properties/factories/PropertySourcesBuilder.java
@@ -206,7 +206,7 @@ public final class PropertySourcesBuilder {
}
/**
- * Creates a new read-only {@link PropertySource} by reading the according path resources. The effective resources read
+ * Creates a new read-only {@link PropertySource} by reading the according path format. The effective format read
* hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
* Properties read are aggregated using the current aggregation policy active.
*
@@ -222,7 +222,7 @@ public final class PropertySourcesBuilder {
/**
- * Creates a new read-only {@link PropertySource} by reading the according path resources. The effective resources read
+ * Creates a new read-only {@link PropertySource} by reading the according path format. The effective format read
* hereby are determined by the {@code PathResolverService} configured into the {@code Bootstrap} SPI.
* Properties read are aggregated using the current aggregation policy active.
*
@@ -241,7 +241,7 @@ public final class PropertySourcesBuilder {
}
/**
- * Creates a new read-only {@link PropertySource} by reading the according URL resources.
+ * Creates a new read-only {@link PropertySource} by reading the according URL format.
* Properties read are aggregated using the current aggregation policy active.
*
* @param urls the urls to be read, not null.
@@ -255,7 +255,7 @@ public final class PropertySourcesBuilder {
}
/**
- * Creates a new read-only {@link PropertySource} by reading the according URL resources.
+ * Creates a new read-only {@link PropertySource} by reading the according URL format.
* Properties read are aggregated using the current aggregation policy active.
*
* @param urls the urls to be read, not null.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/formats/pom.xml
----------------------------------------------------------------------
diff --git a/modules/formats/pom.xml b/modules/formats/pom.xml
new file mode 100644
index 0000000..15d554c
--- /dev/null
+++ b/modules/formats/pom.xml
@@ -0,0 +1,40 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy current the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-extensions</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>tamaya-formats</artifactId>
+ <name>Apache Tamaya Format Services</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java b/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java
index 46865b0..4a1e06f 100644
--- a/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java
+++ b/modules/formats/src/main/java/org/apache/tamaya/format/ConfigurationFormat.java
@@ -18,11 +18,12 @@
*/
package org.apache.tamaya.format;
-import org.apache.tamaya.core.resources.Resource;
import org.apache.tamaya.spi.PropertySource;
import java.io.IOException;
+import java.io.InputStream;
import java.util.Collection;
+import java.util.function.Supplier;
/**
* Implementations current this class encapsulate the mechanism how to read a
@@ -45,9 +46,10 @@ public interface ConfigurationFormat {
*
* @param sourceName name to be used for constructing a useful name for the created
* {@link org.apache.tamaya.spi.PropertySource} instances.
- * @param resource the configuration resource, not null
+ * @param streamSupplier the resource represented by a supplier of InputStream, not null
* @return the corresponding {@link org.apache.tamaya.spi.PropertySource} instances, never {@code null}.
*/
- Collection<PropertySource> readConfiguration(String sourceName, Resource resource) throws IOException;
+ Collection<PropertySource> readConfiguration(String sourceName, Supplier<InputStream> streamSupplier)
+ throws IOException;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesFormat.java
----------------------------------------------------------------------
diff --git a/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesFormat.java b/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesFormat.java
index 22f2325..6412e77 100644
--- a/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesFormat.java
+++ b/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesFormat.java
@@ -18,7 +18,6 @@
*/
package org.apache.tamaya.format;
-import org.apache.tamaya.core.resources.Resource;
import org.apache.tamaya.spi.PropertySource;
import java.io.InputStream;
@@ -27,8 +26,10 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Properties;
+import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -52,6 +53,7 @@ public class PropertiesFormat implements ConfigurationFormat {
* Creates a new format instance, hereby producing entries with the given ordinal, if not overridden by the
* configuration itself.
* TODO document and implement override feature
+ *
* @param ordinal the target ordinal.
*/
public PropertiesFormat(int ordinal) {
@@ -69,11 +71,11 @@ public class PropertiesFormat implements ConfigurationFormat {
@SuppressWarnings("unchecked")
@Override
- public Collection<PropertySource> readConfiguration(String baseName, Resource resource) {
- final String sourceName = (baseName==null?"Properties:":baseName) + resource.getName();
- if (resource.exists()) {
- List<PropertySource> propertySources = new ArrayList<>();
- try (InputStream is = resource.getInputStream()) {
+ public Collection<PropertySource> readConfiguration(String sourceName, Supplier<InputStream> streamSupplier) {
+ final String name = "Properties(" + Objects.requireNonNull(sourceName) + ')';
+ List<PropertySource> propertySources = new ArrayList<>();
+ try (InputStream is = streamSupplier.get()) {
+ if (is != null) {
final Properties p = new Properties();
p.load(is);
propertySources.add(new PropertySource() {
@@ -84,7 +86,7 @@ public class PropertiesFormat implements ConfigurationFormat {
@Override
public String getName() {
- return sourceName;
+ return name;
}
@Override
@@ -98,9 +100,9 @@ public class PropertiesFormat implements ConfigurationFormat {
}
});
return propertySources;
- } catch (Exception e) {
- LOG.log(Level.FINEST, e, () -> "Failed to read config from resource: " + resource);
}
+ } catch (Exception e) {
+ LOG.log(Level.FINEST, e, () -> "Failed to read config from resource: " + sourceName);
}
return Collections.emptyList();
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesXmlFormat.java
----------------------------------------------------------------------
diff --git a/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesXmlFormat.java b/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesXmlFormat.java
index e042e32..1de9145 100644
--- a/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesXmlFormat.java
+++ b/modules/formats/src/main/java/org/apache/tamaya/format/PropertiesXmlFormat.java
@@ -18,7 +18,6 @@
*/
package org.apache.tamaya.format;
-import org.apache.tamaya.core.resources.Resource;
import org.apache.tamaya.spi.PropertySource;
import java.io.InputStream;
@@ -27,8 +26,10 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Properties;
+import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -53,6 +54,7 @@ public class PropertiesXmlFormat implements ConfigurationFormat {
* Creates a new format instance, producing entries for the given ordinal, if not overridden by a
* config entry itself.
* TODO document and implement override feature
+ *
* @param ordinal the target ordinal.
*/
public PropertiesXmlFormat(int ordinal) {
@@ -70,11 +72,11 @@ public class PropertiesXmlFormat implements ConfigurationFormat {
@SuppressWarnings("unchecked")
@Override
- public Collection<PropertySource> readConfiguration(String baseName, Resource resource) {
- if (resource.exists()) {
- final String sourceName = (baseName==null?"Properties:":baseName) + resource.getName();
- List<PropertySource> propertySources = new ArrayList<>();
- try (InputStream is = resource.getInputStream()) {
+ public Collection<PropertySource> readConfiguration(String source, Supplier<InputStream> streamSupplier) {
+ final String name = "XML-Properties:" + Objects.requireNonNull(source) + ')';
+ List<PropertySource> propertySources = new ArrayList<>();
+ try (InputStream is = streamSupplier.get()) {
+ if (is != null) {
final Properties p = new Properties();
p.loadFromXML(is);
propertySources.add(new PropertySource() {
@@ -85,7 +87,7 @@ public class PropertiesXmlFormat implements ConfigurationFormat {
@Override
public String getName() {
- return sourceName;
+ return name;
}
@Override
@@ -99,9 +101,9 @@ public class PropertiesXmlFormat implements ConfigurationFormat {
}
});
return propertySources;
- } catch (Exception e) {
- LOG.log(Level.FINEST, e, () -> "Failed to read config from resource: " + resource);
}
+ } catch (Exception e) {
+ LOG.log(Level.FINEST, e, () -> "Failed to read config from resource: " + source);
}
return Collections.emptyList();
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/pom.xml
----------------------------------------------------------------------
diff --git a/modules/injection/pom.xml b/modules/injection/pom.xml
index 90f0b59..c0970cd 100644
--- a/modules/injection/pom.xml
+++ b/modules/injection/pom.xml
@@ -21,8 +21,8 @@ under the License.
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.tamaya.integration</groupId>
- <artifactId>tamaya-extensions-all</artifactId>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-extensions</artifactId>
<version>0.2-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -36,5 +36,12 @@ under the License.
<artifactId>tamaya-api</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-resolver</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperties.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperties.java b/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperties.java
index e1d773d..213b34e 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperties.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperties.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Annotation container to enable injection current multiple {@link org.apache.tamaya.annotation.ConfiguredProperty}
+ * Annotation container to enable injection current multiple {@link ConfiguredProperty}
* annotations. Hereby the ordering current annotations imply the defaulting. The first keys that
* could be resolved successfully in the chain current annotations will be used.
*/
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java b/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java
index 21d4e3a..65db051 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/ConfiguredProperty.java
@@ -16,16 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
import java.lang.annotation.*;
/**
* Annotation to enable injection current a configured property or define the returned data for
* a configuration template method. Hereby this annotation can be used in multiple ways and combined
- * with other annotations such as {@link org.apache.tamaya.annotation.DefaultValue},
- * {@link org.apache.tamaya.annotation.WithLoadPolicy}, {@link org.apache.tamaya.annotation.WithConfig},
- * {@link org.apache.tamaya.annotation.WithConfigOperator}, {@link WithPropertyAdapter}.
+ * with other annotations such as {@link DefaultValue},
+ * {@link WithLoadPolicy}, {@link WithConfigOperator}, {@link WithPropertyConverter}.
*
* Below the most simple variant current a configured class is given:
* {@code
@@ -42,7 +41,7 @@ import java.lang.annotation.*;
* <li>if not successful, an error is thrown ({@link org.apache.tamaya.ConfigException}.</li>
* <li>On success, since no type conversion is involved, the keys is injected.</li>
* <li>The configured bean is registered as a weak change listener in the config system's underlying
- * configuration, so future config changes can be propagated (controlled by {@link org.apache.tamaya.annotation.WithLoadPolicy}
+ * configuration, so future config changes can be propagated (controlled by {@link WithLoadPolicy}
* annotations).</li>
* </ul>
*
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultAreas.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultAreas.java b/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultAreas.java
index 63ea137..a327f4e 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultAreas.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultAreas.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -25,7 +25,7 @@ import java.lang.annotation.Target;
/**
* Annotation to control injection and resolution current a configured bean. The configuration keys
- * to be resolved are basically determined by the {@link org.apache.tamaya.annotation.ConfiguredProperty}
+ * to be resolved are basically determined by the {@link ConfiguredProperty}
* annotation(s). Nevertheless these annotations can also have relative key names. This annotation allows
* to define a configuration area that is prefixed to all relative configuration keys within the
* corresponding class/template interface.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultValue.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultValue.java b/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultValue.java
index c4b2e3a..ad6fb95 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultValue.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/DefaultValue.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/DynamicValue.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/DynamicValue.java b/modules/injection/src/main/java/org/apache/tamaya/inject/DynamicValue.java
index b8e0cf5..c652f9d 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/DynamicValue.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/DynamicValue.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya;
+package org.apache.tamaya.inject;
import java.beans.PropertyChangeEvent;
import java.io.IOException;
@@ -34,7 +34,7 @@ import java.util.logging.Logger;
/**
* A accessor for a single configured value. This can be used to support values that may change during runtime, reconfigured or
* final. Hereby external code (could be Tamaya configuration listners or client code), can set a new value. Depending on the
- * {@link org.apache.tamaya.DynamicValue.UpdatePolicy} the new value is immedeately active or it requires an active commit
+ * {@link UpdatePolicy} the new value is immedeately active or it requires an active commit
* by client code. Similarly an instance also can ignore all later changes to the value.
* <h3>Implementation Details</h3>
* This class is
@@ -210,7 +210,7 @@ public final class DynamicValue<T> implements Serializable{
}
/**
- * Method to apply a new value. Depending on the {@link org.apache.tamaya.DynamicValue.UpdatePolicy}
+ * Method to apply a new value. Depending on the {@link UpdatePolicy}
* the value is immediately or deferred visible (or it may even be ignored completely).
* @param newValue the new value, may also be null.
*/
@@ -235,7 +235,7 @@ public final class DynamicValue<T> implements Serializable{
}
/**
- * Sets a new {@link org.apache.tamaya.DynamicValue.UpdatePolicy}.
+ * Sets a new {@link UpdatePolicy}.
* @param updatePolicy the new policy, not null.
*/
public void setUpdatePolicy(UpdatePolicy updatePolicy){
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/LoadPolicy.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/LoadPolicy.java b/modules/injection/src/main/java/org/apache/tamaya/inject/LoadPolicy.java
index 116a2c1..90c1e8f 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/LoadPolicy.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/LoadPolicy.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
/**
* Available policies that describe how changes affecting configured values are published/reinjected.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java b/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java
index 845ec4c..f0cf552 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
import java.lang.annotation.*;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/ObservesConfigChange.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/ObservesConfigChange.java b/modules/injection/src/main/java/org/apache/tamaya/inject/ObservesConfigChange.java
index ef92b25..95ea972 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/ObservesConfigChange.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/ObservesConfigChange.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -26,9 +26,9 @@ import java.lang.annotation.Target;
/**
* Annotation to annotate a method on a class to be informed on config changes.
* The exact behaviour, when configuration change events are sent can be configured
- * on each configured property/method by adding the {@link org.apache.tamaya.annotation.WithLoadPolicy}
+ * on each configured property/method by adding the {@link WithLoadPolicy}
* annotation. By default listeners are informed on all changes of configurations that were used as
- * input configurations for configuring a class/instance. Additionally {@link org.apache.tamaya.annotation.ConfiguredProperty}
+ * input configurations for configuring a class/instance. Additionally {@link ConfiguredProperty}
* annotations can be added that allows to constrain changes to some limited properties.
*/
@Retention(RetentionPolicy.RUNTIME)
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/WithConfigOperator.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/WithConfigOperator.java b/modules/injection/src/main/java/org/apache/tamaya/inject/WithConfigOperator.java
index 9f6c4f5..c2446c0 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/WithConfigOperator.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/WithConfigOperator.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
import org.apache.tamaya.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java b/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java
index e469f5a..19f9d74 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/WithLoadPolicy.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.annotation;
+package org.apache.tamaya.inject;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -25,7 +25,7 @@ import java.lang.annotation.Target;
/**
* Annotation to define how config changes are handled for a type or per property/template method.
- * @see org.apache.tamaya.annotation.LoadPolicy
+ * @see LoadPolicy
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyAdapter.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyAdapter.java b/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyAdapter.java
deleted file mode 100644
index fa9cfdf..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyAdapter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.annotation;
-
-import org.apache.tamaya.PropertyAdapter;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define a type adapter to be used before injecting a configured keys, or for applying changes.
- * This will override any other adapter for performing the type conversion before
- * injecting the field keys.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD })
-public @interface WithPropertyAdapter {
-
- /**
- * Define a custom adapter or codec that should be used to adapt the configuration entry injected. This overrides any
- * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
- * registered, it is handled as a deployment error.
- */
- @SuppressWarnings("rawtypes")
- Class<? extends PropertyAdapter> value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java b/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.java
new file mode 100644
index 0000000..ac20cb9
--- /dev/null
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/WithPropertyConverter.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.inject;
+
+
+import org.apache.tamaya.spi.PropertyConverter;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define a type adapter to be used before injecting a configured keys, or for applying changes.
+ * This will override any other adapter for performing the type conversion before
+ * injecting the field keys.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD })
+public @interface WithPropertyConverter {
+
+ /**
+ * Define a custom adapter or codec that should be used to adapt the configuration entry injected. This overrides any
+ * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
+ * registered, it is handled as a deployment error.
+ */
+ @SuppressWarnings("rawtypes")
+ Class<? extends PropertyConverter> value();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
index f929f8e..18d67ac 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigChangeCallbackMethod.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.core.internal.inject;
+package org.apache.tamaya.inject.internal;
import org.apache.tamaya.core.properties.PropertyChangeSet;
import org.apache.tamaya.Configuration;
@@ -38,10 +38,10 @@ public final class ConfigChangeCallbackMethod {
private Method callbackMethod;
public ConfigChangeCallbackMethod(Method callbackMethod) {
- this.callbackMethod = Optional.of(callbackMethod).filter(
- (m) -> void.class.equals(m.getReturnType()) &&
- m.getParameterCount() == 1 &&
- m.getParameterTypes()[0].equals(PropertyChangeSet.class)).get();
+// this.callbackMethod = Optional.of(callbackMethod).filter(
+// (m) -> void.class.equals(m.getReturnType()) &&
+// m.getParameterCount() == 1 &&
+// m.getParameterTypes()[0].equals(PropertyChangeSet.class)).get();
}
public Consumer<PropertyChangeSet> createConsumer(Object instance, Configuration... configurations){
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
index ff2c309..323816f 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigTemplateInvocationHandler.java
@@ -16,11 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.core.internal.inject;
+package org.apache.tamaya.inject.internal;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.core.internal.inject.ConfiguredType;
-import org.apache.tamaya.core.internal.inject.InjectionUtils;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java
index 8a51375..106d775 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfigurationInjector.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.core.internal.inject;
+package org.apache.tamaya.inject.internal;
import org.apache.tamaya.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
index 51c3904..8880fe8 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.core.internal.inject;
+package org.apache.tamaya.inject.internal;
import java.lang.reflect.Field;
import java.util.Collection;
@@ -25,10 +25,9 @@ import java.util.Objects;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.annotation.ConfiguredProperties;
-import org.apache.tamaya.annotation.ConfiguredProperty;
-import org.apache.tamaya.annotation.DefaultAreas;
-import org.apache.tamaya.core.internal.Utils;
+import org.apache.tamaya.inject.ConfiguredProperties;
+import org.apache.tamaya.inject.ConfiguredProperty;
+import org.apache.tamaya.inject.DefaultAreas;
/**
* Small class that contains and manages all information anc access to a configured field and a concrete instance current
@@ -57,13 +56,11 @@ public class ConfiguredField {
* Evaluate the initial keys fromMap the configuration and applyChanges it to the field.
*
* @param target the target instance.
- * @param configurations Configuration instances that replace configuration served by services. This allows
- * more easily testing and adaption.
* @throws ConfigException if evaluation or conversion failed.
*/
- public void applyInitialValue(Object target, Configuration... configurations) throws ConfigException {
- String configValue = InjectionUtils.getConfigValue(this.annotatedField, configurations);
- applyValue(target, configValue, false, configurations);
+ public void applyInitialValue(Object target) throws ConfigException {
+ String configValue = InjectionUtils.getConfigValue(this.annotatedField);
+ applyValue(target, configValue, false);
}
@@ -75,12 +72,12 @@ public class ConfiguredField {
* @param resolve set to true, if expression resolution should be applied on the keys passed.
* @throws ConfigException if the configuration required could not be resolved or converted.
*/
- public void applyValue(Object target, String configValue, boolean resolve, Configuration... configurations) throws ConfigException {
+ public void applyValue(Object target, String configValue, boolean resolve) throws ConfigException {
Objects.requireNonNull(target);
try {
if (resolve && configValue != null) {
// net step perform exression resolution, if any
- configValue = Configuration.evaluateValue(configValue, configurations);
+ configValue = InjectionUtils.evaluateValue(configValue);
}
// Check for adapter/filter
Object value = InjectionUtils.adaptValue(this.annotatedField, this.annotatedField.getType(), configValue);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
index 90497ae..dd8b0e2 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredSetterMethod.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.core.internal.inject;
+package org.apache.tamaya.inject.internal;
import java.lang.reflect.Method;
import java.util.Collection;
@@ -24,11 +24,13 @@ import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
-import org.apache.tamaya.core.properties.PropertyChangeSet;
+//import org.apache.tamaya.core.properties.PropertyChangeSet;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.annotation.*;
-import org.apache.tamaya.core.internal.Utils;
+import org.apache.tamaya.inject.ConfiguredProperties;
+import org.apache.tamaya.inject.ConfiguredProperty;
+import org.apache.tamaya.inject.DefaultAreas;
+//import org.apache.tamaya.core.internal.Utils;
/**
* Small class that contains and manages all information and access to a configured field and a concrete instance current
@@ -53,32 +55,30 @@ public class ConfiguredSetterMethod {
m.getParameterCount() == 1).get();
}
- public Consumer<PropertyChangeSet> createConsumer(Object instance, Configuration... configurations){
- // TODO consider environment as well
- return event -> {
- for(Configuration cfg:configurations){
- if(event.getPropertySource().getName().equals(cfg.getName())){
- // ignore these changes, since this config is overridden.
- return;
- }
- }
- String configValue = InjectionUtils.getConfigValue(setterMethod, configurations);
- applyValue(instance,configValue, false, configurations);
- };
- }
+// public Consumer<PropertyChangeSet> createConsumer(Object instance, Configuration... configurations){
+// // TODO consider environment as well
+// return event -> {
+// for(Configuration cfg:configurations){
+// if(event.getPropertySource().getName().equals(cfg.getName())){
+// // ignore these changes, since this config is overridden.
+// return;
+// }
+// }
+// String configValue = InjectionUtils.getConfigValue(setterMethod, configurations);
+// applyValue(instance,configValue, false, configurations);
+// };
+// }
/**
* Evaluate the initial keys fromMap the configuration and applyChanges it to the field.
*
* @param target the target instance.
- * @param configurations Configuration instances that replace configuration served by services. This allows
- * more easily testing and adaption.
* @throws ConfigException if evaluation or conversion failed.
*/
- public void applyInitialValue(Object target, Configuration... configurations) throws ConfigException {
- String configValue = InjectionUtils.getConfigValue(this.setterMethod, configurations);
- applyValue(target, configValue, false, configurations);
+ public void applyInitialValue(Object target) throws ConfigException {
+ String configValue = InjectionUtils.getConfigValue(this.setterMethod);
+ applyValue(target, configValue, false);
}
/**
@@ -89,12 +89,12 @@ public class ConfiguredSetterMethod {
* @param resolve set to true, if expression resolution should be applied on the keys passed.
* @throws org.apache.tamaya.ConfigException if the configuration required could not be resolved or converted.
*/
- public void applyValue(Object target, String configValue, boolean resolve, Configuration... configurations) throws ConfigException {
+ public void applyValue(Object target, String configValue, boolean resolve) throws ConfigException {
Objects.requireNonNull(target);
try {
if (resolve && configValue != null) {
// net step perform exression resolution, if any
- configValue = Configuration.evaluateValue(configValue, configurations);
+ configValue = InjectionUtils.evaluateValue(configValue);
}
// Check for adapter/filter
Object value = InjectionUtils.adaptValue(this.setterMethod, this.setterMethod.getParameterTypes()[0], configValue);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
index 879d54a..a3d1284 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredType.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.core.internal.inject;
+package org.apache.tamaya.inject.internal;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
index d80ee80..7675abf 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/InjectionUtils.java
@@ -1,4 +1,22 @@
-package org.apache.tamaya.core.internal.inject;
+/*
+ * 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.inject.internal;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
@@ -12,11 +30,14 @@ import java.util.ListIterator;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.PropertyAdapter;
-import org.apache.tamaya.annotation.*;
-import org.apache.tamaya.annotation.WithPropertyAdapter;
-import org.apache.tamaya.core.internal.Utils;
-import org.apache.tamaya.spi.PropertyAdapterSpi;
+import org.apache.tamaya.inject.ConfiguredProperties;
+import org.apache.tamaya.inject.ConfiguredProperty;
+import org.apache.tamaya.inject.DefaultAreas;
+import org.apache.tamaya.inject.DefaultValue;
+import org.apache.tamaya.inject.WithLoadPolicy;
+import org.apache.tamaya.inject.WithPropertyConverter;
+import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.spi.ServiceContext;
/**
* Created by Anatole on 19.12.2014.
@@ -24,21 +45,20 @@ import org.apache.tamaya.spi.PropertyAdapterSpi;
@SuppressWarnings("unchecked")
final class InjectionUtils {
- private InjectionUtils(){}
+ private static final boolean resolutionModuleLoaded = checkResolutionModuleLoaded();
- /**
- * This method evaluates the {@link org.apache.tamaya.Configuration} that currently is valid for the given target field/method.
- *
- * @return the {@link org.apache.tamaya.Configuration} instance to be used, never null.
- */
- public static Configuration getConfiguration(ConfiguredProperty prop, Configuration... configuration) {
- String name = prop.config();
- if (name != null && !name.trim().isEmpty()) {
- return Configuration.current(name.trim());
+ private static boolean checkResolutionModuleLoaded() {
+ try{
+ Class.forName("org.apache.tamaya.resolver.internal.DefaultExpressionEvaluator");
+ return true;
+ }
+ catch(ClassNotFoundException e){
+ return false;
}
- return Configuration.current();
}
+ private InjectionUtils(){}
+
/**
* Evaluates all absolute configuration key based on the annotations found on a class.
*
@@ -173,11 +193,11 @@ final class InjectionUtils {
try {
// Check for adapter/filter
// T adaptedValue = null;
- WithPropertyAdapter codecAnnot = element.getAnnotation(WithPropertyAdapter.class);
- Class<? extends PropertyAdapter> codecType;
+ WithPropertyConverter codecAnnot = element.getAnnotation(WithPropertyConverter.class);
+ Class<? extends WithPropertyConverter> codecType;
if (codecAnnot != null) {
codecType = codecAnnot.value();
- if (!codecType.equals(PropertyAdapter.class)) {
+ if (!codecType.equals(WithPropertyConverter.class)) {
// TODO cache here...
// Codec<String> codec = codecType.newInstance();
// adaptedValue = (T) codec.adapt(configValue);
@@ -186,8 +206,8 @@ final class InjectionUtils {
if (String.class.equals(targetType)) {
return (T)configValue;
} else {
- PropertyAdapter<?> adapter = PropertyAdapter.getInstance(targetType);
- return (T)adapter.adapt(configValue);
+ PropertyConverter<?> adapter = PropertyConverter.getInstance(targetType);
+ return (T)adapter.convert(configValue);
}
} catch (Exception e) {
throw new ConfigException("Failed to annotate configured member: " + element, e);
@@ -218,4 +238,19 @@ final class InjectionUtils {
}
return Configuration.current();
}
+
+ public static boolean isResolutionModuleLoaded(){
+ return resolutionModuleLoaded;
+ }
+
+ public static String evaluateValue(String value){
+ if(!resolutionModuleLoaded){
+ return value;
+ }
+ ExpressionEvaluator evaluator = ServiceContext.getInstance().getService(ExpressionEvaluator.class).orElse(null);
+ if(evaluator!=null){
+ return evaluator.filterProperty("<injection>", value, (k) -> Configuration.current().get(k)){
+ }
+ return value;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
index e9b9ec3..4935b30 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/WeakConfigListenerManager.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tamaya.core.internal.inject;
+package org.apache.tamaya.inject.internal;
import org.apache.tamaya.core.properties.PropertyChangeSet;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/spi/ConfigurationFactorySpi.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/spi/ConfigurationFactorySpi.java b/modules/injection/src/main/java/org/apache/tamaya/inject/spi/ConfigurationFactorySpi.java
deleted file mode 100644
index 3b167cc..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/spi/ConfigurationFactorySpi.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.PropertySource;
-
-import java.util.Map;
-import java.util.Optional;
-
-/**
- * Factory to create configurations from property sources. If not defines a default is used.
- */
-public interface ConfigurationFactorySpi {
- /**
- * Creates a configuration from a {@link org.apache.tamaya.PropertySource}.
- *
- * @param propertySource the property source
- * @return the corresponding Configuration instance, never null.
- */
- default Configuration from(PropertySource propertySource){
- return new Configuration() {
- @Override
- public String getName() {
- return propertySource.getName();
- }
-
- @Override
- public Optional<String> get(String key) {
- return propertySource.get(key);
- }
-
- @Override
- public Map<String, String> getProperties() {
- return propertySource.getProperties();
- }
-
- @Override
- public String toString(){
- return "Configuration, based on " + propertySource;
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/spi/ConfigurationSpi.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/spi/ConfigurationSpi.java b/modules/injection/src/main/java/org/apache/tamaya/inject/spi/ConfigurationSpi.java
deleted file mode 100644
index 5891dc2..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/spi/ConfigurationSpi.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.PropertyAdapter;
-import org.apache.tamaya.PropertySource;
-import org.apache.tamaya.annotation.WithPropertyAdapter;
-
-import java.util.Map;
-import java.util.Optional;
-
-
-/**
- * Manager for {@link org.apache.tamaya.Configuration} instances. Implementations must register an instance
- * using the {@link ServiceContextManager} mechanism in place (by default this is based on the {@link java.util.ServiceLoader}.
- * The {@link org.apache.tamaya.Configuration} Singleton in the API delegates its corresponding calls to the
- * instance returned by the current bootstrap service in place.
- *
- * @see org.apache.tamaya.Configuration
- * @see ServiceContextManager
- */
-public interface ConfigurationSpi {
-
- /**
- * Allows to check if a configuration with a given name is defined.
- * @param name the configuration's name, not null, not empty.
- * @return true, if such a configuration is defined.
- */
- boolean isConfigurationAvailable(String name);
-
- /**
- * Access a configuration by name.
- * @param name the configuration's name, not null, not empty.
- * @return the corresponding Configuration instance, never null.
- * @throws org.apache.tamaya.ConfigException if no such configuration is defined.
- */
- Configuration getConfiguration(String name);
-
- /**
- * Access the default configuration.
- * @return the corresponding Configuration instance, never null.
- * @throws org.apache.tamaya.ConfigException if no such configuration is defined.
- */
- default Configuration getConfiguration(){
- return getConfiguration("default");
- }
-
- /**
- * Configures an instance, by resolving and injecting the configuration
- * entries.
- *
- * @param instance the instance with configuration annotations, not null.
- * @param configurations overriding configurations to be used for evaluating the values for injection into {@code instance}.
- * If no such config is passed, the default configurationa provided by the current
- * registered providers are used.
- * @throws org.apache.tamaya.ConfigException if any required configuration could not be resolved/injected.
- */
- void configure(Object instance, Configuration... configurations);
-
- /**
- * Access a configuration by name.
- *
- * @param configurations overriding configurations to be used for evaluating the values for injection into {@code instance}, not null.
- * If no such config is passed, the default configurationa provided by the current
- * registered providers are used.
- * @return the corresponding Configuration instance, never null.
- * @throws org.apache.tamaya.ConfigException if no such configuration is defined.
- */
- <T> T createTemplate(Class<T> template, Configuration... configurations);
-
- /**
- * Evaluate the current expression based on the current configuration valid.
- * @param configurations overriding configurations to be used for evaluating the values for injection into {@code instance}, not null.
- * If no such config is passed, the default configurationa provided by the current
- * registered providers are used.
- * @param expression the expression, not null.
- * @return the evaluated config expression.
- */
- String evaluateValue(String expression, Configuration... configurations);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/injection/src/main/java/org/apache/tamaya/inject/spi/PropertyAdapterSpi.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/spi/PropertyAdapterSpi.java b/modules/injection/src/main/java/org/apache/tamaya/inject/spi/PropertyAdapterSpi.java
deleted file mode 100644
index a1222a4..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/spi/PropertyAdapterSpi.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.PropertyAdapter;
-import org.apache.tamaya.annotation.WithPropertyAdapter;
-
-
-/**
- * Manager for {@link org.apache.tamaya.Configuration} instances. Implementations must register an instance
- * using the {@link org.apache.tamaya.spi.ServiceContextManager} mechanism in place (by default this is based on the {@link java.util.ServiceLoader}.
- * The {@link org.apache.tamaya.Configuration} Singleton in the API delegates its corresponding calls to the
- * instance returned by the current bootstrap service in place.
- *
- * @see org.apache.tamaya.Configuration
- * @see org.apache.tamaya.spi.ServiceContextManager
- */
-public interface PropertyAdapterSpi {
-
-
- /**
- * Registers a new PropertyAdapter for the given target type, hereby replacing any existing adapter for
- * this type.
- * @param targetType The target class, not null.
- * @param adapter The adapter, not null.
- * @param <T> The target type
- * @return any adapter replaced with the new adapter, or null.
- */
- <T> PropertyAdapter<T> register(Class<T> targetType, PropertyAdapter<T> adapter);
-
- /**
- * Get an adapter converting to the given target type.
- * @param targetType the target type class
- * @return true, if the given target type is supported.
- */
- default <T> PropertyAdapter<T> getAdapter(Class<T> targetType){
- return getPropertyAdapter(targetType, null);
- }
-
- /**
- * Get an adapter converting to the given target type.
- * @param targetType the target type class
- * @param <T> the target type
- * @return the corresponding adapter, never null.
- * @throws org.apache.tamaya.ConfigException if the target type is not supported.
- */
- <T> PropertyAdapter<T> getPropertyAdapter(Class<T> targetType, WithPropertyAdapter annotation);
-
- /**
- * Checks if the given target type is supported, i.e. a adapter is registered and accessible.
- * @param targetType the target type class
- * @return true, if the given target type is supported.
- */
- boolean isTargetTypeSupported(Class<?> targetType);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/pom.xml
----------------------------------------------------------------------
diff --git a/modules/pom.xml b/modules/pom.xml
index c2aa0b2..a7e31e3 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -33,10 +33,12 @@ under the License.
<packaging>pom</packaging>
<modules>
- <module>injection</module>
+ <!-- module>injection</module -->
+ <module>formats</module>
<module>resolver</module>
- <module>metamodels</module>
- <module>integration</module>
+ <module>resources</module>
+ <!-- module>metamodels</module -->
+ <!-- module>integration</module -->
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java
index 8590761..5c538e1 100644
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java
@@ -18,6 +18,7 @@
*/
package org.apache.tamaya.resolver.internal;
+import org.apache.tamaya.resolver.spi.ExpressionEvaluator;
import org.apache.tamaya.spi.PropertyFilter;
import org.apache.tamaya.spi.ServiceContext;
import org.apache.tamaya.resolver.spi.ExpressionResolver;
@@ -34,7 +35,7 @@ import java.util.logging.Logger;
* has the advantage that different resolvers can be active in parallel.
*/
@Priority(10000)
-public class DefaultExpressionEvaluator implements PropertyFilter {
+public class DefaultExpressionEvaluator implements ExpressionEvaluator {
private static final Logger LOG = Logger.getLogger(DefaultExpressionEvaluator.class.getName());
@@ -151,7 +152,7 @@ public class DefaultExpressionEvaluator implements PropertyFilter {
return valueToBeFiltered;
}
// evaluate sub-expression
- current.append(evaluteInternal(subExpression, propertyValueProvider));
+ current.append(evaluateInternal(subExpression, propertyValueProvider));
break;
default:
current.append(token);
@@ -163,7 +164,7 @@ public class DefaultExpressionEvaluator implements PropertyFilter {
return resolvedValue.toString();
}
- private String evaluteInternal(String subExpression, Function<String,String> propertyValueProvider) {
+ private String evaluateInternal(String subExpression, Function<String,String> propertyValueProvider) {
String value = null;
// 1 check for explicit prefix
for(ExpressionResolver resolver:resolvers){
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.java
index f0c46a9..57830e7 100644
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.java
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/EnvironmentPropertyResolver.java
@@ -18,8 +18,6 @@
*/
package org.apache.tamaya.resolver.internal;
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.Configuration;
import org.apache.tamaya.resolver.spi.ExpressionResolver;
import java.util.Optional;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java
new file mode 100644
index 0000000..e136225
--- /dev/null
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.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.resolver.internal;
+
+import org.apache.tamaya.resolver.spi.ExpressionEvaluator;
+import org.apache.tamaya.resolver.spi.ExpressionResolver;
+import org.apache.tamaya.spi.PropertyFilter;
+import org.apache.tamaya.spi.ServiceContext;
+
+import javax.annotation.Priority;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.function.Function;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Default expression evaluator that manages several instances of {@link org.apache.tamaya.resolver.spi.ExpressionResolver}.
+ * Each resolver is identified by a resolver id. Each expression passed has the form resolverId:resolverExpression, which
+ * has the advantage that different resolvers can be active in parallel.
+ */
+@Priority(10000)
+public class ExpressionResolutionFilter implements PropertyFilter {
+
+ private static final Logger LOG = Logger.getLogger(ExpressionResolutionFilter.class.getName());
+
+ private ExpressionEvaluator evaluator = ServiceContext.getInstance().getService(ExpressionEvaluator.class).get();
+
+ /**
+ * Resolves an expression in the form current <code>${resolverId:expression}</code> or
+ * <code>${<prefix>expression}</code>. The expression can be
+ * part current any type current literal text. Also multiple expressions with mixed matching resolvers are
+ * supported.
+ * All control characters (${}\) can be escaped using '\'.<br>
+ * So all the following are valid expressions:
+ * <ul>
+ * <li><code>${expression}</code></li>
+ * <li><code>bla bla ${expression}</code></li>
+ * <li><code>${expression} bla bla</code></li>
+ * <li><code>bla bla ${expression} bla bla</code></li>
+ * <li><code>${expression}${resolverId2:expression2}</code></li>
+ * <li><code>foo ${expression}${resolverId2:expression2}</code></li>
+ * <li><code>foo ${expression} bar ${resolverId2:expression2}</code></li>
+ * <li><code>${expression}foo${resolverId2:expression2}bar</code></li>
+ * <li><code>foor${expression}bar${resolverId2:expression2}more</code></li>
+ * <li><code>\${expression}foo${resolverId2:expression2}bar</code> (first expression is escaped).</li>
+ * </ul>
+ * Given {@code resolverId:} is a valid prefix targeting a {@link java.beans.Expression} explicitly, also the
+ * following expressions are valid:
+ * <ul>
+ * <li><code>${resolverId:expression}</code></li>
+ * <li><code>bla bla ${resolverId:expression}</code></li>
+ * <li><code>${resolverId:expression} bla bla</code></li>
+ * <li><code>bla bla ${resolverId:expression} bla bla</code></li>
+ * <li><code>${resolverId:expression}${resolverId2:expression2}</code></li>
+ * <li><code>foo ${resolverId:expression}${resolverId2:expression2}</code></li>
+ * <li><code>foo ${resolverId:expression} bar ${resolverId2:expression2}</code></li>
+ * <li><code>${resolverId:expression}foo${resolverId2:expression2}bar</code></li>
+ * <li><code>foor${resolverId:expression}bar${resolverId2:expression2}more</code></li>
+ * <li><code>\${resolverId:expression}foo${resolverId2:expression2}bar</code> (first expression is escaped).</li>
+ * </ul>
+ *
+ * @param key the key to be filtered
+ * @param valueToBeFiltered value to be analyzed for expressions
+ * @return the resolved value, or the input in case where no expression was detected.
+ */
+ @Override
+ public String filterProperty(String key, String valueToBeFiltered, Function<String,String> propertyValueProvider){
+ return evaluator.filterProperty(key, valueToBeFiltered, propertyValueProvider);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.java
index 7617023..bf318fb 100644
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.java
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/SystemPropertyResolver.java
@@ -21,7 +21,6 @@ package org.apache.tamaya.resolver.internal;
import java.util.Optional;
import java.util.function.Function;
-import org.apache.tamaya.ConfigException;
import org.apache.tamaya.resolver.spi.ExpressionResolver;
/**
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java
new file mode 100644
index 0000000..16f0b5b
--- /dev/null
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java
@@ -0,0 +1,17 @@
+package org.apache.tamaya.resolver.spi;
+
+import java.util.function.Function;
+
+/**
+ * Created by Anatole on 05.01.2015.
+ */
+public interface ExpressionEvaluator {
+ /**
+ * Evaluates the current expression.
+ * @param key the key, not null.
+ * @param valueToBeFiltered the value to be filtered/evaluated.
+ * @param propertyValueProvider the provider for looking up additional keys.
+ * @return the filtered/evaluated value, including null.
+ */
+ String filterProperty(String key, String valueToBeFiltered, Function<String,String> propertyValueProvider);
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java
index d9bcb78..497450e 100644
--- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java
+++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionResolver.java
@@ -18,8 +18,6 @@
*/
package org.apache.tamaya.resolver.spi;
-import org.apache.tamaya.Configuration;
-
import java.util.function.Function;
/**
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionEvaluator
----------------------------------------------------------------------
diff --git a/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionEvaluator b/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionEvaluator
new file mode 100644
index 0000000..aa766b6
--- /dev/null
+++ b/modules/resolver/src/main/resources/META-INF/services/org.apache.tamaya.resolver.spi.ExpressionEvaluator
@@ -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.resolver.internal.DefaultExpressionEvaluator
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyResolutionTest.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyResolutionTest.java b/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyResolutionTest.java
index b69d762..b9ad08d 100644
--- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyResolutionTest.java
+++ b/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyResolutionTest.java
@@ -1,3 +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.
+ */
package org.apache.tamaya.resolver;
import org.apache.tamaya.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ed3f7063/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java b/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
index f765a64..d19c05f 100644
--- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
+++ b/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java
@@ -1,3 +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.
+ */
package org.apache.tamaya.resolver;
import org.apache.tamaya.spi.PropertySource;