You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/08/01 19:37:34 UTC

incubator-tamaya git commit: Updated formats (still not satisfied).

Repository: incubator-tamaya
Updated Branches:
  refs/heads/master c4822f3e7 -> 2c93b1028


Updated formats (still not satisfied).


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2c93b102
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2c93b102
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2c93b102

Branch: refs/heads/master
Commit: 2c93b102869c7d509761788ff237f1ece399344b
Parents: c4822f3
Author: anatole <at...@gmail.com>
Authored: Sat Aug 1 19:37:21 2015 +0200
Committer: anatole <at...@gmail.com>
Committed: Sat Aug 1 19:37:21 2015 +0200

----------------------------------------------------------------------
 .../src/test/resources/examples/configmodel.ini |  57 ++++++---
 .../test/resources/examples/configmodel.json    | 126 +++++++++----------
 .../src/test/resources/examples/configmodel.xml | 116 +++++++++--------
 .../test/resources/examples/configmodel.yaml    |   1 +
 4 files changed, 160 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2c93b102/sandbox/model/src/test/resources/examples/configmodel.ini
----------------------------------------------------------------------
diff --git a/sandbox/model/src/test/resources/examples/configmodel.ini b/sandbox/model/src/test/resources/examples/configmodel.ini
index 1171228..95fb735 100644
--- a/sandbox/model/src/test/resources/examples/configmodel.ini
+++ b/sandbox/model/src/test/resources/examples/configmodel.ini
@@ -5,7 +5,7 @@
 ####################################################################################
 # Metamodel information
 ####################################################################################
-[__meta-model]
+[model:Meta-model]
 name = testmodel,
 provider = ConfigModel Extension,
 version = 1.0,
@@ -16,40 +16,57 @@ comments : = Late afternoon is best.\
            Backup contact is Nancy.
 
 ####################################################################################
+# Reusable parameter definitions.
+####################################################################################
+// reusable parameter definition
+[MyNumber:Parameter]
+type = Integer",
+description = an (reusable) number type parameter (optional)
+
+####################################################################################
 # Description of Configuration Sections (minimal, can be extended by other modules).
 # By default its interpreted as a section !
 ####################################################################################
-[a]
+[a:Section]
 # Paramname Type         Validations   Description
-params2 = String,      required,     "a required parameter"
-paramInt = Integer,                   "an optional parameter (default)"
+params2.type = String
+params2.required = true
+params2.description = "a required parameter"
+paramInt.ref = MyNumber
+paramInt.description = "an optional parameter (default)"
+_number.type = Integer
+_number.deprecated = true
+_number.mappedTo = "a.paramInt"
 
-[a.b.c]
-__desc = Just a test section
+[a.b.c:Section]
+description = Just a test section
 
-[a.b.c.aRequiredSection]
-__validations = required
-__desc = A section containing required parameters is called a required section.\
+[a.b.c.aRequiredSection:Section]
+required = true
+description = A section containing required parameters is called a required section.\
          Sections can also explicitly be defined to be required, but without\
          specifying the paramteres to be contained.,
 
-[a.b.c.aRequiredSection.subsection]
+[a.b.c.aRequiredSection.subsection:Section]
 # Paramname   Type         Validations   Description
-param0 = String,                    "a minmally documented String parameter"
+param0.type = String
+param0.description = "a minmally documented String parameter"
 # A minmal String parameter
-param00 = String
+param00.type = String
 # description is optional
-param1 = String,      required
-intParam = Integer,                   "an optional parameter (default)"
+param1.type = String
+param1.required = true
+intParam.type = Integer
+intParam.description = "an optional parameter (default)"
 
-[a.b.c.aRequiredSection.nonempty-subsection]
-__validations = required
+[a.b.c.aRequiredSection.nonempty-subsection:Section]
+required = true
 
-[a.b.c.aRequiredSection.optional-subsection]
+[a.b.c.aRequiredSection.optional-subsection:Section]
 
