TAMAYA-274/353 Added revapi reports to control/report backward compatibility
breaks.
Removed deprecated artifacts (ConfigurationContextBuilder) and
implementations/deps.
TAMAYA-355 Removed PropertyValueCombinationPolicy (not needed anymore).
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/4932c0cd
Tree:
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/4932c0cd
Diff:
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/4932c0cd
Branch: refs/heads/master
Commit: 4932c0cd49aae5ef785ca90030995eb27cef3c45
Parents: cabe383
Author: Anatole Tresch <[email protected]>
Authored: Tue Nov 6 18:47:50 2018 +0100
Committer: Anatole Tresch <[email protected]>
Committed: Tue Nov 6 18:47:50 2018 +0100
----------------------------------------------------------------------
modules/events/pom.xml | 17 ++++
modules/filter/pom.xml | 17 ++++
.../tamaya/filter/ProgrammableFilterTest.java | 10 +-
.../MappedConfigurationDataPropertySource.java | 6 +-
.../format/formats/IniConfigurationFormat.java | 6 +-
.../tamaya/format/formats/PropertiesFormat.java | 2 +-
.../format/formats/PropertiesXmlFormat.java | 5 +-
modules/formats/pom.xml | 17 ++++
modules/functions/pom.xml | 18 ++++
.../tamaya/cdi/ConfigurationProducer.java | 6 --
modules/injection/pom.xml | 17 ++++
.../internal/DefaultDynamicValueTest.java | 12 +--
modules/jndi/pom.xml | 18 ++++
modules/microprofile/pom.xml | 18 ++++
modules/mutable-config/pom.xml | 24 +++++
.../mutableconfig/ChangePropagationPolicy.java | 99 ++++++++++++++++++++
.../MutableConfigurationProvider.java | 96 +------------------
.../ChangePropagationPolicyTest.java | 46 +++++++++
.../MutableConfigurationProviderTest.java | 8 +-
.../mutableconfig/MutableConfigurationTest.java | 14 ++-
modules/optional/pom.xml | 23 +++++
modules/resolver/pom.xml | 23 +++++
modules/resources/pom.xml | 23 +++++
modules/spring/pom.xml | 23 +++++
pom.xml | 41 ++++++++
25 files changed, 456 insertions(+), 133 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/events/pom.xml
----------------------------------------------------------------------
diff --git a/modules/events/pom.xml b/modules/events/pom.xml
index aaa650f..bb88abb 100644
--- a/modules/events/pom.xml
+++ b/modules/events/pom.xml
@@ -32,6 +32,23 @@ under the License.
<name>Apache Tamaya Event and dynamic Update Extensions</name>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.tamaya</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/filter/pom.xml
----------------------------------------------------------------------
diff --git a/modules/filter/pom.xml b/modules/filter/pom.xml
index 272f139..8ada266 100644
--- a/modules/filter/pom.xml
+++ b/modules/filter/pom.xml
@@ -32,6 +32,23 @@ under the License.
<name>Apache Tamaya Adaptive Configuration Filtering</name>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.tamaya</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
----------------------------------------------------------------------
diff --git
a/modules/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
b/modules/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
index d6fa711..c13fec0 100644
---
a/modules/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
+++
b/modules/filter/src/test/java/org/apache/tamaya/filter/ProgrammableFilterTest.java
@@ -22,7 +22,7 @@ import org.apache.tamaya.spi.ConfigurationContext;
import org.apache.tamaya.spi.FilterContext;
import org.apache.tamaya.spi.PropertyFilter;
import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spisupport.DefaultConfigurationContextBuilder;
+import org.apache.tamaya.spisupport.DefaultConfigurationBuilder;
import org.apache.tamaya.spisupport.RegexPropertyFilter;
import org.junit.Test;
@@ -37,10 +37,10 @@ import static org.junit.Assert.*;
*/
public class ProgrammableFilterTest {
- private static ConfigurationContext context = new
DefaultConfigurationContextBuilder().build();
- private static PropertyValue test1Property =
PropertyValue.of("test1","test1","test");
- private static PropertyValue test2Property =
PropertyValue.of("test2","test2","test");
- private static PropertyValue test3Property =
PropertyValue.of("test.test3","test.test3","test");
+ private static ConfigurationContext context = new
DefaultConfigurationBuilder().build().getContext();
+ private static PropertyValue test1Property =
PropertyValue.createValue("test1","test1");
+ private static PropertyValue test2Property =
PropertyValue.createValue("test2","test2");
+ private static PropertyValue test3Property =
PropertyValue.createValue("test.test3","test.test3");
@Test
public void testAddRemoveFilter() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java
----------------------------------------------------------------------
diff --git
a/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java
b/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java
index d63500a..341611f 100644
---
a/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java
+++
b/modules/formats/base/src/main/java/org/apache/tamaya/format/MappedConfigurationDataPropertySource.java
@@ -91,7 +91,7 @@ public class MappedConfigurationDataPropertySource extends
BasePropertySource {
if(data==null){
return;
}
- Map<String, Object> meta = new HashMap<>();
+ Map<String, String> meta = new HashMap<>();
meta.put("source", data.getResource());
meta.put("timestamp",String.valueOf(System.currentTimeMillis()));
try{
@@ -119,7 +119,7 @@ public class MappedConfigurationDataPropertySource extends
BasePropertySource {
* @param meta the metadata to add.
* @return the final properties to be included.
*/
- protected Map<String, PropertyValue> populateData(ConfigurationData data,
Map<String, Object> meta) {
+ protected Map<String, PropertyValue> populateData(ConfigurationData data,
Map<String, String> meta) {
Map<String, PropertyValue> result = new HashMap<>();
for(PropertyValue val:data.getData()) {
if(!val.getKey().isEmpty()) {
@@ -132,7 +132,7 @@ public class MappedConfigurationDataPropertySource extends
BasePropertySource {
return result;
}
- protected void addNode(PropertyValue val, Map<String, PropertyValue> map,
Map<String, Object> meta){
+ protected void addNode(PropertyValue val, Map<String, PropertyValue> map,
Map<String, String> meta){
if(val.isLeaf()){
val.setMeta(meta);
map.put(val.getQualifiedKey(), val);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/IniConfigurationFormat.java
----------------------------------------------------------------------
diff --git
a/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/IniConfigurationFormat.java
b/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/IniConfigurationFormat.java
index 7c4b911..3b1fbe6 100644
---
a/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/IniConfigurationFormat.java
+++
b/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/IniConfigurationFormat.java
@@ -84,15 +84,15 @@ public class IniConfigurationFormat implements
ConfigurationFormat {
final String sectionName = section;
ObjectValue sectionPV =
(ObjectValue)sections.computeIfAbsent(section,
s -> PropertyValue.createObject(sectionName)
- .setMeta(ConfigurationFormat.class, this));
+ .setMeta(ConfigurationFormat.class.getName(), this));
sectionPV.setField(key, value).setMeta("source",
resource)
- .setMeta(ConfigurationFormat.class, this);
+ .setMeta(ConfigurationFormat.class.getName(),
this);
} else {
String finalSection = "default";
ObjectValue sectionBuilder =
(ObjectValue)sections.computeIfAbsent(section,
s ->
PropertyValue.createObject(finalSection).setMeta("source", resource));
sectionBuilder.setField(key, value).setMeta("source",
resource)
- .setMeta(ConfigurationFormat.class, this);
+ .setMeta(ConfigurationFormat.class.getName(),
this);
}
}
line = reader.readLine();
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesFormat.java
----------------------------------------------------------------------
diff --git
a/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesFormat.java
b/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesFormat.java
index 458d31e..fa87f56 100644
---
a/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesFormat.java
+++
b/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesFormat.java
@@ -57,7 +57,7 @@ public class PropertiesFormat implements ConfigurationFormat {
for(Map.Entry en:p.entrySet()) {
PropertyValue pv =
PropertyValue.createValue(en.getKey().toString(), en.getValue().toString())
.setMeta("source", resource)
- .setMeta(ConfigurationFormat.class, this);
+ .setMeta(ConfigurationFormat.class.getName(), this);
data.add(pv);
}
return new ConfigurationData(resource, this, data);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesXmlFormat.java
----------------------------------------------------------------------
diff --git
a/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesXmlFormat.java
b/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesXmlFormat.java
index 31d39fa..c3e0485 100644
---
a/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesXmlFormat.java
+++
b/modules/formats/base/src/main/java/org/apache/tamaya/format/formats/PropertiesXmlFormat.java
@@ -56,8 +56,9 @@ public class PropertiesXmlFormat implements
ConfigurationFormat {
p.loadFromXML(inputStream);
Set<PropertyValue> data = new HashSet<>();
for(Map.Entry en:p.entrySet()) {
- PropertyValue pv = PropertyValue.of(en.getKey().toString(),
en.getValue().toString(), resource)
- .setMeta(ConfigurationFormat.class, this);
+ PropertyValue pv =
PropertyValue.createValue(en.getKey().toString(), en.getValue().toString())
+ .setMeta("source", resource)
+ .setMeta(ConfigurationFormat.class.getName(), this);
data.add(pv);
}
return new ConfigurationData(resource, this, data);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/formats/pom.xml
----------------------------------------------------------------------
diff --git a/modules/formats/pom.xml b/modules/formats/pom.xml
index 59567df..bdc7632 100644
--- a/modules/formats/pom.xml
+++ b/modules/formats/pom.xml
@@ -29,6 +29,23 @@
<name>Apache Tamaya Modules - Formats Parent</name>
<packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<modules>
<module>base</module>
<module>json</module>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/functions/pom.xml
----------------------------------------------------------------------
diff --git a/modules/functions/pom.xml b/modules/functions/pom.xml
index 2b34b52..e5f1394 100644
--- a/modules/functions/pom.xml
+++ b/modules/functions/pom.xml
@@ -31,6 +31,24 @@ under the License.
<name>Apache Tamaya Modules - Common Functional Extensions</name>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
<dependencies>
<dependency>
<groupId>org.apache.tamaya</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/ConfigurationProducer.java
----------------------------------------------------------------------
diff --git
a/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/ConfigurationProducer.java
b/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/ConfigurationProducer.java
index f9dd1da..16b3608 100644
---
a/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/ConfigurationProducer.java
+++
b/modules/injection/cdi/src/main/java/org/apache/tamaya/cdi/ConfigurationProducer.java
@@ -189,12 +189,6 @@ public class ConfigurationProducer {
return Configuration.current().getContext();
}
- @Deprecated
- @Produces
- public ConfigurationContextBuilder getConfigurationContextBuilder(){
- return ConfigurationProvider.getConfigurationContextBuilder();
- }
-
@Produces
public ConfigurationBuilder getConfigurationBuilder(){
return Configuration.createConfigurationBuilder();
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/injection/pom.xml
----------------------------------------------------------------------
diff --git a/modules/injection/pom.xml b/modules/injection/pom.xml
index d811715..d30e3f7 100644
--- a/modules/injection/pom.xml
+++ b/modules/injection/pom.xml
@@ -29,6 +29,23 @@
<name>Apache Tamaya Modules - Injection Parent</name>
<packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<modules>
<module>injection-api</module>
<module>standalone</module>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/injection/standalone/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
----------------------------------------------------------------------
diff --git
a/modules/injection/standalone/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
b/modules/injection/standalone/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
index 5adaf5f..2793052 100644
---
a/modules/injection/standalone/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
+++
b/modules/injection/standalone/src/test/java/org/apache/tamaya/inject/internal/DefaultDynamicValueTest.java
@@ -18,7 +18,6 @@
*/
package org.apache.tamaya.inject.internal;
-import org.apache.tamaya.ConfigurationProvider;
import org.apache.tamaya.inject.api.DynamicValue;
import org.apache.tamaya.inject.api.Config;
import org.apache.tamaya.inject.api.UpdatePolicy;
@@ -63,8 +62,8 @@ public class DefaultDynamicValueTest {
};
private Map<String,PropertyValue> properties = new HashMap<>();
- private Configuration config = ConfigurationProvider.createConfiguration(
-
ConfigurationProvider.getConfigurationContextBuilder().addPropertySources(
+ private Configuration config =
+ Configuration.createConfigurationBuilder().addPropertySources(
new PropertySource() {
@Override
public int getOrdinal() {
@@ -85,13 +84,8 @@ public class DefaultDynamicValueTest {
public Map<String, PropertyValue> getProperties() {
return properties;
}
-
- @Override
- public boolean isScannable() {
- return false;
- }
}
- ).build());
+ ).build();
@Test
public void testOf_Field() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/jndi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jndi/pom.xml b/modules/jndi/pom.xml
index 805729b..24bdb33 100644
--- a/modules/jndi/pom.xml
+++ b/modules/jndi/pom.xml
@@ -32,6 +32,24 @@ under the License.
<name>Apache Tamaya JNDI Support</name>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
<dependencies>
<dependency>
<groupId>org.apache.tamaya</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/microprofile/pom.xml
----------------------------------------------------------------------
diff --git a/modules/microprofile/pom.xml b/modules/microprofile/pom.xml
index c2a46d4..1afb850 100644
--- a/modules/microprofile/pom.xml
+++ b/modules/microprofile/pom.xml
@@ -45,6 +45,24 @@ under the License.
<openejb.version>4.7.1</openejb.version>
</properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
<dependencies>
<dependency>
<groupId>junit</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/mutable-config/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mutable-config/pom.xml b/modules/mutable-config/pom.xml
index ecbf767..22bc4da 100644
--- a/modules/mutable-config/pom.xml
+++ b/modules/mutable-config/pom.xml
@@ -31,6 +31,30 @@ under the License.
and write changes back to some property sources, files
etc.</description>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check</id>
+ <goals><goal>check</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
<dependencies>
<dependency>
<groupId>org.apache.tamaya</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java
----------------------------------------------------------------------
diff --git
a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java
b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java
index e183898..f949439 100644
---
a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java
+++
b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java
@@ -18,9 +18,15 @@
*/
package org.apache.tamaya.mutableconfig;
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.mutableconfig.spi.MutablePropertySource;
import org.apache.tamaya.spi.PropertySource;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Logger;
/**
* Policy that defines how changes are applied to the available
@@ -50,4 +56,97 @@ public interface ChangePropagationPolicy {
*/
void applyChange(ConfigChangeRequest configChange,
Collection<PropertySource> propertySources);
+
+
+ /**
+ * This propagation policy writes changes only once to the most
significant property source, where a change is
+ * applicable.
+ * @param propertySourceNames the names of the mutable property sources to
be considered for writing any changes to.
+ * @return a corresponding {@link ChangePropagationPolicy} implementation,
never null.
+ */
+ static ChangePropagationPolicy getApplySelectiveChangePolicy(final
String... propertySourceNames){
+ return new ChangePropagationPolicy() {
+
+ private Set<String> sourceNames = new
HashSet<>(Arrays.asList(propertySourceNames));
+
+ @Override
+ public void applyChange(ConfigChangeRequest change,
Collection<PropertySource> propertySources) {
+ for(PropertySource propertySource: propertySources){
+ if(propertySource instanceof MutablePropertySource){
+
if(this.sourceNames.contains(propertySource.getName())) {
+ MutablePropertySource target =
(MutablePropertySource) propertySource;
+ try{
+ target.applyChange(change);
+ }catch(ConfigException e){
+
Logger.getLogger(ChangePropagationPolicy.class.getName())
+ .warning("Failed to store changes
'"+change+"' not applicable to "+target.getName()
+ +"("+target.getClass().getName()+").");
+ }
+ break;
+ }
+ }
+ }
+ }
+ };
+ }
+
+ /**
+ * This propagation policy writes through all changes to all mutable
property sources, where applicable.
+ */
+ ChangePropagationPolicy ALL_POLICY = new ChangePropagationPolicy() {
+ @Override
+ public void applyChange(ConfigChangeRequest change,
Collection<PropertySource> propertySources) {
+ for(PropertySource propertySource: propertySources){
+ if(propertySource instanceof MutablePropertySource){
+ MutablePropertySource target =
(MutablePropertySource)propertySource;
+ try{
+ target.applyChange(change);
+ }catch(ConfigException e){
+
Logger.getLogger(ChangePropagationPolicy.class.getName())
+ .warning("Failed to store changes '"+change+"'
not applicable to "+target.getName()
+ +"("+target.getClass().getName()+").");
+ }
+ }
+ }
+ }
+
+ };
+
+ /**
+ * This propagation policy writes changes only once to the most
significant property source, where a change is
+ * applicable.
+ */
+ ChangePropagationPolicy MOST_SIGNIFICANT_ONLY_POLICY = new
ChangePropagationPolicy() {
+ @Override
+ public void applyChange(ConfigChangeRequest change,
Collection<PropertySource> propertySources) {
+ for(PropertySource propertySource: propertySources){
+ if(propertySource instanceof MutablePropertySource){
+ MutablePropertySource target =
(MutablePropertySource)propertySource;
+ try{
+ target.applyChange(change);
+ }catch(ConfigException e){
+
Logger.getLogger(ChangePropagationPolicy.class.getName())
+ .warning("Failed to store changes '"+change+"'
not applicable to "+target.getName()
+ +"("+target.getClass().getName()+").");
+ }
+ break;
+ }
+ }
+ }
+
+ };
+
+ /**
+ * This propagation policy writes changes only once to the most
significant property source, where a change is
+ * applicable.
+ */
+ ChangePropagationPolicy NONE_POLICY = new ChangePropagationPolicy() {
+ @Override
+ public void applyChange(ConfigChangeRequest change,
Collection<PropertySource> propertySources) {
+ Logger.getLogger(ChangePropagationPolicy.class.getName())
+ .warning("Cannot store changes '"+change+"': prohibited by
change policy (read-only).");
+ }
+ };
+
+
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java
----------------------------------------------------------------------
diff --git
a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java
b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java
index e0b9bf4..4724f46 100644
---
a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java
+++
b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java
@@ -109,7 +109,7 @@ public final class MutableConfigurationProvider {
* @return a new MutableConfiguration instance
*/
public MutableConfiguration createMutableConfiguration(Configuration
configuration){
- return createMutableConfiguration(configuration,
MOST_SIGNIFICANT_ONLY_POLICY);
+ return createMutableConfiguration(configuration,
ChangePropagationPolicy.MOST_SIGNIFICANT_ONLY_POLICY);
}
/**
@@ -132,7 +132,7 @@ public final class MutableConfigurationProvider {
* @return default all policy.
*/
public static ChangePropagationPolicy getApplyAllChangePolicy(){
- return ALL_POLICY;
+ return ChangePropagationPolicy.ALL_POLICY;
}
/**
@@ -141,7 +141,7 @@ public final class MutableConfigurationProvider {
* @return a corresponding {@link ChangePropagationPolicy} implementation,
never null.
*/
public static ChangePropagationPolicy
getApplyMostSignificantOnlyChangePolicy(){
- return MOST_SIGNIFICANT_ONLY_POLICY;
+ return ChangePropagationPolicy.MOST_SIGNIFICANT_ONLY_POLICY;
}
/**
@@ -151,7 +151,7 @@ public final class MutableConfigurationProvider {
* @return a corresponding {@link ChangePropagationPolicy} implementation,
never null.
*/
public static ChangePropagationPolicy
getApplySelectiveChangePolicy(String... propertySourceNames){
- return new SelectiveChangeApplyPolicy(propertySourceNames);
+ return
ChangePropagationPolicy.getApplySelectiveChangePolicy(propertySourceNames);
}
/**
@@ -160,65 +160,10 @@ public final class MutableConfigurationProvider {
* @return a corresponding {@link ChangePropagationPolicy} implementation,
never null.
*/
public static ChangePropagationPolicy getApplyNonePolicy(){
- return NONE_POLICY;
+ return ChangePropagationPolicy.NONE_POLICY;
}
/**
- * This propagation policy writes through all changes to all mutable
property sources, where applicable.
- */
- private static final ChangePropagationPolicy ALL_POLICY = new
ChangePropagationPolicy() {
- @Override
- public void applyChange(ConfigChangeRequest change,
Collection<PropertySource> propertySources) {
- for(PropertySource propertySource: propertySources){
- if(propertySource instanceof MutablePropertySource){
- MutablePropertySource target =
(MutablePropertySource)propertySource;
- try{
- target.applyChange(change);
- }catch(ConfigException e){
- LOG.warning("Failed to store changes '"+change+"' not
applicable to "+target.getName()
- +"("+target.getClass().getName()+").");
- }
- }
- }
- }
-
- };
-
- /**
- * This propagation policy writes changes only once to the most
significant property source, where a change is
- * applicable.
- */
- private static final ChangePropagationPolicy MOST_SIGNIFICANT_ONLY_POLICY
= new ChangePropagationPolicy() {
- @Override
- public void applyChange(ConfigChangeRequest change,
Collection<PropertySource> propertySources) {
- for(PropertySource propertySource: propertySources){
- if(propertySource instanceof MutablePropertySource){
- MutablePropertySource target =
(MutablePropertySource)propertySource;
- try{
- target.applyChange(change);
- }catch(ConfigException e){
- LOG.warning("Failed to store changes '"+change+"' not
applicable to "+target.getName()
- +"("+target.getClass().getName()+").");
- }
- break;
- }
- }
- }
-
- };
-
- /**
- * This propagation policy writes changes only once to the most
significant property source, where a change is
- * applicable.
- */
- private static final ChangePropagationPolicy NONE_POLICY = new
ChangePropagationPolicy() {
- @Override
- public void applyChange(ConfigChangeRequest change,
Collection<PropertySource> propertySources) {
- LOG.warning("Cannot store changes '"+change+"': prohibited by
change policy (read-only).");
- }
- };
-
- /**
* Get the provider's classloader.
* @return the classloader, not null.
*/
@@ -226,35 +171,4 @@ public final class MutableConfigurationProvider {
return classLoader;
}
- /**
- * This propagation policy writes through all changes to all mutable
property sources, where applicable.
- */
- private static final class SelectiveChangeApplyPolicy implements
ChangePropagationPolicy {
-
- private Set<String> propertySourceNames = new HashSet<>();
-
- SelectiveChangeApplyPolicy(String... propertySourceNames){
-
this.propertySourceNames.addAll(Arrays.asList(propertySourceNames));
- }
-
- @Override
- public void applyChange(ConfigChangeRequest change,
Collection<PropertySource> propertySources) {
- for(PropertySource propertySource: propertySources){
- if(propertySource instanceof MutablePropertySource){
-
if(this.propertySourceNames.contains(propertySource.getName())) {
- MutablePropertySource target = (MutablePropertySource)
propertySource;
- try{
- target.applyChange(change);
- }catch(ConfigException e){
- LOG.warning("Failed to store changes '"+change+"'
not applicable to "+target.getName()
- +"("+target.getClass().getName()+").");
- }
- break;
- }
- }
- }
- }
- };
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicyTest.java
----------------------------------------------------------------------
diff --git
a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicyTest.java
b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicyTest.java
new file mode 100644
index 0000000..812b3e7
--- /dev/null
+++
b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicyTest.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.mutableconfig;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class ChangePropagationPolicyTest {
+
+ @Test
+ public void getApplyAllChangePolicy() throws Exception {
+ assertNotNull(ChangePropagationPolicy.ALL_POLICY);
+ }
+
+ @Test
+ public void getApplyMostSignificantOnlyChangePolicy() throws Exception {
+ assertNotNull(ChangePropagationPolicy.MOST_SIGNIFICANT_ONLY_POLICY);
+ }
+
+ @Test
+ public void getApplySelectiveChangePolicy() throws Exception {
+
assertNotNull(ChangePropagationPolicy.getApplySelectiveChangePolicy("bla"));
+ }
+
+ @Test
+ public void getApplyNonePolicy() throws Exception {
+ assertNotNull(ChangePropagationPolicy.NONE_POLICY);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git
a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java
b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java
index 61be1fc..852f79b 100644
---
a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java
+++
b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java
@@ -16,11 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.tamaya.mutableconfig;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -40,12 +38,12 @@ public class MutableConfigurationProviderTest {
.createMutableConfiguration(Configuration.current());
assertNotNull(cfg);
assertEquals(cfg.getChangePropagationPolicy(),
-
MutableConfigurationProvider.getApplyMostSignificantOnlyChangePolicy());
+ ChangePropagationPolicy.MOST_SIGNIFICANT_ONLY_POLICY);
}
@Test
public void createMutableConfiguration2() throws Exception {
- ChangePropagationPolicy policy =
MutableConfigurationProvider.getApplySelectiveChangePolicy("blabla");
+ ChangePropagationPolicy policy =
ChangePropagationPolicy.getApplySelectiveChangePolicy("blabla");
MutableConfiguration cfg = MutableConfigurationProvider.getInstance()
.createMutableConfiguration(Configuration.current(),
policy);
@@ -55,7 +53,7 @@ public class MutableConfigurationProviderTest {
@Test
public void createMutableConfiguration3() throws Exception {
- ChangePropagationPolicy policy =
MutableConfigurationProvider.getApplySelectiveChangePolicy("gugus");
+ ChangePropagationPolicy policy =
ChangePropagationPolicy.getApplySelectiveChangePolicy("gugus");
MutableConfiguration cfg = MutableConfigurationProvider.getInstance()
.createMutableConfiguration(policy);
assertNotNull(cfg);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java
----------------------------------------------------------------------
diff --git
a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java
b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java
index eb1d354..337a6ce 100644
---
a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java
+++
b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java
@@ -19,7 +19,6 @@
package org.apache.tamaya.mutableconfig;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
import org.apache.tamaya.mutableconfig.internal.WritablePropertiesSource;
import org.apache.tamaya.mutableconfig.internal.WritableXmlPropertiesSource;
import org.junit.Test;
@@ -47,12 +46,12 @@ public class MutableConfigurationTest {
MutableConfiguration cfg =
MutableConfiguration.create(Configuration.current());
assertNotNull(cfg);
assertEquals(cfg.getChangePropagationPolicy(),
-
MutableConfigurationProvider.getApplyMostSignificantOnlyChangePolicy());
+ ChangePropagationPolicy.MOST_SIGNIFICANT_ONLY_POLICY);
}
@Test
public void createMutableConfiguration2() throws Exception {
- ChangePropagationPolicy policy =
MutableConfigurationProvider.getApplySelectiveChangePolicy("blabla");
+ ChangePropagationPolicy policy =
ChangePropagationPolicy.getApplySelectiveChangePolicy("blabla");
MutableConfiguration cfg = MutableConfiguration
.create(Configuration.current(),
policy);
@@ -62,7 +61,7 @@ public class MutableConfigurationTest {
@Test
public void createMutableConfiguration3() throws Exception {
- ChangePropagationPolicy policy =
MutableConfigurationProvider.getApplySelectiveChangePolicy("gugus");
+ ChangePropagationPolicy policy =
ChangePropagationPolicy.getApplySelectiveChangePolicy("gugus");
MutableConfiguration cfg = MutableConfiguration
.create(policy);
assertNotNull(cfg);
@@ -79,7 +78,7 @@ public class MutableConfigurationTest {
File f = File.createTempFile("ConfigChangeRequest",".properties");
MutableConfiguration cfg1 = MutableConfiguration.create(
Configuration.current(),
- MutableConfigurationProvider.getApplyAllChangePolicy());
+ ChangePropagationPolicy.ALL_POLICY);
assertNotNull(cfg1);
assertNotNull(cfg1.getConfigChangeRequest());
MutableConfiguration cfg2 = MutableConfiguration.create(
@@ -172,7 +171,7 @@ public class MutableConfigurationTest {
public void testReadWriteXmlProperties_WithCommit() throws IOException {
WritableXmlPropertiesSource.target.delete();
MutableConfiguration cfg = MutableConfiguration.create(
- Configuration.current(),
MutableConfigurationProvider.getApplyAllChangePolicy());
+ Configuration.current(), ChangePropagationPolicy.ALL_POLICY);
cfg.put("key1", "value1");
Map<String,String> cm = new HashMap<>();
cm.put("key2", "value2");
@@ -205,7 +204,7 @@ public class MutableConfigurationTest {
WritableXmlPropertiesSource.target.delete();
MutableConfiguration cfg = MutableConfiguration.create(
Configuration.current(),
- MutableConfigurationProvider.getApplyNonePolicy());
+ ChangePropagationPolicy.NONE_POLICY);
cfg.put("key1", "value1");
Map<String,String> cm = new HashMap<>();
cm.put("key2", "value2");
@@ -215,5 +214,4 @@ public class MutableConfigurationTest {
assertFalse(WritableXmlPropertiesSource.target.exists());
}
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/optional/pom.xml
----------------------------------------------------------------------
diff --git a/modules/optional/pom.xml b/modules/optional/pom.xml
index e5fa76b..497427a 100644
--- a/modules/optional/pom.xml
+++ b/modules/optional/pom.xml
@@ -34,6 +34,29 @@ under the License.
considers/uses Tamaya functionality.</description>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check</id>
+ <goals><goal>check</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.tamaya</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/resolver/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resolver/pom.xml b/modules/resolver/pom.xml
index 76661e4..92758be 100644
--- a/modules/resolver/pom.xml
+++ b/modules/resolver/pom.xml
@@ -31,6 +31,29 @@ under the License.
<name>Apache Tamaya Modules - Placeholder Resolver</name>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check</id>
+ <goals><goal>check</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.tamaya</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/resources/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resources/pom.xml b/modules/resources/pom.xml
index 4d6ddb1..83d4980 100644
--- a/modules/resources/pom.xml
+++ b/modules/resources/pom.xml
@@ -31,6 +31,29 @@ under the License.
<name>Apache Tamaya Modules - Resource Locator</name>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check</id>
+ <goals><goal>check</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>org.apache.tamaya</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index b3a4e1a..b2df0de 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -36,6 +36,29 @@ under the License.
<spring.boot.version>1.2.6.RELEASE</spring.boot.version>
</properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <configuration>
+ <oldArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${released_version}</artifact>
+ </oldArtifacts>
+ <newArtifacts>
+
<artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
+ </newArtifacts>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check</id>
+ <goals><goal>check</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4932c0cd/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 351e9f0..7ae1cf3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,6 +90,9 @@ under the License.
<!-- Dependencies for site generation -->
<reflow-skin.version>1.1.1</reflow-skin.version>
<released_version>0.3-incubating</released_version>
+ <!-- API checker -->
+ <revapi-java.version>0.18.0</revapi-java.version>
+ <revapi.plugin.version>0.10.5</revapi.plugin.version>
</properties>
<licenses>
@@ -356,6 +359,44 @@ under the License.
<pluginManagement>
<plugins>
<plugin>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-maven-plugin</artifactId>
+ <version>${revapi.plugin.version}</version>
+ <configuration>
+ <failSeverity>breaking</failSeverity>
+
<failBuildOnProblemsFound>false</failBuildOnProblemsFound>
+ <analysisConfiguration>
+ <revapi.reporter.text id="stdout">
+ <minSeverity>POTENTIALLY_BREAKING</minSeverity>
+ <output>out</output>
+ <append>false</append>
+ </revapi.reporter.text>
+ <revapi.filter>
+ <elements>
+ <exclude>
+ <item>.*internal.*</item>
+ <item>.*osgi.*</item>
+ </exclude>
+ </elements>
+ </revapi.filter>
+ </analysisConfiguration>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.revapi</groupId>
+ <artifactId>revapi-java</artifactId>
+ <version>${revapi-java.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>report</id>
+ <phase>package</phase>
+ <goals><goal>report</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>