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 2016/01/16 07:40:16 UTC
[1/3] incubator-tamaya git commit: TAMAYA-135: Added mutability for
configuration sources or mechanisms.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master 49d787d8f -> afb2d1a45
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java
----------------------------------------------------------------------
diff --git a/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java b/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java
deleted file mode 100644
index 6d393cf..0000000
--- a/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java
+++ /dev/null
@@ -1,136 +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.mutableconfig;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.Configuration;
-
-import java.util.Collection;
-import java.util.Map;
-
-
-/**
- * This interface extends the Configuration interface hereby adding methods to change configuration entries.
- * Hereby not all configuration entries are necessarily mutable, since some entries may be read from non
- * mutable areas of configuration. Of course, it is always possible to add a mutable shadow layer on top of all
- * configuration to enable whatever changes applied. The exact management and storage persistence algorithm should be
- * transparent.<br/>
- * As a consequence clients should first check, using the corresponding methods, if entries are to edited or removed
- * actually are eligible for change/creation or removal.
- */
-public interface ConfigChangeRequest{
-
- /**
- * Returns the configuration onto which the change should be applied.
- * @return the corresponding configuration, not null.
- */
- Configuration getConfiguration();
-
- /**
- * Checks if a configuration key is writable (or it can be added).
- *
- * @param keyExpression the key to be cheched for write access (including creation), not null. Here this could also
- * be a regulat expression, such "as a.b.c.*".
- */
- boolean isWritable(String keyExpression);
-
- /**
- * Checks if a configuration key is removable. This also implies that it is writable, but there might be writable
- * keys that cannot be removed.
- *
- * @param keyExpression the keyExpression the key to be cheched for write access (including creation), not null. Here this could also
- * be a regulat expression, such "as a.b.c.*".
- */
- boolean isRemovable(String keyExpression);
-
- /**
- * Sets a property.
- *
- * @param key the property's key, not null.
- * @param value the property's value, not null.
- * @return the former property value, or null.
- * @throws ConfigException if the key/value cannot be added.
- */
- String put(String key, String value);
-
- /**
- * Puts all given configuration entries. This method should check that all given properties are
- * basically removable, as defined by #isWritable. If any of the passed keys is not writable during this initial
- * check, the operation should not perform any configuration changes and throw a {@link ConfigException}. If errors
- * occur afterwards, when the properties are effectively written back to the backends, the errors should be
- * collected and returned as part of the ConfigException payload. Nevertheless the operation should in that case
- * remove all entries as far as possible and abort the writing operation.
- *
- * @param properties the properties tobe written, not null.
- * @throws ConfigException if any of the given properties could not be written.
- */
- void putAll(Map<String, String> properties);
-
- /**
- * Removes a configuration entry.
- *
- * @param key the property's key, not null.
- * @throws ConfigException if the given cannot be removed.
- * @return the property's keys.
- */
- void remove(String key);
-
- /**
- * Removes all given configuration entries. This method should check that all given properties are
- * basically removable, as defined by #isRemovable. If any of the passed keys is not removable during this initial
- * check, the operation should not perform any configuration changes and throw a {@link ConfigException}. If errors
- * occur afterwards, when the properties are effectively written back to the backends, the errors should be
- * collected and returned as part of the ConfigException payload. Nevertheless the operation should in that case
- * remove all entries as far as possible and abort the writing operation.
- *
- * @param keys the property's keys to be removed, not null.
- * @throws ConfigException if any of the given keys could not be removed.
- */
- void removeAll(Collection<String> keys);
-
- /**
- * Resets all changes, leaving the request still open for further operations.
- */
- void reset();
-
- /**
- * Closes the request, sby default any uncommitted changes are committed.
- */
- void commit();
-
- /**
- * Closes the request,
- * @param saveChanges flag to control if any uncommitted changes ahould be written (default: yes).
- */
- void commit(boolean saveChanges);
-
- /**
- * Operation to check, if the current request is closed. Closed requests are read-only and can not be used
- * for preparing/submitting any configuration changes.
- * @return true, if this instance is closed.
- */
- boolean isCommitted();
-
- /**
- * Access the summary of the changes applied
- * @return
- */
- ChangeSummary getChangeSummary();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigurationChangeProviderSpi.java
----------------------------------------------------------------------
diff --git a/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigurationChangeProviderSpi.java b/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigurationChangeProviderSpi.java
deleted file mode 100644
index e378c0d..0000000
--- a/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigurationChangeProviderSpi.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.mutableconfig.spi;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.mutableconfig.ConfigChangeRequest;
-
-/**
- * Provider SPI for the {@link org.apache.tamaya.mutableconfig.ConfigChangeProvider}.
- */
-public interface ConfigurationChangeProviderSpi {
-
- /**
- * Creates a new change request for the given Configuration.
- * @param config the configuration.
- * @return a new ChangeRequest
- * @throws UnsupportedOperationException if no change providers are registered.
- */
- ConfigChangeRequest createChangeRequest(Configuration config);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/pom.xml b/sandbox/pom.xml
index 8168c47..249c18a 100644
--- a/sandbox/pom.xml
+++ b/sandbox/pom.xml
@@ -29,7 +29,7 @@ under the License.
<artifactId>tamaya-sandbox</artifactId>
<groupId>org.apache.tamaya.ext</groupId>
- <name>Apache Tamaya Sandbox Modules</name>
+ <name>Apache Tamaya Sandbox</name>
<description>This project contains the several extensions that can be used with Tamaya, but are not (yet) ready for
a release.</description>
<packaging>pom</packaging>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/sysprops/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/sysprops/pom.xml b/sandbox/sysprops/pom.xml
index 2fe0dd2..96f0cd9 100644
--- a/sandbox/sysprops/pom.xml
+++ b/sandbox/sysprops/pom.xml
@@ -27,7 +27,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
<artifactId>tamaya-sysprops</artifactId>
- <name>Apache Tamaya - Configured Java SE System Properties</name>
+ <name>Apache Tamaya Modules - Configured Java SE System Properties</name>
<packaging>bundle</packaging>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/ui/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/ui/pom.xml b/sandbox/ui/pom.xml
index bb524f4..b40563e 100644
--- a/sandbox/ui/pom.xml
+++ b/sandbox/ui/pom.xml
@@ -30,6 +30,7 @@ under the License.
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<artifactId>tamaya-ui</artifactId>
+ <name>Apache Tamaya Modules - UI</name>
<modules>
<module>jsf</module>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/src/site/asciidoc/extensions/index.adoc
----------------------------------------------------------------------
diff --git a/src/site/asciidoc/extensions/index.adoc b/src/site/asciidoc/extensions/index.adoc
index 9607d80..5f87490 100644
--- a/src/site/asciidoc/extensions/index.adoc
+++ b/src/site/asciidoc/extensions/index.adoc
@@ -47,7 +47,8 @@ Mature extensions have a stable API and SPI, similar to the API and Implementati
|+org.apache.tamaya.ext:tamaya-functions+ |Provides several functional extension points. |link:mod_functions.html[Documentation]
|+org.apache.tamaya.ext:tamaya-optional+ |Lets a Tamaya configuration to be used as an optional project extension only. |link:mod_optional.html[Documentation]
|+org.apache.tamaya.ext:tamaya-spi-support+ |Tamaya support module for SPI implementation. |link:mod_spi-support.html[Documentation]
-|+org.apache.tamaya.ext:tamaya-json+ |Provides format support for JSON based configuration. |link:modjson.html[Documentation]
+|+org.apache.tamaya.ext:tamaya-json+ |Provides format support for JSON based configuration. |link:mod_json.html[Documentation]
+|+org.apache.tamaya.ext:tamaya-mutable-config+|Provides API/SPI for writing configuration |link:mod_mutable_config.html[Documentation]
|=======
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/src/site/asciidoc/extensions/mod_etcd.adoc
----------------------------------------------------------------------
diff --git a/src/site/asciidoc/extensions/mod_etcd.adoc b/src/site/asciidoc/extensions/mod_etcd.adoc
index 22247fd..a477887 100644
--- a/src/site/asciidoc/extensions/mod_etcd.adoc
+++ b/src/site/asciidoc/extensions/mod_etcd.adoc
@@ -78,6 +78,8 @@ ETcd integration comes basically with 2 artifacts:
atomic write methods are implemented.
* The +org.apache.tamaya.etcd.EtcdPropertySource+ is a +PropertySource+ with a default ordinal of 100 and the name 'etcd', which is
automatically registered.
+* If the +tamaya-mutable-config+ module is loaded it is possible to write property values back into the etcd cluster,
+ by accessing a +ConfigChangeRequest+ using the URI +config:etcd+.
=== The EtcdAccessor
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/src/site/asciidoc/extensions/mod_mutable_config.adoc
----------------------------------------------------------------------
diff --git a/src/site/asciidoc/extensions/mod_mutable_config.adoc b/src/site/asciidoc/extensions/mod_mutable_config.adoc
new file mode 100644
index 0000000..e09497b
--- /dev/null
+++ b/src/site/asciidoc/extensions/mod_mutable_config.adoc
@@ -0,0 +1,143 @@
+= Apache Tamaya -- Extension: Events
+
+:name: Tamaya
+:rootpackage: org.apache.tamaya.mutableconfig
+:title: Apache Tamaya Extension: Mutable Configuration
+:revnumber: 0.1
+:revremark: Incubator
+:revdate: March 2016
+:longversion: {revnumber} ({revremark}) {revdate}
+:authorinitials: ATR
+:author: Anatole Tresch
+:email: <an...@apache.org>
+:source-highlighter: coderay
+:website: http://tamaya.incubator.apache.org/
+:toc:
+:toc-placement: manual
+:encoding: UTF-8
+:numbered:
+// 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.
+'''
+
+<<<
+
+toc::[]
+
+<<<
+:numbered!:
+<<<
+[[Core]]
+== Tamaya Mutable Configuration (Extension Module)
+=== Overview
+
+Tamaya Configuration by default is read-only, which covers must of the use cases. Make it writable through out
+creates also a bunch of new issues, especially with distributed configuration services and eventual consistency.
+Therefore mutability of configuration is modelled in Tamaya as a separate concern. This module defines the API
+to be used, whereas multiple mutable backends can register their mechanism to write configuration properties.
+
+=== Compatibility
+
+The module is based on Java 7, so it can be used with Java 7 and beyond.
+
+=== Installation
+
+To benefit from configuration mutability support you only must add the corresponding dependency to your module:
+
+[source, xml]
+-----------------------------------------------
+<dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-mutable-config</artifactId>
+ <version>{tamayaVersion}</version>
+</dependency>
+-----------------------------------------------
+
+=== Core Architecture
+
+The core of the module is the +ConfigChangeManager+ singleton, which creates a +ConfigChangeReuqest+ class for
+a +configurationTarget+ passed. The supported target +URIs+ hereby are determined (and must be documented) by
+the registered backend spis. If not sure you can call +getSupportedURIInfo()+ to see, which kind of URI's
+supported.
+As an example writing configuration entries to an +etcd+ server can be done as follows:
+
+[source,java]
+.Writing configuration to etcd
+--------------------------------------------
+ConfigChangeRequest request = ConfigChangeManager.createChangeRequest(new URI("etc:http://127.0.0.1:4441"));
+ChangeSummary summary = request
+ .set("newKey", "newValue").set("anotherKey", "updatedValue")
+ .remove("valueNotValid")
+ .commit();
+--------------------------------------------
+
+The effective effect of your changes to the overall configuration changes cannot be easily predicted, since it depends
+on several aspects:
+
+. is the corresponding configuration resource configured as part of the current system's configuration?
+. what is the +PropertySource's+ ordinal? Is it overriding or overriden by other sources?
+. is the change directly visible to the configuration system? E.g. injected values are normally not updated,
+ whereas injecting a +DynamicValue<T>+ instance allows to detect and react single value changes. Also the
+ +PropertySources+ implementation must be able to detect any configuration changes and adapt its values returned
+ accordingly.
+. Is configuration cached, or written/collected directly on access?
+. can the changes applied be committed at all?
+
+So it is part of your application configuration design to clearly define, which confoguration may be read-only, which
+may be mutable, how overridings should work and to which backends finally any changes should be written back. To
+support such fine granular scenarios the +ConfigChangeRequest+ interface also has methods to determine if a key
+is writable at all for a given configuration target:
+
+[source,java]
+.Checking for mutability
+--------------------------------------------
+ConfigChangeRequest request = ConfigChangeManager.createChangeRequest(new URI("file://$USER_HOME/.myapp/mapp.properties"));
+if(request,isWritable("mycluster.shared.appKey")){
+ request.set("newKey", "newValue")
+ .remove("valueNotValid")
+ .commit();
+}else{
+ request.cancel();
+}
+--------------------------------------------
+
+=== Configuration Changes
+
+This module does not handle detection of changes to the overall system's +Configuration+. This can be done in
+several ways, e.g. by:
+
+* using the _tamaya-events_ extension, which can be used to observe the system's configuration and
+ publishing events when things have been changed.
+* The SPI implementing the +ConfigChangeManagerSpi+ may inform/update any affected +PropertySource,
+ PropertySourceProvider+ instances about the changes applied.
+
+
+=== SPIs
+
+The module defines only one single SPI, that must be implemented to implement the fabric method
++createChangeRequest(URI)+ of the +ConfigChangeManager+ singleton:
+
+[source,java]
+.SPI: ConfigEventSpi
+--------------------------------------------------
+public interface ConfigChangeManagerSpi {
+ ConfigChangeRequest createChangeRequest(URI backendURI);
+}
+--------------------------------------------------
+
+Implementations are registered with the current +ServiceContext+, be default as with
+ +java.util.ServiceLoader+.
[2/3] incubator-tamaya git commit: TAMAYA-135: Added mutability for
configuration sources or mechanisms.
Posted by an...@apache.org.
TAMAYA-135: Added mutability for configuration sources or mechanisms.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/c2f1b151
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/c2f1b151
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/c2f1b151
Branch: refs/heads/master
Commit: c2f1b151075a6d5d850a71c9718cc97bca55063b
Parents: 49d787d
Author: anatole <an...@apache.org>
Authored: Sat Jan 16 07:39:34 2016 +0100
Committer: anatole <an...@apache.org>
Committed: Sat Jan 16 07:39:34 2016 +0100
----------------------------------------------------------------------
modules/integration/etcd/pom.xml | 9 +-
.../org/apache/tamaya/etcd/EtcdBackends.java | 47 ++++++
.../apache/tamaya/etcd/EtcdPropertySource.java | 33 +---
.../etcd/internal/EtcdConfigChangeRequest.java | 63 ++++++++
.../etcd/internal/MutableConfigSupport.java | 44 ++++++
...aya.mutableconfig.spi.ConfigChangeManagerSpi | 19 +++
modules/mutable-config/pom.xml | 81 ++++++++++
.../mutableconfig/ConfigChangeManager.java | 53 +++++++
.../mutableconfig/ConfigChangeRequest.java | 157 +++++++++++++++++++
.../MutablePropertiesConfigSupport.java | 52 ++++++
.../PropertiesFileConfigChangeRequest.java | 99 ++++++++++++
.../XmlPropertiesFileConfigChangeRequest.java | 99 ++++++++++++
.../spi/AbstractConfigChangeRequest.java | 143 +++++++++++++++++
.../spi/ConfigChangeManagerSpi.java | 37 +++++
...aya.mutableconfig.spi.ConfigChangeManagerSpi | 19 +++
.../mutableconfig/ConfigChangeManagerTest.java | 53 +++++++
.../PropertiesFileConfigChangeRequestTest.java | 109 +++++++++++++
sandbox/integration/commons/pom.xml | 2 +-
sandbox/integration/store/pom.xml | 80 ----------
.../org/apache/tamaya/store/PropertyStore.java | 64 --------
.../tamaya/store/PropertyStoreProvider.java | 78 ---------
.../tamaya/store/WritablePropertySource.java | 66 --------
.../store/spi/DefaultStoredPropertySource.java | 137 ----------------
.../store/spi/PropertyStoreProviderSpi.java | 34 ----
sandbox/jodatime/pom.xml | 2 +-
sandbox/metamodels/pom.xml | 2 +-
sandbox/mutable-config/pom.xml | 81 ----------
.../tamaya/mutableconfig/ChangeSummary.java | 105 -------------
.../mutableconfig/ConfigChangeProvider.java | 50 ------
.../mutableconfig/ConfigChangeRequest.java | 136 ----------------
.../spi/ConfigurationChangeProviderSpi.java | 37 -----
sandbox/pom.xml | 2 +-
sandbox/sysprops/pom.xml | 2 +-
sandbox/ui/pom.xml | 1 +
src/site/asciidoc/extensions/index.adoc | 3 +-
src/site/asciidoc/extensions/mod_etcd.adoc | 2 +
.../asciidoc/extensions/mod_mutable_config.adoc | 143 +++++++++++++++++
37 files changed, 1242 insertions(+), 902 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/integration/etcd/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration/etcd/pom.xml b/modules/integration/etcd/pom.xml
index 2c743f1..041d98e 100644
--- a/modules/integration/etcd/pom.xml
+++ b/modules/integration/etcd/pom.xml
@@ -27,7 +27,7 @@ under the License.
</parent>
<artifactId>tamaya-etcd</artifactId>
- <name>Apache Tamaya Modules Integration - etcd</name>
+ <name>Apache Tamaya Integration - etcd</name>
<packaging>bundle</packaging>
<properties>
@@ -108,6 +108,13 @@ under the License.
<groupId>org.apache.johnzon</groupId>
<artifactId>johnzon-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-mutable-config</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/c2f1b151/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdBackends.java
----------------------------------------------------------------------
diff --git a/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdBackends.java b/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdBackends.java
new file mode 100644
index 0000000..b424625
--- /dev/null
+++ b/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdBackends.java
@@ -0,0 +1,47 @@
+package org.apache.tamaya.etcd;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Created by atsticks on 15.01.16.
+ */
+public final class EtcdBackends {
+
+ private static final Logger LOG = Logger.getLogger(EtcdBackends.class.getName());
+ private static List<EtcdAccessor> etcdBackends = new ArrayList<>();
+
+ static{
+ int timeout = 2;
+ String val = System.getProperty("tamaya.etcd.timeout");
+ if(val == null){
+ val = System.getenv("tamaya.etcd.timeout");
+ }
+ if(val!=null){
+ timeout = Integer.parseInt(val);
+ }
+ String serverURLs = System.getProperty("tamaya.etcd.server.urls");
+ if(serverURLs==null){
+ serverURLs = System.getenv("tamaya.etcd.server.urls");
+ }
+ if(serverURLs==null){
+ serverURLs = "http://127.0.0.1:4001";
+ }
+ for(String url:serverURLs.split("\\,")) {
+ try{
+ etcdBackends.add(new EtcdAccessor(url.trim(), timeout));
+ LOG.info("Using etcd endoint: " + url);
+ } catch(Exception e){
+ LOG.log(Level.SEVERE, "Error initializing etcd accessor for URL: " + url, e);
+ }
+ }
+ }
+
+ private EtcdBackends(){}
+
+ public static List<EtcdAccessor> getEtcdBackends(){
+ return etcdBackends;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java b/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java
index a07c504..b441141 100644
--- a/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java
+++ b/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java
@@ -31,33 +31,12 @@ import java.util.logging.Logger;
*/
public class EtcdPropertySource implements PropertySource{
private static final Logger LOG = Logger.getLogger(EtcdPropertySource.class.getName());
- private List<EtcdAccessor> etcdBackends = new ArrayList<>();
+
private String prefix = System.getProperty("tamaya.etcd.prefix", "");
public EtcdPropertySource(){
- int timeout = 2;
- String val = System.getProperty("tamaya.etcd.timeout");
- if(val == null){
- val = System.getenv("tamaya.etcd.timeout");
- }
- if(val!=null){
- timeout = Integer.parseInt(val);
- }
- String serverURLs = System.getProperty("tamaya.etcd.server.urls");
- if(serverURLs==null){
- serverURLs = System.getenv("tamaya.etcd.server.urls");
- }
- if(serverURLs==null){
- serverURLs = "http://127.0.0.1:4001";
- }
- for(String url:serverURLs.split("\\,")) {
- try{
- etcdBackends.add(new EtcdAccessor(url.trim(), timeout));
- LOG.info("Using etcd endoint: " + url);
- } catch(Exception e){
- LOG.log(Level.SEVERE, "Error initializing etcd accessor for URL: " + url, e);
- }
- }
+
+
}
@Override
@@ -112,7 +91,7 @@ public class EtcdPropertySource implements PropertySource{
reqKey = reqKey.substring(0,reqKey.length()-".source".length());
}
}
- for(EtcdAccessor accessor:etcdBackends){
+ for(EtcdAccessor accessor: EtcdBackends.getEtcdBackends()){
try{
props = accessor.get(reqKey);
if(!props.containsKey("_ERROR")) {
@@ -130,8 +109,8 @@ public class EtcdPropertySource implements PropertySource{
@Override
public Map<String, String> getProperties() {
- if(etcdBackends.isEmpty()){
- for(EtcdAccessor accessor:etcdBackends){
+ if(EtcdBackends.getEtcdBackends().isEmpty()){
+ for(EtcdAccessor accessor: EtcdBackends.getEtcdBackends()){
try{
Map<String, String> props = accessor.getProperties("");
if(!props.containsKey("_ERROR")) {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/internal/EtcdConfigChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/internal/EtcdConfigChangeRequest.java b/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/internal/EtcdConfigChangeRequest.java
new file mode 100644
index 0000000..c088ed7
--- /dev/null
+++ b/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/internal/EtcdConfigChangeRequest.java
@@ -0,0 +1,63 @@
+package org.apache.tamaya.etcd.internal;
+
+import org.apache.tamaya.etcd.EtcdAccessor;
+import org.apache.tamaya.etcd.EtcdBackends;
+import org.apache.tamaya.mutableconfig.spi.AbstractConfigChangeRequest;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Change Request implementation based on etcd services.
+ */
+class EtcdConfigChangeRequest extends AbstractConfigChangeRequest{
+
+ private static final Logger LOG = Logger.getLogger(EtcdConfigChangeRequest.class.getName());
+
+ EtcdConfigChangeRequest(URI uri){
+ super(uri);
+ }
+
+ @Override
+ public boolean exists(String keyExpression) {
+ for(EtcdAccessor accessor: EtcdBackends.getEtcdBackends()){
+ try{
+ Map<String,String> props = accessor.get(keyExpression);
+ if(!props.containsKey("_ERROR")) {
+ // No repfix mapping necessary here, since we only access/return the value...
+ return props.get(keyExpression)!=null;
+ }
+ } catch(Exception e){
+ LOG.log(Level.FINE, "etcd access failed on " + accessor.getUrl() + ", trying next...", e);
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ protected void commitInternal() {
+ checkClosed();
+ for(EtcdAccessor accessor: EtcdBackends.getEtcdBackends()){
+ try{
+ for(String k:getRemoved()){
+ Map<String,String> res = accessor.delete(k);
+ if(res.get("_ERROR")!=null){
+ LOG.info("Failed to remove key from etcd: " + k);
+ }
+ }
+ for(Map.Entry<String,String> en:getProperties().entrySet()){
+ Map<String,String> res = accessor.set(en.getKey(), en.getValue());
+ if(res.get("_ERROR")!=null){
+ LOG.info("Failed key from etcd: " + en.getKey() + "=" + en.getValue());
+ }
+ }
+ } catch(Exception e){
+ LOG.log(Level.FINE, "etcd access failed on " + accessor.getUrl() + ", trying next...", e);
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/internal/MutableConfigSupport.java
----------------------------------------------------------------------
diff --git a/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/internal/MutableConfigSupport.java b/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/internal/MutableConfigSupport.java
new file mode 100644
index 0000000..bfcd18c
--- /dev/null
+++ b/modules/integration/etcd/src/main/java/org/apache/tamaya/etcd/internal/MutableConfigSupport.java
@@ -0,0 +1,44 @@
+/*
+ * 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.etcd.internal;
+
+import org.apache.tamaya.mutableconfig.ConfigChangeRequest;
+import org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi;
+
+import java.net.URI;
+
+/**
+ * Created by atsticks on 15.01.16.
+ */
+public class MutableConfigSupport implements ConfigChangeManagerSpi{
+
+ private URI backendURI;
+
+ public MutableConfigSupport(){
+ backendURI = URI.create("config:etcd");
+ }
+
+ @Override
+ public ConfigChangeRequest createChangeRequest(URI uri) {
+ if(backendURI.equals(uri)) {
+ return new EtcdConfigChangeRequest(backendURI);
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/integration/etcd/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi
----------------------------------------------------------------------
diff --git a/modules/integration/etcd/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi b/modules/integration/etcd/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi
new file mode 100644
index 0000000..2189807
--- /dev/null
+++ b/modules/integration/etcd/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi
@@ -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.etcd.internal.MutableConfigSupport
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mutable-config/pom.xml b/modules/mutable-config/pom.xml
new file mode 100644
index 0000000..f551a21
--- /dev/null
+++ b/modules/mutable-config/pom.xml
@@ -0,0 +1,81 @@
+<!--
+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-incubating-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>tamaya-mutable-config</artifactId>
+ <name>Apache Tamaya Modules - Mutable Configuration Support</name>
+ <description>This module provides abstraction, if your scenario needs to actively change configuration entries
+ and write changes back to some property sources, files etc.</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <jdkVersion>1.7</jdkVersion>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-events</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-core</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.apache.tamaya.mutableconfig
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeManager.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeManager.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeManager.java
new file mode 100644
index 0000000..6c18b87
--- /dev/null
+++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeManager.java
@@ -0,0 +1,53 @@
+/*
+ * 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.apache.tamaya.ConfigException;
+import org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi;
+import org.apache.tamaya.spi.ServiceContextManager;
+
+import java.net.URI;
+import java.util.Objects;
+
+/**
+ * Accessor for creating {@link ConfigChangeRequest} instances to change and commite configuration.
+ */
+public final class ConfigChangeManager {
+
+ /** Singleton constructor. */
+ private ConfigChangeManager(){}
+
+ /**
+ * Creates a new change request for the given configurationSource
+ * @return a new ChangeRequest
+ * @throws org.apache.tamaya.ConfigException if the given configurationSource cannot be edited.
+ */
+ public static ConfigChangeRequest createChangeRequest(URI configurationSource){
+ Objects.requireNonNull(configurationSource);
+ for(ConfigChangeManagerSpi spi:ServiceContextManager.getServiceContext()
+ .getServices(ConfigChangeManagerSpi.class)){
+ ConfigChangeRequest req = spi.createChangeRequest(configurationSource);
+ if(req!=null){
+ return req;
+ }
+ }
+ throw new ConfigException("Not an editable configuration source: " + configurationSource);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java
new file mode 100644
index 0000000..9bbb2c0
--- /dev/null
+++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java
@@ -0,0 +1,157 @@
+/*
+ * 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 java.net.URI;
+import java.util.Collection;
+import java.util.Map;
+
+
+/**
+ * This interface extends the Configuration interface hereby adding methods to change configuration entries.
+ * Hereby not all configuration entries are necessarily mutable, since some entries may be read from non
+ * mutable areas of configuration. Of course, it is always possible to add a mutable shadow layer on top of all
+ * configuration to enable whatever changes applied. The exact management and storage persistence algorithm should be
+ * transparent.<br/>
+ * As a consequence clients should first check, using the corresponding methods, if entries are to edited or removed
+ * actually are eligible for change/creation or removal.
+ */
+public interface ConfigChangeRequest {
+
+ /**
+ * Get the unique id of this change reqeust (UUID).
+ * @return the unique id of this change reqeust (UUID).
+ */
+ String getRequestID();
+
+ /**
+ * Identifies the configuration backend that was used to create this request instance and which is
+ * also responsible for writing back the changes on this instance.
+ * @return the backend URI, never null.
+ */
+ URI getBackendURI();
+
+ /**
+ * Checks if a configuration key is writable (or it can be added).
+ *
+ * @param keyExpression the key to be cheched for write access (including creation), not null. Here this could also
+ * be a regulat expression, such "as a.b.c.*".
+ */
+ boolean isWritable(String keyExpression);
+
+ /**
+ * Checks if a configuration key is removable. This also implies that it is writable, but there might be writable
+ * keys that cannot be removed.
+ *
+ * @param keyExpression the keyExpression the key to be cheched for write access (including creation), not null. Here this could also
+ * be a regulat expression, such "as a.b.c.*".
+ */
+ boolean isRemovable(String keyExpression);
+
+ /**
+ * Checks if any keys of the given type already exist in the backend. <b>NOTE:</b> there may be backends that
+ * are not able to supportlookups with regular expressions. In most such cases you should pass the keys to
+ * lookup explicitly.
+ * @param keyExpression the key to be cheched for write access (including creation), not null. Here this could
+ * also be a regulat expression, such "as a.b.c.*".
+ * @return true, if there is any key found matching the expression.
+ */
+ boolean exists(String keyExpression);
+
+ /**
+ * Sets a property.
+ *
+ * @param key the property's key, not null.
+ * @param value the property's value, not null.
+ * @return the former property value, or null.
+ * @throws org.apache.tamaya.ConfigException if the key/value cannot be added, or the request is read-only.
+ */
+ ConfigChangeRequest put(String key, String value);
+
+ /**
+ * Puts all given configuration entries. This method should check that all given properties are
+ * basically removable, as defined by #isWritable. If any of the passed keys is not writable during this initial
+ * check, the operation should not perform any configuration changes and throw a {@link org.apache.tamaya.ConfigException}. If errors
+ * occur afterwards, when the properties are effectively written back to the backends, the errors should be
+ * collected and returned as part of the ConfigException payload. Nevertheless the operation should in that case
+ * remove all entries as far as possible and abort the writing operation.
+ *
+ * @param properties the properties tobe written, not null.
+ * @throws org.apache.tamaya.ConfigException if any of the given properties could not be written, or the request is read-only.
+ */
+ ConfigChangeRequest putAll(Map<String, String> properties);
+
+ /**
+ * Removes a configuration entry.
+ *
+ * @param keys the property's keys, not null.
+ * @throws org.apache.tamaya.ConfigException if the given cannot be removed.
+ * @return the property's keys, or the request is read-only.
+ */
+ ConfigChangeRequest remove(String... keys);
+
+ /**
+ * Removes all given configuration entries. This method should check that all given properties are
+ * basically removable, as defined by #isRemovable. If any of the passed keys is not removable during this initial
+ * check, the operation should not perform any configuration changes and throw a {@link org.apache.tamaya.ConfigException}. If errors
+ * occur afterwards, when the properties are effectively written back to the backends, the errors should be
+ * collected and returned as part of the ConfigException payload. Nevertheless the operation should in that case
+ * remove all entries as far as possible and abort the writing operation.
+ *
+ * @param keys the property's keys to be removed, not null.
+ * @throws org.apache.tamaya.ConfigException if any of the given keys could not be removed, or the request is read-only.
+ */
+ ConfigChangeRequest remove(Collection<String> keys);
+
+ /**
+ * Removes all given configuration entries. This method should check that all given properties are
+ * basically removable, as defined by #isRemovable. If any of the passed keys is not removable during this initial
+ * check, the operation should not perform any configuration changes and throw a {@link org.apache.tamaya.ConfigException}. If errors
+ * occur afterwards, when the properties are effectively written back to the backends, the errors should be
+ * collected and returned as part of the ConfigException payload. Nevertheless the operation should in that case
+ * remove all entries as far as possible and abort the writing operation.
+ *
+ * @param keys the property's keys to be removed, not null.
+ * @throws org.apache.tamaya.ConfigException if any of the given keys could not be removed, or the request is read-only.
+ */
+ ConfigChangeRequest removeAll(String... keys);
+
+ /**
+ * Commits the request. After a commit the change is not editable anymore. All changes applied will be written to
+ * the corresponding configuration backend.
+ " @throws ConfigException if the request already has been committed or cancelled, or the commit fails.
+ */
+ void commit();
+
+ /**
+ * Cancel the given request, leaving everything unchanged. Cancelled requests are read-only and can not be used
+ * for preparing/submitting any configuration changes.
+ * @return true, if this instance is closed.
+ * @throws org.apache.tamaya.ConfigException if the request already has been committed or cancelled.
+ */
+ public void cancel();
+
+ /**
+ * Operation to check, if the current request is closed (either commited or cancelled). Closed requests are
+ * read-only and can not be used for preparing/submitting any configuration changes.
+ * @return true, if this instance is closed.
+ */
+ boolean isClosed();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/MutablePropertiesConfigSupport.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/MutablePropertiesConfigSupport.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/MutablePropertiesConfigSupport.java
new file mode 100644
index 0000000..04e2858
--- /dev/null
+++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/MutablePropertiesConfigSupport.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.mutableconfig.internal;
+
+import org.apache.tamaya.mutableconfig.ConfigChangeRequest;
+import org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi;
+
+import java.io.File;
+import java.net.URI;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Mutable Config Requestfactory that tries to convert given URIs to file references, if successful, it returns
+ * ConfigChangeRequests fir .properties and .xml files.
+ */
+public class MutablePropertiesConfigSupport implements ConfigChangeManagerSpi{
+
+ private static final Logger LOG = Logger.getLogger(XmlPropertiesFileConfigChangeRequest.class.getName());
+
+ @Override
+ public ConfigChangeRequest createChangeRequest(URI uri) {
+ try{
+ File f = new File(uri);
+ if(f.getName().endsWith(".properties")){
+ return new PropertiesFileConfigChangeRequest(f);
+ }else if(f.getName().endsWith(".xml")){
+ return new XmlPropertiesFileConfigChangeRequest(f);
+ }
+ } catch(Exception e){
+ LOG.log(Level.FINEST, "URI not convertible to file, ignoring " + uri, e);
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigChangeRequest.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigChangeRequest.java
new file mode 100644
index 0000000..e393461
--- /dev/null
+++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigChangeRequest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.mutableconfig.spi.AbstractConfigChangeRequest;
+
+import java.io.*;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Change Request implementation based on .properties file.
+ */
+class PropertiesFileConfigChangeRequest extends AbstractConfigChangeRequest{
+
+ private static final Logger LOG = Logger.getLogger(PropertiesFileConfigChangeRequest.class.getName());
+
+ private File file;
+
+ private Properties properties = new Properties();
+
+ PropertiesFileConfigChangeRequest(File file){
+ super(file.toURI());
+ this.file = file;
+ if(file.exists()) {
+ try (InputStream is = getBackendURI().toURL().openStream()) {
+ properties.load(is);
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to load properties from " + file, e);
+ }
+ }
+ }
+
+ @Override
+ public boolean exists(String keyExpression) {
+ if(properties.containsKey(keyExpression)){
+ return true;
+ }
+ for(Object key:properties.keySet()){
+ if(key.toString().matches(keyExpression)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ protected void commitInternal() {
+ if(!file.exists()){
+ try {
+ if(!file.createNewFile()){
+ throw new ConfigException("Failed to create config file " + file);
+ }
+ } catch (IOException e) {
+ throw new ConfigException("Failed to create config file " + file, e);
+ }
+ }
+ for(Map.Entry<String,String> en:super.properties.entrySet()){
+ this.properties.put(en.getKey(), en.getValue());
+ }
+ for(String rmKey:super.removed){
+ this.properties.remove(rmKey);
+ }
+ try(BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))){
+ properties.store(bos, "Properties written from Tamaya, request: " + getRequestID());
+ bos.flush();
+ }
+ catch(Exception e){
+ throw new ConfigException("Failed to write config to " + file, e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "PropertiesFileConfigChangeRequest{" +
+ "file=" + file +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/XmlPropertiesFileConfigChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/XmlPropertiesFileConfigChangeRequest.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/XmlPropertiesFileConfigChangeRequest.java
new file mode 100644
index 0000000..6ec2363
--- /dev/null
+++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/internal/XmlPropertiesFileConfigChangeRequest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.mutableconfig.spi.AbstractConfigChangeRequest;
+
+import java.io.*;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Change Request implementation based on .xml properties fiel.
+ */
+class XmlPropertiesFileConfigChangeRequest extends AbstractConfigChangeRequest{
+
+ private static final Logger LOG = Logger.getLogger(XmlPropertiesFileConfigChangeRequest.class.getName());
+
+ private File file;
+
+ private Properties properties = new Properties();
+
+ XmlPropertiesFileConfigChangeRequest(File file){
+ super(file.toURI());
+ this.file = file;
+ if(file.exists()) {
+ try (InputStream is = getBackendURI().toURL().openStream()) {
+ properties.loadFromXML(is);
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Failed to load properties from " + file, e);
+ }
+ }
+ }
+
+ @Override
+ public boolean exists(String keyExpression) {
+ if(properties.containsKey(keyExpression)){
+ return true;
+ }
+ for(Object key:properties.keySet()){
+ if(key.toString().matches(keyExpression)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ protected void commitInternal() {
+ if(!file.exists()){
+ try {
+ if(!file.createNewFile()){
+ throw new ConfigException("Failed to create config file " + file);
+ }
+ } catch (IOException e) {
+ throw new ConfigException("Failed to create config file " + file, e);
+ }
+ }
+ for(Map.Entry<String,String> en:super.properties.entrySet()){
+ this.properties.put(en.getKey(), en.getValue());
+ }
+ for(String rmKey:super.removed){
+ this.properties.remove(rmKey);
+ }
+ try(BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))){
+ properties.storeToXML(bos, "Properties written from Tamaya, request: " + getRequestID());
+ bos.flush();
+ }
+ catch(Exception e){
+ throw new ConfigException("Failed to write config to " + file, e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "XmlPropertiesFileConfigChangeRequest{" +
+ "file=" + file +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/AbstractConfigChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/AbstractConfigChangeRequest.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/AbstractConfigChangeRequest.java
new file mode 100644
index 0000000..0fdd43d
--- /dev/null
+++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/AbstractConfigChangeRequest.java
@@ -0,0 +1,143 @@
+/*
+ * 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.spi;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.mutableconfig.ConfigChangeRequest;
+
+import java.net.URI;
+import java.util.*;
+
+/**
+ * Base class for implementing a ConfigChangeRequest.
+ */
+public abstract class AbstractConfigChangeRequest implements ConfigChangeRequest {
+
+ private final URI uri;
+ private String requestID = UUID.randomUUID().toString();
+ protected Map<String,String> properties = new HashMap<>();
+ protected Set<String> removed = new HashSet<>();
+ private boolean closed = false;
+
+ protected AbstractConfigChangeRequest(URI uri){
+ this.uri = Objects.requireNonNull(uri);
+ }
+
+ /**
+ * Get the unique id of this change reqeust (UUID).
+ * @return the unique id of this change reqeust (UUID).
+ */
+ @Override
+ public String getRequestID(){
+ return requestID;
+ }
+
+ @Override
+ public final URI getBackendURI() {
+ return uri;
+ }
+
+ @Override
+ public boolean isWritable(String keyExpression) {
+ return true;
+ }
+
+ @Override
+ public boolean isRemovable(String keyExpression) {
+ return true;
+ }
+
+ protected Map<String,String> getProperties(){
+ return properties;
+ }
+
+ protected Set<String> getRemoved(){
+ return removed;
+ }
+
+ @Override
+ public abstract boolean exists(String keyExpression);
+
+ @Override
+ public ConfigChangeRequest put(String key, String value) {
+ checkClosed();
+ this.properties.put(key, value);
+ return this;
+ }
+
+ @Override
+ public ConfigChangeRequest putAll(Map<String, String> properties) {
+ checkClosed();
+ this.properties.putAll(properties);
+ return this;
+ }
+
+ @Override
+ public ConfigChangeRequest remove(String... keys) {
+ checkClosed();
+ for(String k:keys) {
+ this.removed.add(k);
+ }
+ return this;
+ }
+
+ @Override
+ public ConfigChangeRequest remove(Collection<String> keys) {
+ checkClosed();
+ for(String k:keys) {
+ this.removed.add(k);
+ }
+ return this;
+ }
+
+ @Override
+ public ConfigChangeRequest removeAll(String... keys) {
+ checkClosed();
+ for(String k:keys) {
+ this.removed.add(k);
+ }
+ return this;
+ }
+
+ @Override
+ public final void commit() {
+ checkClosed();
+ commitInternal();
+ closed = true;
+ }
+
+ protected abstract void commitInternal();
+
+ @Override
+ public final void cancel() {
+ checkClosed();
+ closed = true;
+ }
+
+ @Override
+ public final boolean isClosed() {
+ return closed;
+ }
+
+ protected void checkClosed(){
+ if(closed){
+ throw new ConfigException("Change request already closed.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigChangeManagerSpi.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigChangeManagerSpi.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigChangeManagerSpi.java
new file mode 100644
index 0000000..94e4a44
--- /dev/null
+++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/ConfigChangeManagerSpi.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.mutableconfig.spi;
+
+import org.apache.tamaya.mutableconfig.ConfigChangeRequest;
+
+import java.net.URI;
+
+/**
+ * Provider SPI for the {@link org.apache.tamaya.mutableconfig.ConfigChangeManager}. Providers may override
+ * other providers registering with a higher {@link javax.annotation.Priority} value annotated.
+ */
+public interface ConfigChangeManagerSpi {
+
+ /**
+ * Creates a new change request for the given Configuration.
+ * @return a new ChangeRequest, or null if the given backend URI cannot be edited.
+ */
+ ConfigChangeRequest createChangeRequest(URI backendURI);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi b/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi
new file mode 100644
index 0000000..6a749ac
--- /dev/null
+++ b/modules/mutable-config/src/main/resources/META-INF/services/org.apache.tamaya.mutableconfig.spi.ConfigChangeManagerSpi
@@ -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.mutableconfig.internal.MutablePropertiesConfigSupport
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/ConfigChangeManagerTest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/ConfigChangeManagerTest.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/ConfigChangeManagerTest.java
new file mode 100644
index 0000000..5638e19
--- /dev/null
+++ b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/ConfigChangeManagerTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.apache.tamaya.ConfigException;
+import org.junit.Test;
+
+import java.io.File;
+import java.net.URI;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 16.01.16.
+ */
+public class ConfigChangeManagerTest {
+
+ @Test
+ public void testCreateChangeRequest() throws Exception {
+ File f = File.createTempFile("ConfigChangeRequest",".properties");
+ ConfigChangeRequest req = ConfigChangeManager.createChangeRequest(f.toURI());
+ assertNotNull(req);
+ f = File.createTempFile("ConfigChangeRequest",".xml");
+ req = ConfigChangeManager.createChangeRequest(f.toURI());
+ assertNotNull(req);
+ }
+
+ @Test(expected=ConfigException.class)
+ public void testInvalidCreateChangeRequest() throws Exception {
+ ConfigChangeRequest req = ConfigChangeManager.createChangeRequest(new URI("foo:bar"));
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullCreateChangeRequest() throws Exception {
+ ConfigChangeRequest req = ConfigChangeManager.createChangeRequest(null);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigChangeRequestTest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigChangeRequestTest.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigChangeRequestTest.java
new file mode 100644
index 0000000..44d0860
--- /dev/null
+++ b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/internal/PropertiesFileConfigChangeRequestTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.mutableconfig.ConfigChangeManager;
+import org.apache.tamaya.mutableconfig.ConfigChangeRequest;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 16.01.16.
+ */
+public class PropertiesFileConfigChangeRequestTest {
+ @Test
+ public void testReadWriteProperties_WithCancel() throws IOException {
+ File f = File.createTempFile("testReadWriteProperties_WithCancel",".properties");
+ f.delete();
+ ConfigChangeRequest req = ConfigChangeManager.createChangeRequest(f.toURI());
+ assertTrue(req instanceof PropertiesFileConfigChangeRequest);
+ req.put("key1", "value1");
+ Map<String,String> cm = new HashMap<>();
+ cm.put("key2", "value2");
+ cm.put("key3", "value3");
+ req.cancel();;
+ assertTrue(req.isClosed());
+ assertFalse(f.exists());
+ }
+
+ @Test
+ public void testReadWriteProperties_WithCommit() throws IOException {
+ File f = File.createTempFile("testReadWriteProperties_WithCommit",".properties");
+ f.delete();
+ ConfigChangeRequest req = ConfigChangeManager.createChangeRequest(f.toURI());
+ assertTrue(req instanceof PropertiesFileConfigChangeRequest);
+ req.put("key1", "value1");
+ Map<String,String> cm = new HashMap<>();
+ cm.put("key2", "value2");
+ cm.put("key3", "value3");
+ req.putAll(cm);
+ req.commit();;
+ assertTrue(req.isClosed());
+ assertTrue(f.exists());
+ ConfigChangeRequest req2 = ConfigChangeManager.createChangeRequest(f.toURI());
+ assertTrue(req != req2);
+ req2.remove("foo");
+ req2.remove("key3");
+ req2.put("key1", "value1.2");
+ req2.put("key4", "value4");
+ req2.commit();
+ Properties props = new Properties();
+ props.load(f.toURL().openStream());
+ assertEquals(3, props.size());
+ assertEquals("value1.2", props.getProperty("key1"));
+ assertEquals("value2", props.getProperty("key2"));
+ assertEquals("value4", props.getProperty("key4"));
+ }
+
+ @Test
+ public void testReadWriteXmlProperties_WithCommit() throws IOException {
+ File f = File.createTempFile("testReadWriteProperties_WithCommit",".xml");
+ f.delete();
+ ConfigChangeRequest req = ConfigChangeManager.createChangeRequest(f.toURI());
+ assertTrue(req instanceof XmlPropertiesFileConfigChangeRequest);
+ req.put("key1", "value1");
+ Map<String,String> cm = new HashMap<>();
+ cm.put("key2", "value2");
+ cm.put("key3", "value3");
+ req.putAll(cm);
+ req.commit();;
+ assertTrue(req.isClosed());
+ assertTrue(f.exists());
+ ConfigChangeRequest req2 = ConfigChangeManager.createChangeRequest(f.toURI());
+ assertTrue(req != req2);
+ req2.remove("foo");
+ req2.remove("key3");
+ req2.put("key1", "value1.2");
+ req2.put("key4", "value4");
+ req2.commit();
+ Properties props = new Properties();
+ props.loadFromXML(f.toURL().openStream());
+ assertEquals(3, props.size());
+ assertEquals("value1.2", props.getProperty("key1"));
+ assertEquals("value2", props.getProperty("key2"));
+ assertEquals("value4", props.getProperty("key4"));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/integration/commons/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/integration/commons/pom.xml b/sandbox/integration/commons/pom.xml
index 65d3203..2b5eda0 100644
--- a/sandbox/integration/commons/pom.xml
+++ b/sandbox/integration/commons/pom.xml
@@ -27,7 +27,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
<artifactId>tamaya-commons-config</artifactId>
- <name>Apache Tamaya Commons Configuration Integration</name>
+ <name>Apache Tamaya Commons Integration - Apache Commons</name>
<packaging>bundle</packaging>
<dependencies>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/integration/store/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/integration/store/pom.xml b/sandbox/integration/store/pom.xml
deleted file mode 100644
index 0e8a546..0000000
--- a/sandbox/integration/store/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy current the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-integration-sandbox</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>tamaya-store</artifactId>
- <name>Apache Tamaya Storage/Cache/Datagrid Integration</name>
- <description>Integration with a Datagrid backend for distributed configuration.</description>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-spisupport</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-events</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-Package>
- org.apache.tamaya,
- org.apache.tamaya.spi,
- org.apache.tamaya.events,
- org.apache.tamaya.spisupport
- javax.annotation,
- *
- </Import-Package>
- <Export-Package>
- org.apache.tamaya.integration.store,
- org.apache.tamaya.integration.store.spi,
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/integration/store/src/main/java/org/apache/tamaya/store/PropertyStore.java
----------------------------------------------------------------------
diff --git a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/PropertyStore.java b/sandbox/integration/store/src/main/java/org/apache/tamaya/store/PropertyStore.java
deleted file mode 100644
index d1d6adf..0000000
--- a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/PropertyStore.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.store;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Map;
-
-/**
- * Simple abstraction of a property synchronization backend. Most methods are similar
- * to a {@link org.apache.tamaya.spi.PropertySource}, enhanced with methods for
- * updating the property storage.
- */
-public interface PropertyStore {
-
- /**
- * Get the store's name.
- * @return the name, never null.
- */
- String getName();
-
- /**
- * Stores the given PropertySource into the store.
- * @param propertySource
- */
- void store(PropertySource propertySource);
-
- /**
- * Read all properties.
- * @return the properties from the remote store, never null.
- */
- Map<String,String> read();
-
- /**
- * Reads a single key fromt hthe store.
- * @param key the key, not null.
- * @return the value, or null.
- */
- String read(String key);
-
- /**
- * Determines if {@link #read()} returns all contained properties, or optionally only
- * a subset of the accessible and defined properties are returned.
- * @return true, if this store is scannable.
- */
- boolean isScannable();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/integration/store/src/main/java/org/apache/tamaya/store/PropertyStoreProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/PropertyStoreProvider.java b/sandbox/integration/store/src/main/java/org/apache/tamaya/store/PropertyStoreProvider.java
deleted file mode 100644
index dceb29a..0000000
--- a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/PropertyStoreProvider.java
+++ /dev/null
@@ -1,78 +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.store;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.store.spi.PropertyStoreProviderSpi;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Logger;
-
-/**
- * Simple provider accessor singleton for accessing {@link PropertyStore}
- * instances.
- */
-public final class PropertyStoreProvider {
- /**
- * The logger used.
- */
- private static final Logger LOG = Logger.getLogger(PropertyStoreProvider.class.getName());
-
-
- /**
- * Singleton constructor.
- */
- private PropertyStoreProvider() {
- }
-
-
- /**
- * Access a {@link PropertyStore} using it's id.
- *
- * @param storeId the unique id of the store to use.
- * @return
- */
- public static PropertyStore getPropertyStore(String storeId) {
- for (PropertyStoreProviderSpi propertyStoreProviderSpi : ServiceContextManager.getServiceContext()
- .getServices(PropertyStoreProviderSpi.class)) {
- PropertyStore store = propertyStoreProviderSpi.getPropertyStore(storeId);
- if (store != null) {
- LOG.finest("DataGrid '" + storeId + "' used: " + store);
- return store;
- }
- }
- throw new ConfigException("No such Store: " + storeId);
- }
-
- /**
- * Access a {@link PropertyStore} using it's id, hereby returning the most significant of the configured
- * {@link PropertyStore} instances.
- *
- * @return the default PropertyStore instance.
- */
- public static PropertyStore getDefaultPropertyStore() {
- return getPropertyStore("default");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/integration/store/src/main/java/org/apache/tamaya/store/WritablePropertySource.java
----------------------------------------------------------------------
diff --git a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/WritablePropertySource.java b/sandbox/integration/store/src/main/java/org/apache/tamaya/store/WritablePropertySource.java
deleted file mode 100644
index c19fa45..0000000
--- a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/WritablePropertySource.java
+++ /dev/null
@@ -1,66 +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.store;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Map;
-
-/**
- * Simple abstraction of a property synchronization backend. Most methods are similar
- * to a {@link org.apache.tamaya.spi.PropertySource}, enhanced with methods for
- * updating the property storage.
- */
-public interface WritablePropertySource extends PropertySource{
-
- /**
- * Loads the property source from its store..
- */
- void load();
-
- /**
- * Sets the store to the given properties, replacing all previous state.
- * @param props the new properties.
- */
- void setAll(Map<String, String> props);
-
- /**
- * Updates/adds all the given entries.
- * @param props the entries to be added/updated.
- */
- void putAll(Map<String, String> props);
-
- /**
- * Writes a single entry.
- * @param key the key, not null.
- * @param value the new value, not null.
- */
- void put(String key, String value);
-
- /**
- * Removes all entries.
- */
- void clear();
-
- /**
- * Synchronize the current state with the remote version.
- */
- void synch();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/integration/store/src/main/java/org/apache/tamaya/store/spi/DefaultStoredPropertySource.java
----------------------------------------------------------------------
diff --git a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/spi/DefaultStoredPropertySource.java b/sandbox/integration/store/src/main/java/org/apache/tamaya/store/spi/DefaultStoredPropertySource.java
deleted file mode 100644
index b3fe1ee..0000000
--- a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/spi/DefaultStoredPropertySource.java
+++ /dev/null
@@ -1,137 +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.store.spi;
-
-import org.apache.tamaya.events.ConfigEventManager;
-import org.apache.tamaya.events.FrozenPropertySource;
-import org.apache.tamaya.events.delta.ChangeType;
-import org.apache.tamaya.events.delta.PropertySourceChange;
-import org.apache.tamaya.events.delta.PropertySourceChangeBuilder;
-import org.apache.tamaya.spisupport.BasePropertySource;
-import org.apache.tamaya.store.PropertyStore;
-import org.apache.tamaya.store.WritablePropertySource;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * PropertySource that is connected to a {@link PropertyStore}.
- */
-public class DefaultStoredPropertySource extends BasePropertySource
- implements WritablePropertySource {
-
- /**
- * The store to be used, not null.
- */
- private PropertyStore propertyStore;
-
- /**
- * The last version of stoarge data accessed.
- */
- private String lastVersion;
-
- private Map<String, String> properties = new HashMap<>();
-
-
- private FrozenPropertySource currentConfig;
-
- /**
- * Creates a new property source.
- *
- * @param propertyStore the backend store.
- * @param defaultOrdinal the default ordinal to be used.
- */
- public DefaultStoredPropertySource(PropertyStore propertyStore, int defaultOrdinal) {
- super(defaultOrdinal);
- this.propertyStore = Objects.requireNonNull(propertyStore);
- this.properties.putAll(this.propertyStore.read());
- }
-
- @Override
- public void load() {
- this.properties.clear();
- this.properties.putAll(this.propertyStore.read());
- synch();
- }
-
- @Override
- public String getName() {
- return this.propertyStore.getName();
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-
- @Override
- public String get(String key) {
- if (!propertyStore.isScannable()) {
- return propertyStore.read(key);
- }
- return properties.get(key);
- }
-
- @Override
- public boolean isScannable() {
- return propertyStore.isScannable();
- }
-
- @Override
- public String toString() {
- return "StoredPropertySource{" +
- "propertyStore=" + propertyStore.getName() +
- '}';
- }
-
- @Override
- public void setAll(Map<String, String> props) {
- this.properties.clear();
- this.properties.putAll(props);
- synch();
- }
-
- @Override
- public void putAll(Map<String, String> props) {
- this.properties.putAll(props);
- synch();
- }
-
- @Override
- public void put(String key, String value) {
- this.properties.put(key, value);
- synch();
- }
-
- @Override
- public void clear() {
- this.properties.clear();
- synch();
- }
-
- @Override
- public void synch() {
- FrozenPropertySource newConfig = FrozenPropertySource.of(this);
- PropertySourceChange change = PropertySourceChangeBuilder.of(currentConfig, ChangeType.UPDATED)
- .addChanges(newConfig).build();
- currentConfig = newConfig;
- ConfigEventManager.fireEvent(change);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/integration/store/src/main/java/org/apache/tamaya/store/spi/PropertyStoreProviderSpi.java
----------------------------------------------------------------------
diff --git a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/spi/PropertyStoreProviderSpi.java b/sandbox/integration/store/src/main/java/org/apache/tamaya/store/spi/PropertyStoreProviderSpi.java
deleted file mode 100644
index 1b20fc1..0000000
--- a/sandbox/integration/store/src/main/java/org/apache/tamaya/store/spi/PropertyStoreProviderSpi.java
+++ /dev/null
@@ -1,34 +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.store.spi;
-
-import org.apache.tamaya.store.PropertyStore;
-
-/**
- * Class, that provides access to PropertyStores to be used.
- */
-public interface PropertyStoreProviderSpi {
-
- /**
- * Access a {@link PropertyStore} using it's id.
- * @param storeId the unique id of the store to use.
- * @return
- */
- PropertyStore getPropertyStore(String storeId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/jodatime/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/jodatime/pom.xml b/sandbox/jodatime/pom.xml
index 98b13a6..98f48cf 100644
--- a/sandbox/jodatime/pom.xml
+++ b/sandbox/jodatime/pom.xml
@@ -30,7 +30,7 @@ under the License.
</parent>
<artifactId>tamaya-jodatime</artifactId>
- <name>Apache Tamaya Joda-Time Support</name>
+ <name>Apache Tamaya Modules - Joda-Time Support</name>
<packaging>bundle</packaging>
<inceptionYear>2015</inceptionYear>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/metamodels/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/metamodels/pom.xml b/sandbox/metamodels/pom.xml
index 4a05846..79513d2 100644
--- a/sandbox/metamodels/pom.xml
+++ b/sandbox/metamodels/pom.xml
@@ -29,7 +29,7 @@ under the License.
<groupId>org.apache.tamaya.ext.metamodels</groupId>
<artifactId>tamaya-metamodels</artifactId>
- <name>Apache Tamaya Extension Modules: Metamodels</name>
+ <name>Apache Tamaya Modules - Metamodels</name>
<packaging>pom</packaging>
<modules>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/mutable-config/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox/mutable-config/pom.xml b/sandbox/mutable-config/pom.xml
deleted file mode 100644
index c20a60a..0000000
--- a/sandbox/mutable-config/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy current the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-extensions</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>tamaya-mutable-config</artifactId>
- <name>Apache Tamaya Mutable Configuration Support</name>
- <description>This module provides abstraction, if your scenario needs to actively change configuration entries
- and write changes back to some property sources, files etc.</description>
- <packaging>bundle</packaging>
-
- <properties>
- <jdkVersion>1.7</jdkVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-events</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-core</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.tamaya.mutableconfig
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangeSummary.java
----------------------------------------------------------------------
diff --git a/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangeSummary.java b/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangeSummary.java
deleted file mode 100644
index 63d084c..0000000
--- a/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangeSummary.java
+++ /dev/null
@@ -1,105 +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.mutableconfig;
-
-import org.apache.tamaya.events.delta.ConfigurationChange;
-import org.apache.tamaya.events.delta.PropertySourceChange;
-
-import java.io.Serializable;
-import java.util.*;
-
-/**
- * Summaray class of a configuration change operation.
- * This class is immutable, read-only and thread-safe.
- */
-public final class ChangeSummary implements Serializable{
-
- private static final long serialVersionUID = 1L;
-
- private String changeId;
- private ConfigurationChange configChange;
- private List<PropertySourceChange> sourceChanges = new ArrayList<>();
- private long commitTS;
-
- private ChangeSummary(Builder builder){
- this.changeId = builder.changeId;
- this.commitTS = builder.commitTS;
- this.configChange = Objects.requireNonNull(builder.configChange);
- this.sourceChanges.addAll(builder.sourceChanges);
- }
-
- public String getChangeId(){
- return changeId;
- }
-
- public long getTimestampMillis(){
- return commitTS;
- }
-
- public ConfigurationChange getConfigurationChange(){
- return configChange;
- }
-
- public Collection<PropertySourceChange> getPropertySourceChanges(){
- return Collections.unmodifiableList(this.sourceChanges);
- }
-
-
-
-
-
- public static final class Builder {
-
- private String changeId;
- private ConfigurationChange configChange;
- private List<PropertySourceChange> sourceChanges = new ArrayList<>();
- private long commitTS = System.currentTimeMillis();
-
- public Builder(){
- this(UUID.randomUUID().toString());
- }
-
- public Builder(String changeId){
- this.changeId = Objects.requireNonNull(changeId);
- }
-
- public Builder setConfigChange(ConfigurationChange configChange){
- this.configChange = configChange;
- return this;
- }
-
- public Builder addPropertySourceChange(PropertySourceChange propertyChange){
- this.sourceChanges.add(propertyChange);
- return this;
- }
-
- public Builder setTimestamp(long timestamp){
- this.commitTS = timestamp;
- return this;
- }
-
- public ChangeSummary build(){
- return new ChangeSummary(this);
- }
-
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/c2f1b151/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeProvider.java
----------------------------------------------------------------------
diff --git a/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeProvider.java b/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeProvider.java
deleted file mode 100644
index f8842ea..0000000
--- a/sandbox/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeProvider.java
+++ /dev/null
@@ -1,50 +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.mutableconfig;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.mutableconfig.spi.ConfigurationChangeProviderSpi;
-import org.apache.tamaya.spi.ServiceContextManager;
-
-/**
- * Accessor for creating {@link ConfigChangeRequest} instances to change and commite configuration.
- */
-public final class ConfigChangeProvider {
-
- /**
- * Creates a new change request for the given Configuration.
- * @param config the configuration.
- * @return a new ChangeRequest
- * @throws UnsupportedOperationException if no change providers are registered.
- */
- public static ConfigChangeRequest createChangeRequest(Configuration config){
- return ServiceContextManager.getServiceContext().getService(ConfigurationChangeProviderSpi.class)
- .createChangeRequest(config);
- }
-
- /**
- * Creates a new change request for the current Configuration.
- * @return a new ChangeRequest
- */
- public static ConfigChangeRequest createChangeRequest(){
- return createChangeRequest(ConfigurationProvider.getConfiguration());
- }
-
-}
[3/3] incubator-tamaya git commit: Unified module name in poms.
Posted by an...@apache.org.
Unified module name in poms.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/afb2d1a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/afb2d1a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/afb2d1a4
Branch: refs/heads/master
Commit: afb2d1a45d5bfba30c080bda6cde48732234f904
Parents: c2f1b15
Author: anatole <an...@apache.org>
Authored: Sat Jan 16 07:40:08 2016 +0100
Committer: anatole <an...@apache.org>
Committed: Sat Jan 16 07:40:08 2016 +0100
----------------------------------------------------------------------
code/pom.xml | 4 ++--
examples/pom.xml | 2 +-
modules/builder/pom.xml | 2 +-
modules/classloader-support/pom.xml | 2 +-
modules/events/pom.xml | 2 +-
modules/formats/pom.xml | 2 +-
modules/functions/pom.xml | 2 +-
modules/injection-api/pom.xml | 2 +-
modules/injection/pom.xml | 2 +-
modules/integration/camel/pom.xml | 2 +-
modules/integration/cdi-se/pom.xml | 2 +-
modules/integration/cdi/pom.xml | 2 +-
modules/integration/osgi/pom.xml | 2 +-
modules/integration/pom.xml | 1 +
modules/integration/spring/pom.xml | 2 +-
modules/json/pom.xml | 2 +-
modules/model/pom.xml | 2 +-
modules/optional/pom.xml | 2 +-
modules/pom.xml | 3 ++-
modules/remote/pom.xml | 2 +-
modules/resolver/pom.xml | 2 +-
modules/resources/pom.xml | 2 +-
modules/server/pom.xml | 2 +-
modules/spi-support/pom.xml | 2 +-
24 files changed, 26 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/code/pom.xml
----------------------------------------------------------------------
diff --git a/code/pom.xml b/code/pom.xml
index 28dfac5..51a5dfb 100644
--- a/code/pom.xml
+++ b/code/pom.xml
@@ -28,9 +28,9 @@ under the License.
<version>0.2-incubating-SNAPSHOT</version>
</parent>
- <artifactId>code</artifactId>
+ <artifactId>tamaya-code</artifactId>
<packaging>pom</packaging>
- <name>Apache Tamaya Codebase</name>
+ <name>Apache Tamaya Code - all</name>
<modules>
<module>api</module>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index a700888..9cbb8ac 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -28,7 +28,7 @@ under the License.
<artifactId>tamaya-examples</artifactId>
<groupId>org.apache.tamaya.ext</groupId>
- <name>Apache Tamaya Examples</name>
+ <name>Apache Tamaya Example - all</name>
<description>This project contains several examples that illustrate usage of Tamaya.</description>
<packaging>pom</packaging>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/builder/pom.xml
----------------------------------------------------------------------
diff --git a/modules/builder/pom.xml b/modules/builder/pom.xml
index 90b07e7..c7da3f8 100644
--- a/modules/builder/pom.xml
+++ b/modules/builder/pom.xml
@@ -27,7 +27,7 @@ under the License.
</parent>
<artifactId>tamaya-builder</artifactId>
- <name>Apache Tamaya Builder</name>
+ <name>Apache Tamaya Modules - Builder</name>
<packaging>jar</packaging> <!-- bundle -->
<inceptionYear>2015</inceptionYear>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/classloader-support/pom.xml
----------------------------------------------------------------------
diff --git a/modules/classloader-support/pom.xml b/modules/classloader-support/pom.xml
index 1b593d4..5f8eeb5 100644
--- a/modules/classloader-support/pom.xml
+++ b/modules/classloader-support/pom.xml
@@ -28,7 +28,7 @@ under the License.
</parent>
<artifactId>tamaya-classloader-support</artifactId>
- <name>Apache Tamaya Modules -Classloader Support</name>
+ <name>Apache Tamaya Modules - Classloader Support</name>
<description>Apache Tamaya Classloader Support registers a ConfigurationContext that leverages
classloader hierarchies. Also visibility of features and components is aligned with the
corresponding hierarchy of classloaders.</description>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/events/pom.xml
----------------------------------------------------------------------
diff --git a/modules/events/pom.xml b/modules/events/pom.xml
index 918f4ef..7ac7f28 100644
--- a/modules/events/pom.xml
+++ b/modules/events/pom.xml
@@ -27,7 +27,7 @@ under the License.
</parent>
<artifactId>tamaya-events</artifactId>
- <name>Apache Tamaya Event and dynamic Update Extensions</name>
+ <name>Apache Tamaya Modules - Event and dynamic Update Extensions</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/formats/pom.xml
----------------------------------------------------------------------
diff --git a/modules/formats/pom.xml b/modules/formats/pom.xml
index c8bfce4..1beba84 100644
--- a/modules/formats/pom.xml
+++ b/modules/formats/pom.xml
@@ -26,7 +26,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
<artifactId>tamaya-formats</artifactId>
- <name>Apache Tamaya Format Services</name>
+ <name>Apache Tamaya Modules - Formats</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/functions/pom.xml
----------------------------------------------------------------------
diff --git a/modules/functions/pom.xml b/modules/functions/pom.xml
index 7bc7b66..5a00f81 100644
--- a/modules/functions/pom.xml
+++ b/modules/functions/pom.xml
@@ -28,7 +28,7 @@ under the License.
</parent>
<artifactId>tamaya-functions</artifactId>
- <name>Apache Tamaya Common Functional Extensions</name>
+ <name>Apache Tamaya Modules - Common Functional Extensions</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/injection-api/pom.xml
----------------------------------------------------------------------
diff --git a/modules/injection-api/pom.xml b/modules/injection-api/pom.xml
index 89b1c67..e4fc7b7 100644
--- a/modules/injection-api/pom.xml
+++ b/modules/injection-api/pom.xml
@@ -26,7 +26,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
<artifactId>tamaya-injection-api</artifactId>
- <name>Apache Tamaya Injection Support API</name>
+ <name>Apache Tamaya Modules - Injection Support API</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/injection/pom.xml
----------------------------------------------------------------------
diff --git a/modules/injection/pom.xml b/modules/injection/pom.xml
index 0e05dd7..abae7ca 100644
--- a/modules/injection/pom.xml
+++ b/modules/injection/pom.xml
@@ -26,7 +26,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
<artifactId>tamaya-injection</artifactId>
- <name>Apache Tamaya Injection Support</name>
+ <name>Apache Tamaya Modules - Injection Support</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/integration/camel/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration/camel/pom.xml b/modules/integration/camel/pom.xml
index ea12834..c1968d2 100644
--- a/modules/integration/camel/pom.xml
+++ b/modules/integration/camel/pom.xml
@@ -27,7 +27,7 @@ under the License.
</parent>
<artifactId>tamaya-camel</artifactId>
- <name>Apache Tamaya Modules Integration - Apache Camel</name>
+ <name>Apache Tamaya Integration - Apache Camel</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/integration/cdi-se/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration/cdi-se/pom.xml b/modules/integration/cdi-se/pom.xml
index b867e5c..cd80e97 100644
--- a/modules/integration/cdi-se/pom.xml
+++ b/modules/integration/cdi-se/pom.xml
@@ -27,7 +27,7 @@ under the License.
</parent>
<artifactId>tamaya-cdi-se</artifactId>
- <name>Apache Tamaya Modules Integration - CDI (Using SE Injection)</name>
+ <name>Apache Tamaya Integration - CDI (Using SE Injection)</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/integration/cdi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration/cdi/pom.xml b/modules/integration/cdi/pom.xml
index 643e35c..0ec0d39 100644
--- a/modules/integration/cdi/pom.xml
+++ b/modules/integration/cdi/pom.xml
@@ -27,7 +27,7 @@ under the License.
</parent>
<artifactId>tamaya-cdi</artifactId>
- <name>Apache Tamaya Modules Integration - CDI (Java EE)</name>
+ <name>Apache Tamaya Integration - CDI (Java EE)</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/integration/osgi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration/osgi/pom.xml b/modules/integration/osgi/pom.xml
index 0b6bdd0..d8b543c 100644
--- a/modules/integration/osgi/pom.xml
+++ b/modules/integration/osgi/pom.xml
@@ -29,7 +29,7 @@
<artifactId>tamaya-osgi</artifactId>
<packaging>bundle</packaging>
- <name>Apache Tamaya :: OSGi Services :: Tamaya Config</name>
+ <name>Apache Tamaya Integration - OSGi Services :: Tamaya Config</name>
<description>Tamaya Based OSGI Implementation of ConfigAdmin and Config Injection</description>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/integration/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration/pom.xml b/modules/integration/pom.xml
index 719b1a9..4469452 100644
--- a/modules/integration/pom.xml
+++ b/modules/integration/pom.xml
@@ -30,6 +30,7 @@ under the License.
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<artifactId>tamaya-integration</artifactId>
+ <name>Apache Tamaya Integration - all</name>
<modules>
<module>spring</module>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/integration/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration/spring/pom.xml b/modules/integration/spring/pom.xml
index f62b264..27df9e7 100644
--- a/modules/integration/spring/pom.xml
+++ b/modules/integration/spring/pom.xml
@@ -27,7 +27,7 @@ under the License.
</parent>
<artifactId>tamaya-spring</artifactId>
- <name>Apache Tamaya Modules Integration - Spring</name>
+ <name>Apache Tamaya Integration - Spring</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/json/pom.xml
----------------------------------------------------------------------
diff --git a/modules/json/pom.xml b/modules/json/pom.xml
index 18ca1f9..c5d344f 100644
--- a/modules/json/pom.xml
+++ b/modules/json/pom.xml
@@ -27,7 +27,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
<artifactId>tamaya-json</artifactId>
- <name>Apache Tamaya JSON Support</name>
+ <name>Apache Tamaya Modules - JSON Support</name>
<packaging>bundle</packaging>
<inceptionYear>2015</inceptionYear>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/model/pom.xml
----------------------------------------------------------------------
diff --git a/modules/model/pom.xml b/modules/model/pom.xml
index 7bab7ac..66d5eac 100644
--- a/modules/model/pom.xml
+++ b/modules/model/pom.xml
@@ -29,7 +29,7 @@ under the License.
<groupId>org.apache.tamaya.ext.model</groupId>
<artifactId>tamaya-model</artifactId>
- <name>Apache Tamaya Extension Modules: Configuration Model Infrastructure</name>
+ <name>Apache Tamaya Modules - Configuration Model Infrastructure</name>
<description>This extension module provides functionality to describe, document and
validate configuration during runtime.
</description>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/optional/pom.xml
----------------------------------------------------------------------
diff --git a/modules/optional/pom.xml b/modules/optional/pom.xml
index 4204a12..2431f8e 100644
--- a/modules/optional/pom.xml
+++ b/modules/optional/pom.xml
@@ -28,7 +28,7 @@ under the License.
</parent>
<artifactId>tamaya-optional</artifactId>
- <name>Apache Tamaya Optional Configuration Backend</name>
+ <name>Apache Tamaya Modules - Optional Configuration Backend</name>
<description>This module provides a simple class that can be used as a single dependency for evaluating
configuration. It runs basically without Tamaya being on the classpath, but if available it
considers/uses Tamaya functionality.</description>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/pom.xml
----------------------------------------------------------------------
diff --git a/modules/pom.xml b/modules/pom.xml
index 3c58796..62fdd17 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -28,12 +28,13 @@ under the License.
<artifactId>tamaya-extensions</artifactId>
<groupId>org.apache.tamaya.ext</groupId>
- <name>Apache Tamaya Extension Modules</name>
+ <name>Apache Tamaya Extension Modules - all</name>
<description>This project contains the several extensions that can be used with Tamaya.</description>
<packaging>pom</packaging>
<modules>
<module>builder</module>
+ <module>mutable-config</module>
<module>spi-support</module>
<module>events</module>
<module>formats</module>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/remote/pom.xml
----------------------------------------------------------------------
diff --git a/modules/remote/pom.xml b/modules/remote/pom.xml
index 68ae946..e47b2bf 100644
--- a/modules/remote/pom.xml
+++ b/modules/remote/pom.xml
@@ -28,7 +28,7 @@ under the License.
</parent>
<artifactId>tamaya-remote</artifactId>
- <name>Apache Tamaya Remote PropertySource</name>
+ <name>Apache Tamaya Modules - Remote PropertySource</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/resolver/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resolver/pom.xml b/modules/resolver/pom.xml
index 770dc9f..a2ab5ac 100644
--- a/modules/resolver/pom.xml
+++ b/modules/resolver/pom.xml
@@ -27,7 +27,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
<artifactId>tamaya-resolver</artifactId>
- <name>Apache Tamaya Resolver Services</name>
+ <name>Apache Tamaya Modules - Resolver Services</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/resources/pom.xml
----------------------------------------------------------------------
diff --git a/modules/resources/pom.xml b/modules/resources/pom.xml
index 25b11eb..2ccc6f1 100644
--- a/modules/resources/pom.xml
+++ b/modules/resources/pom.xml
@@ -26,7 +26,7 @@ under the License.
<relativePath>..</relativePath>
</parent>
<artifactId>tamaya-resources</artifactId>
- <name>Apache Tamaya Resource Services</name>
+ <name>Apache Tamaya Modules - Resource Services</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/server/pom.xml b/modules/server/pom.xml
index 7d1d360..ff74e01 100644
--- a/modules/server/pom.xml
+++ b/modules/server/pom.xml
@@ -28,7 +28,7 @@ under the License.
</parent>
<artifactId>tamaya-server</artifactId>
- <name>Apache Tamaya Modules: Server Extension</name>
+ <name>Apache Tamaya Modules - Server Extension</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/afb2d1a4/modules/spi-support/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spi-support/pom.xml b/modules/spi-support/pom.xml
index 8c8e8ae..955cdfc 100644
--- a/modules/spi-support/pom.xml
+++ b/modules/spi-support/pom.xml
@@ -28,7 +28,7 @@ under the License.
</parent>
<artifactId>tamaya-spisupport</artifactId>
- <name> Apache Tamaya SPI Support Classes</name>
+ <name> Apache Tamaya Modules - Common Support Classes</name>
<description>Apache Tamaya Support Classes useful when implementing the Tamaya SPI or code independent of the core RI
implementation.</description>
<packaging>bundle</packaging>