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:24 UTC
[05/10] incubator-tamaya git commit: TAMAYA-71: Added yaml module doc
and module pom.
TAMAYA-71: Added yaml module doc and module pom.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/efe45e5a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/efe45e5a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/efe45e5a
Branch: refs/heads/master
Commit: efe45e5a3a7a9289285e554100acd8ce2e70bc87
Parents: ffc59e0
Author: anatole <an...@apache.org>
Authored: Sat Feb 27 21:57:19 2016 +0100
Committer: anatole <an...@apache.org>
Committed: Sat Feb 27 21:57:19 2016 +0100
----------------------------------------------------------------------
modules/yaml/pom.xml | 44 ++----------
src/site/asciidoc/extensions/mod_yaml.adoc | 95 +++++++++++++++++++------
2 files changed, 79 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/efe45e5a/modules/yaml/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yaml/pom.xml b/modules/yaml/pom.xml
index 670516c..f659efb 100644
--- a/modules/yaml/pom.xml
+++ b/modules/yaml/pom.xml
@@ -26,13 +26,14 @@ under the License.
<version>0.2-incubating-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
- <artifactId>tamaya-json</artifactId>
- <name>Apache Tamaya Modules - JSON Support</name>
+ <artifactId>tamaya-yaml</artifactId>
+ <name>Apache Tamaya Modules - YAML Support</name>
<packaging>bundle</packaging>
- <inceptionYear>2015</inceptionYear>
+ <inceptionYear>2016</inceptionYear>
<properties>
<jdkVersion>1.7</jdkVersion>
+ <snakeyaml.version>1.17</snakeyaml.version>
</properties>
<dependencies>
@@ -56,46 +57,15 @@ under the License.
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-json_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.johnzon</groupId>
- <artifactId>johnzon-core</artifactId>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>${snakeyaml.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.arquillian.daemon</groupId>
- <artifactId>arquillian-daemon-container-managed</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.daemon</groupId>
- <artifactId>arquillian-daemon-container-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.daemon</groupId>
- <artifactId>arquillian-daemon-main</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.daemon</groupId>
- <artifactId>arquillian-daemon-protocol-arquillian</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.daemon</groupId>
- <artifactId>arquillian-daemon-protocol-wire</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.daemon</groupId>
- <artifactId>arquillian-daemon-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- </dependency>
- <dependency>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/efe45e5a/src/site/asciidoc/extensions/mod_yaml.adoc
----------------------------------------------------------------------
diff --git a/src/site/asciidoc/extensions/mod_yaml.adoc b/src/site/asciidoc/extensions/mod_yaml.adoc
index edb66ad..f5560b9 100644
--- a/src/site/asciidoc/extensions/mod_yaml.adoc
+++ b/src/site/asciidoc/extensions/mod_yaml.adoc
@@ -18,11 +18,11 @@
= Apache Tamaya -- Extension: Builder
:name: Tamaya
-:rootpackage: org.apache.tamaya.builder
-:title: Apache Tamaya Extension: JSON
-:revnumber: 0.1.1
+:rootpackage: org.apache.tamaya.yaml
+:title: Apache Tamaya Extension: YAML
+:revnumber: 0.1
:revremark: Incubator
-:revdate: March 2015
+:revdate: March 2016
:longversion: {revnumber} ({revremark}) {revdate}
:authorinitials: ATR
:author: Anatole Tresch
@@ -59,15 +59,16 @@ toc::[]
:numbered!:
<<<
[[BuilderCore]]
-== Tamaya JSON (Extension Module)
+== Tamaya YAML (Extension Module)
=== Overview
-The Tamaya json module provides support for reading configuration using the JSON format:
+The Tamaya YAML module provides support for reading configuration using the YAML format (yaml.org). YAML hereby
+use intendation for expressing hierarchy, which makes yaml configuration files very easily readable and compact.
=== Compatibility
-The module is based on Java 7, so it will not run on Java 7 and beyond.
+The YAML module is based on Java 7, so it will not run on Java 7 and beyond.
=== Installation
@@ -78,38 +79,86 @@ To benefit from configuration builder support you only must add the correspondin
-----------------------------------------------
<dependency>
<groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-json</artifactId>
+ <artifactId>tamaya-yaml</artifactId>
<version>{tamayaVersion}</version>
</dependency>
-----------------------------------------------
-=== Reading configuration in JSON
+=== Reading configuration in YAML
-For reading JSON based onfiguration most easily a +JSONFormat+ can be provided:
+For reading YAML based onfiguration most easily a +YAMLFormat+ can be provided:
[source, java]
-----------------------------------------------
ConfigurationData dataRead = ConfigurationFormats.readConfig(
- getClassLoader().getResource("myFileConfig.json"), new JSonFOrmat()));
+ getClassLoader().getResource("myFileConfig.yaml"), new YAMLFormat()));
-----------------------------------------------
=== Examples
-The JSON module adds instances of +ConfigurationFormat+ so JSON configuration can be read and mapped to the
-according property maps. E.g. the following file is a simple and correct JSON configuration:
+The YAML module adds instances of +ConfigurationFormat+ so YAML configuration can be read and mapped to the
+according property values. E.g. the following file is a simple and correct YAML configuration:
-[source,listing]
+[source,yaml]
----------------------------------------------------------------
-{
- "a" : "A",
- "b" : "B",
- "c" : "C",
- "d" : {
- "o" : "O",
- "p" : "P"
- }
-}
+invoice: 34843
+date : 2001-01-23
+bill-to: &id001
+ given : Chris
+ family : Dumars
+ address:
+ lines: |
+ 458 Walkman Dr.
+ Suite #292
+ city : Royal Oak
+ state : MI
+ postal : 48046
+ship-to: *id001
+product:
+ - sku : BL394D
+ quantity : 4
+ description : Basketball
+ price : 450.00
+ - sku : BL4438H
+ quantity : 1
+ description : Super Hoop
+ price : 2392.00
+tax : 251.42
+total: 4443.52
+comments:
+ Late afternoon is best.
+ Backup contact is Nancy
+ Billsmer @ 338-4338.
----------------------------------------------------------------
+Hereby the above file, by default is mapped as follows into +Map<String,String>+ typed properties:
+
+[source,listing]
+----------------------------------------------------------------
+invoice -> 34843
+date -> Tue Jan 23 01:00:00 CET 2001
+bill-to.family -> Dumars
+bill-to.given -> Chris
+bill-to.address.state -> MI
+bill-to.address.postal -> 48046
+bill-to.address.city -> Royal Oak
+bill-to.address.lines -> 458 Walkman Dr.
+Suite #292
+
+ship-to.given -> Chris
+ship-to.address.state -> MI
+ship-to.family -> Dumars
+ship-to.address.postal -> 48046
+ship-to.address.city -> Royal Oak
+ship-to.address.lines -> 458 Walkman Dr.
+Suite #292
+
+product -> {sku=BL394D, quantity=4, description=Basketball, price=450.0},{sku=BL4438H, quantity=1, description=Super Hoop, price=2392.0}
+_product.collection-type -> List
+
+tax -> 251.42
+total -> 4443.52
+comments -> Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.
+----------------------------------------------------------------