-[a.b.c.aValidatedSection]
-__desc = "A validated section."
-__validations = org.apache.tamaya.model.TestValidator?max=3
+[a.b.c.aValidatedSection:Section]
+description = "A validated section."
+validations = org.apache.tamaya.model.TestValidator?max=3
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2c93b102/sandbox/model/src/test/resources/examples/configmodel.json
----------------------------------------------------------------------
diff --git a/sandbox/model/src/test/resources/examples/configmodel.json b/sandbox/model/src/test/resources/examples/configmodel.json
index b5e3043..fcd16ec 100644
--- a/sandbox/model/src/test/resources/examples/configmodel.json
+++ b/sandbox/model/src/test/resources/examples/configmodel.json
@@ -9,7 +9,7 @@
 // Metamodel information
 //##################################################################################
 {
-  "__meta-model": {
+  "model:Metamodel": {
     "name": "testmodel",
     "provider": "ConfigModel Extension",
     "version": "1.0",
@@ -18,81 +18,71 @@
     // "modelformat": "alternate format reader type"
     "comments": "Late afternoon is best. Backup contact is Nancy."
   },
+  // reusable parameter definition
+  "MyNumber:Parameter": {
+    "type": "Integer",
+    "description": "an (reusable) number type parameter (optional)"
+  },
   //##################################################################################
   // Description of Configuration Sections (minimal, can be extended by other modules).
   //##################################################################################
-  "a": {
-    // Paramname Type         Validations    Description
-    "params2": [
-      "String",
-      "required",
-      "a required parameter"
-    ],
-    "paramInt": [
-      "Integer",
-      "an optional parameter (default)"
-    ],
-    "sections": [
-      "b.c"
-      :
-      {
-        "__desc": "Just a test section."
-      }
-    ],
+  "a:Section": {
+    // required, default is parameter!
+    "params2": {
+      "required": true,
+      "description": "a required parameter"
+    },
+    "paramInt": {
+      // references a shared parameter definition.
+      "ref": "MyNumber",
+      "description": "an optional parameter (default)"
+    },
+    "_number": {
+      "type": "Integer",
+      "deprecated": true,
+      // references a deprecated parameter, now mapped to 'a.paramInt'.
+      "mappedto": "a.paramInt"
+    }
   },
-  "a.b.c.aRequiredSection": {
-    "__validations": "required",
-    "__desc": "A section containing required parameters is called a required section.
-    Sections
-    can
-    also
-    explicitly
-    be
-    defined
-    to
-    be
-    required,
-    but
-    without
-    specifying
-    the
-    paramteres
-    to
-    be
-    contained
-    .
-    "
+  "a.b.c:Section": {
+    "description": "Just a test section."
+    // a subsection, directly configured as child element.
+    "aRequiredSection": {
+      "class": "Section",
+      "required": true,
+      "description": "A section containing required parameters is called a required section."
+    }
   },
-  "a.b.c.aRequiredSection.subsection": {
-    // Paramname   Type         Validations   Description
-    "param0": [
-      "String",
-      "a minmally documented String parameter"
-    ],
+  // a subsection, configured in its own section.
+  "a.b.c.aRequiredSection.subsection:Section": {
+    "param0": {
+      "type": "String",
+      "description": "a minmally documented String parameter"
+    },
     // A minmally defined String parameter
-    "param00": [
-      "String"
-    ],
-    "param1": [
-      "String",
-      "required",
-      "a required parameter"
-    ],
-    "intParam": [
-      "Integer",
-      "an optional parameter (default)"
-    ]
+    "param00": {},
+    "param1": {
+      "type": "String",
+      "required": true,
+      "description": "a required parameter"
+    },
+    "intParam": {
+      "type": "Integer",
+      "required": true,
+      "description": "an optional parameter (default)"
+    }
   },
-  "a.b.c.aRequiredSection.nonempty-subsection": {
-    "__validations": "required"
+  "a.b.c.aRequiredSection.nonempty-subsection:Section": {
+    "required": true
   },
-  "a.b.c.aRequiredSection.optional-subsection": {},
-  "a.b.c.aRequiredSection.aValidatedSection": {
-    "__desc": "A validated section.",
-    "__validations": [
+  "a.b.c.aRequiredSection.optional-subsection:Section": {
+  },
+  "a.b.c.aRequiredSection.aValidatedSection:Section": {
+    "description": "A validated section.",
+    "validations": [
       "org.apache.tamaya.model.validation.MaxItemValidator?max=3"
-    ]
-  }
-}
+      }
+    }
+    }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2c93b102/sandbox/model/src/test/resources/examples/configmodel.xml
----------------------------------------------------------------------
diff --git a/sandbox/model/src/test/resources/examples/configmodel.xml b/sandbox/model/src/test/resources/examples/configmodel.xml
index 5bdcb44..761051c 100644
--- a/sandbox/model/src/test/resources/examples/configmodel.xml
+++ b/sandbox/model/src/test/resources/examples/configmodel.xml
@@ -9,60 +9,72 @@
 # Metamodel information
 #################################################################################-->
 
-<model>
-    <meta-model>
-        <name>testmodel</name>
-        <provider>ConfigModel Extension</provider>
-        <version>1.0</version>
-        <release-date>2001-01-23</release-date>
-        <author>Anatole Tresch</author>
-        <!-- model-format>alternate format reader type</model-format -->
-        <comments>Late afternoon is best.
-            Backup contact is Nancy.
-        </comments>
-    </meta-model>
+<model class="Metamodel">
+    <name>testmodel</name>
+    <provider>ConfigModel Extension</provider>
+    <version>1.0</version>
+    <release-date>2001-01-23</release-date>
+    <author>Anatole Tresch</author>
+    <!-- model-format>alternate format reader type</model-format -->
+    <comments>Late afternoon is best.
+        Backup contact is Nancy.
+    </comments>
 
     <!--################################################################################
     # Description of Configuration Sections (minimal, can be extended by other modules).
     #################################################################################-->
-    <section name="a">
-        <param name="params2" type="String" validators="required">a required parameter</param>
-        <param name="paramInt" type="Integer" validators="required">an optional parameter (default)</param>
-        <section name="b.c">
-            <desc>Just a test section.</desc>
-        </section>
-    </section>
-    <section name="a.b.c.aRequiredSection" validators="required">
-        <desc>A section containing required parameters is called a required section.
-            Sections can also explicitly be defined to be required, but without
-            specifying the paramteres to be contained.
-        </desc>
-    </section>
-</model>
-        <!--
-                a.b.c.aRequiredSection.subsection: {
-                # Paramname   Type         Validations   Description
-                param0:    'String',                   'a minmally documented String parameter}',
-                param00:   'String',                                 # A minmally defined String parameter
-                param1:    'String',     'required',   'a required parameter',
-                intParam:  'Integer',                  'an optional parameter (default)'
-                }
-                ...
-
-                ---
-                a.b.c.aRequiredSection.nonempty-subsection: {
-                __validations: 'required'
-                }
-                ...
-
-                ---
-                a.b.c.aRequiredSection.optional-subsection: {}
-                ...
-
-                ---
-                a.b.c.aRequiredSection.aValidatedSection: {
-                __desc: 'A validated section.',
-                __validations: 'org.apache.tamaya.model.validation.MaxItemValidator?max=3'
-                }
-        -->
+    <a class="Section">
+        <params class="Parameter">
+            <type>String</type>
+            <required>true</required>
+            <description>a required parameter</description>
+        </params>
+        <paramInt>
+            <ref>MyNumber</ref>
+            <required>true</required>
+            <description>an optional parameter (default)</description>
+        </paramInt>
+        <_number>
+            <type>Integer</type>
+            <deprecated>true</deprecated>
+            <mappedto>a.paramInt</mappedto>
+        </_number>
+        <b.c class="Section">
+            <description>Just a test section.</description>
+            <aRequiredSection class="Section">
+                <description>A section containing required parameters is called a required section.
+                    Sections can also explicitly be defined to be required, but without
+                    specifying the paramteres to be contained.
+                </description>
+            </aRequiredSection>
+        </b.c>
+    </a>
 
+    <a.b.c.aRequiredSection.subsection class="Section">
+        <param name="param0" type="String">a minmally documented String parameter</param>
+        <!-- # A minmally defined String parameter -->
+        <param00>
+            <type>String</type>
+        </param00>
+        <param1>
+            <type>String</type>
+            <required>true</required>
+            <description>a required parameter</description>description>
+        </param1>
+        <intParam>
+            <type>Integer</type>
+            <description>an optional parameter (default)</description>
+        </intParam>
+        <b.c class="Section">
+            <description>Just a test section.</description>
+        </b.c>
+    </a.b.c.aRequiredSection.subsection>
+    <a.b.c.aRequiredSection.nonempty-subsection>
+        <required>true</required>
+    </a.b.c.aRequiredSection.nonempty-subsection>
+    <a.b.c.aRequiredSection.optional-subsection class="Section"/>
+    <a.b.c.aRequiredSection.aValidatedSection>
+        <validations>org.apache.tamaya.model.validation.MaxItemValidator?max=3"</validations>
+        <description>A validated section.</description>
+    </a.b.c.aRequiredSection.aValidatedSection>
+</model>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2c93b102/sandbox/model/src/test/resources/examples/configmodel.yaml
----------------------------------------------------------------------
diff --git a/sandbox/model/src/test/resources/examples/configmodel.yaml b/sandbox/model/src/test/resources/examples/configmodel.yaml
index 30b0e58..bdba29f 100644
--- a/sandbox/model/src/test/resources/examples/configmodel.yaml
+++ b/sandbox/model/src/test/resources/examples/configmodel.yaml
@@ -4,6 +4,7 @@
 #   Sequence items are denoted by a dash,
 #   key value pairs within a map are separated by a colon.
 ####################################################################################
+tbd (adapt to others...)
 
 ####################################################################################
 # Metamodel information