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/02/27 22:02:28 UTC
[09/10] incubator-tamaya git commit: Fixed minor issues.
Fixed minor issues.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/1c454d5e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/1c454d5e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/1c454d5e
Branch: refs/heads/master
Commit: 1c454d5e187c0acd63e0723a91de14eba0081683
Parents: b3535ce
Author: anatole <an...@apache.org>
Authored: Sat Feb 27 22:00:36 2016 +0100
Committer: anatole <an...@apache.org>
Committed: Sat Feb 27 22:00:36 2016 +0100
----------------------------------------------------------------------
src/site/asciidoc/extensions/mod_etcd.adoc | 18 ++++++--------
src/site/asciidoc/extensions/mod_json.adoc | 4 +--
.../asciidoc/extensions/mod_mutable_config.adoc | 26 ++++++++++++--------
3 files changed, 26 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1c454d5e/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 2c8b5a6..d7fc70f 100644
--- a/src/site/asciidoc/extensions/mod_etcd.adoc
+++ b/src/site/asciidoc/extensions/mod_etcd.adoc
@@ -45,10 +45,8 @@ toc::[]
=== Overview
The Tamaya etcd integration module provides different artifacts which allows integration of Apachae Tamaya
-configuration with etcd. Basically the module supports read-only integration.
-
-NOTE: The etcd backend itself also has methods that allow writing to the etcd cluster back. Once Tamaya's writable
- feature will be ready for broader usage (currently it is in the sandbox).
+configuration with etcd. Basically the module supports read-only integration (as a +EtcdPropertySource+ as well
+as a support for +MutableConfiguration+ as defined by the +tamaya-mutable-config+ extension module.
=== Compatibility
@@ -78,10 +76,10 @@ ETcd integration comes basically with 2 artifacts:
(+org.apache.tamaya.etcd.EtcdAccessor+). The accessor basically provides a simple Java API for communicating
with etcd server. The accessor hereby allows reading of single properties, or whole subtrees. Also the basic non
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.
+* 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+.
+ by accessing a +MutableConfiguration+ using the URI +config:etcd+.
=== The EtcdAccessor
@@ -209,11 +207,11 @@ public class EtcdAccessor {
=== The EtcdPropertySource
-The +EtcdPropertySource+ is automatically registered and requires the etcd servers to be used to be configured. This
+The +EtcdPropertySource+ is automatically registered and allows to configure the etcd servers to be used. This
enables to use e.g. in Docker environments the docker environment configuration mechanisms to configure Tamaya running
-in microservice containers to connect with the according etcd container cluster:
+in microservice containers to connect with the according etcd cluster:
-* The property source reads the +tamaya.etcd.server.urls+ system property to evaluate possible etcd servers
+* The property source reads the +tamaya.etcd.server.urls+ system and environment property to evaluate possible etcd servers
(comma separated), which can be connected to. On error the API just performs a Round-Robin through the list of
configured servers. Without any configuration +http://127.0.0.1:4001+ is used. If no connection to any etcd
server can be established a warning will be logged, but deployment will not fail.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1c454d5e/src/site/asciidoc/extensions/mod_json.adoc
----------------------------------------------------------------------
diff --git a/src/site/asciidoc/extensions/mod_json.adoc b/src/site/asciidoc/extensions/mod_json.adoc
index edb66ad..a851bcf 100644
--- a/src/site/asciidoc/extensions/mod_json.adoc
+++ b/src/site/asciidoc/extensions/mod_json.adoc
@@ -18,7 +18,7 @@
= Apache Tamaya -- Extension: Builder
:name: Tamaya
-:rootpackage: org.apache.tamaya.builder
+:rootpackage: org.apache.tamaya.json
:title: Apache Tamaya Extension: JSON
:revnumber: 0.1.1
:revremark: Incubator
@@ -91,7 +91,7 @@ For reading JSON based onfiguration most easily a +JSONFormat+ can be provided:
[source, java]
-----------------------------------------------
ConfigurationData dataRead = ConfigurationFormats.readConfig(
- getClassLoader().getResource("myFileConfig.json"), new JSonFOrmat()));
+ getClassLoader().getResource("myFileConfig.json"), new JSONFormat()));
-----------------------------------------------
=== Examples
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1c454d5e/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
index 8e85f35..ba888b4 100644
--- a/src/site/asciidoc/extensions/mod_mutable_config.adoc
+++ b/src/site/asciidoc/extensions/mod_mutable_config.adoc
@@ -73,20 +73,25 @@ To benefit from configuration mutability support you only must add the correspon
The core of the module is the +MutableConfigQuery+ singleton, which is a +ConfigQuery+ that creates a new
+Mutableonfiguration+ based on a +Configuration+ and a set of target backend +URIs+. If not sure you can call
+getSupportedURIInfo()+ to see, which kind of URI's are currently supported.
-As an example writing configuration entries to an +etcd+ server can be done as follows:
+On top of this API you also must have the correponding implementations installed that provide the backend logic needed
+to write the changes back. This module by default supports writing back to files only. As an example how to write
+configuration entries back refer to the following snippet:
[source,java]
.Accessing a mutable configuration backed by etcd
--------------------------------------------
MutableConfiguration config = ConfigChangeManager.getConfiguration().query(
- MutableConfigurationQuery.of("etc:http://127.0.0.1:4441", "file:/home/etcd/backup-config.properties");
-config.set("newKey", "newValue").set("anotherKey", "updatedValue")
+ MutableConfigurationQuery.of("file:/home/etcd/backup-config.properties");
+
+config.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:
+Hereby it is also possible to provide multiple URLS that allows you to write your configuration chnges back to multiple
+backends in one go. Also be aware that 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 overridden by other sources?
@@ -106,13 +111,14 @@ is writable at all or can be removed or updated:
.Checking for mutability
--------------------------------------------
MutableConfiguration config = ConfigChangeManager.getConfiguration().query(
- MutableConfigurationQuery.of("etc:http://127.0.0.1:4441", "file:/home/etcd/backup-config.properties");
+ MutableConfigurationQuery.of("file:/home/etcd/backup-config.properties");
+
if(config,isWritable("mycluster.shared.appKey")){
config.set("newKey", "newValue")
- .remove("valueNotValid")
- .commit();
+ .remove("valueNotValid")
+ .commit();
}else{
- config.rollbacks();
+ config.rollback();
}
--------------------------------------------
@@ -144,7 +150,7 @@ defines a fabric method +MutableConfigurationBackendSpi getBackend(URI)+ used by
accessor:
[source,java]
-.SPI: ConfigEventSpi
+.SPI: MutableConfigurationBackendProviderSpi
--------------------------------------------------
public interface MutableConfigurationBackendProviderSpi {
MutableConfigurationBackendSpi getBackend(URI backendURI);