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 2018/12/15 23:22:33 UTC

[incubator-tamaya-extensions] 01/05: TAMAYA-372: Clarified default metadata format.

This is an automated email from the ASF dual-hosted git repository.

anatole pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tamaya-extensions.git

commit 74a7a9b18ae548c6fa053c69877e3c19460315e5
Author: Anatole Tresch <at...@gmail.com>
AuthorDate: Tue Dec 11 11:00:34 2018 +0100

    TAMAYA-372: Clarified default metadata format.
---
 .../META-INF/javaconfiguration.properties          | 42 +++++++++++-----------
 .../consul/AbstractConsulPropertySource.java       | 16 ++++-----
 .../filter/internal/DefaultMetadataFilter.java     |  2 +-
 .../hazelcast/AbstractHazelcastPropertySource.java |  6 ++--
 4 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/modules/collections/src/test/resources/META-INF/javaconfiguration.properties b/modules/collections/src/test/resources/META-INF/javaconfiguration.properties
index 6e6b436..b0d66f3 100644
--- a/modules/collections/src/test/resources/META-INF/javaconfiguration.properties
+++ b/modules/collections/src/test/resources/META-INF/javaconfiguration.properties
@@ -24,46 +24,46 @@ base.map=1:a, 2:b, 3:c, [4: ]
 
 # Config for tests with explcit implementation types
 typed2.arraylist=1,2,3,4,5,6,7,8,9,0
-[META]typed2.arraylist.collection-type=ArrayList
+[(META)typed2.arraylist].collection-type=ArrayList
 typed2.linkedlist=1,2,3,4,5,6,7,8,9,0
-[META]typed2.linkedlist.collection-type=java.util.LinkedList
+[(META)typed2.linkedlist].collection-type=java.util.LinkedList
 typed2.hashset=1,2,3,4,5,6,7,8,9,0
-[META]typed2.hashset.collection-type=HashSet
+[(META)typed2.hashset].collection-type=HashSet
 typed2.treeset=1,2,3,4,5,6,7,8,9,0
-[META]typed2.treeset.collection-type=TreeSet
+[(META)typed2.treeset].collection-type=TreeSet
 typed2.hashmap=1:a, 2:b, 3:c, [4: ]
-[META]typed2.hashmap.collection-type=java.util.HashMap
+[(META)typed2.hashmap].collection-type=java.util.HashMap
 typed2.treemap=1:a, 2:b, 3:c, [4: ]
-[META]typed2.treemap.collection-type=TreeMap
+[(META)typed2.treemap].collection-type=TreeMap
 
 # Config for tests with combination policy, writable
 typed.arraylist=1,2,3,4,5,6,7,8,9,0
-[META]typed.arraylist.collection-type=ArrayList
-[META]typed.arraylist.read-only=true
+[(META)typed.arraylist].collection-type=ArrayList
+[(META)typed.arraylist].read-only=true
 typed.linkedlist=1,2,3,4,5,6,7,8,9,0
-[META]typed.linkedlist.collection-type=java.util.LinkedList
+[(META)typed.linkedlist.collection-type=java.util.LinkedList
 typed.hashset=1,2,3,4,5,6,7,8,9,0
-[META]typed.hashset.collection-type=HashSet
+[(META)typed.hashset].collection-type=HashSet
 typed.treeset=1,2,3,4,5,6,7,8,9,0
-[META]typed.treeset.collection-type=TreeSet
+[(META)typed.treeset].collection-type=TreeSet
 typed.hashmap=1:a, 2:b, 3:c, [4: ]
-[META]typed.hashmap.collection-type=java.util.HashMap
-[META]typed.hashmap.read-only=true
+[(META)typed.hashmap].collection-type=java.util.HashMap
+[(META)typed.hashmap].read-only=true
 typed.treemap=1:a, 2:b, 3:c, [4: ]
-[META]typed.treemap.collection-type=TreeMap
+[(META)typed.treemap].collection-type=TreeMap
 
 # Config for advanced tests
 sep-list=a,b,c|d,e,f|g,h,i
-[META]sep-list.collection-type=List
-[META]sep-list.item-separator=|
+[(META)sep-list].collection-type=List
+[(META)sep-list].item-separator=|
 currency-list=CHF,USD,USS
-[META]currency-list.collection-type=List
+[(META)currency-list].collection-type=List
 
 parser-list=a,b,c
-[META]parser-list.collection-type=List
-[META]parser-list.item-converter=org.apache.tamaya.collections.MyUpperCaseConverter
+[(META)parser-list].collection-type=List
+[(META)parser-list].item-converter=org.apache.tamaya.collections.MyUpperCaseConverter
 
 redefined-map=0==none | 1==single | 2==any
-[META]redefined-map.map-entry-separator===
-[META]redefined-map.item-separator=|
+[(META)redefined-map].map-entry-separator===
+[(META)redefined-map].item-separator=|
 
diff --git a/modules/consul/src/main/java/org/apache/tamaya/consul/AbstractConsulPropertySource.java b/modules/consul/src/main/java/org/apache/tamaya/consul/AbstractConsulPropertySource.java
index 8b11eeb..0b2b871 100644
--- a/modules/consul/src/main/java/org/apache/tamaya/consul/AbstractConsulPropertySource.java
+++ b/modules/consul/src/main/java/org/apache/tamaya/consul/AbstractConsulPropertySource.java
@@ -149,18 +149,18 @@ implements MutablePropertySource{
     public PropertyValue get(String key) {
         checkRefresh();
         String reqKey = key;
-        if(key.startsWith("[META]")){
-            reqKey = key.substring("[META]".length());
-            if(reqKey.endsWith(".createdIndex")){
-                reqKey = reqKey.substring(0,reqKey.length()-".createdIndex".length());
+        if(key.startsWith("[(META)")){
+            reqKey = key.substring("[(META)".length());
+            if(reqKey.endsWith("].createdIndex")){
+                reqKey = reqKey.substring(0,reqKey.length()-"].createdIndex".length());
             } else if(reqKey.endsWith(".modifiedIndex")){
-                reqKey = reqKey.substring(0,reqKey.length()-".modifiedIndex".length());
+                reqKey = reqKey.substring(0,reqKey.length()-"].modifiedIndex".length());
             } else if(reqKey.endsWith(".ttl")){
-                reqKey = reqKey.substring(0,reqKey.length()-".ttl".length());
+                reqKey = reqKey.substring(0,reqKey.length()-"].ttl".length());
             } else if(reqKey.endsWith(".expiration")){
-                reqKey = reqKey.substring(0,reqKey.length()-".expiration".length());
+                reqKey = reqKey.substring(0,reqKey.length()-"].expiration".length());
             } else if(reqKey.endsWith(".source")){
-                reqKey = reqKey.substring(0,reqKey.length()-".source".length());
+                reqKey = reqKey.substring(0,reqKey.length()-"].source".length());
             }
         }
         PropertyValue val = this.configMap.get(reqKey);
diff --git a/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java b/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
index 2a543ef..a946d32 100644
--- a/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
+++ b/modules/filter/src/main/java/org/apache/tamaya/filter/internal/DefaultMetadataFilter.java
@@ -34,7 +34,7 @@ public final class DefaultMetadataFilter implements PropertyFilter{
             return valueToBeFiltered;
         }
         if(ThreadBasedConfigurationFilter.isMetadataFiltered()) {
-            if (context.getProperty().getKey().startsWith("[META]")) {
+            if (context.getProperty().getKey().startsWith("[(META)")) {
                 // Hide metadata entries.
                 return null;
             }
diff --git a/modules/hazelcast/src/main/java/org/apache/tamaya/hazelcast/AbstractHazelcastPropertySource.java b/modules/hazelcast/src/main/java/org/apache/tamaya/hazelcast/AbstractHazelcastPropertySource.java
index 117bb2c..6084b63 100644
--- a/modules/hazelcast/src/main/java/org/apache/tamaya/hazelcast/AbstractHazelcastPropertySource.java
+++ b/modules/hazelcast/src/main/java/org/apache/tamaya/hazelcast/AbstractHazelcastPropertySource.java
@@ -218,10 +218,10 @@ implements MutablePropertySource{
         for(String key: configChange.getRemovedProperties()){
             config.remove(key);
         }
-        IList<String> taList = getHazelcastInstance().getList("[META]tamaya.transactions");
+        IList<String> taList = getHazelcastInstance().getList("[(META)tamaya.transactions]");
         taList.add(configChange.getTransactionID());
-        config.put("[META]tamaya.transaction.lastId", configChange.getTransactionID(), 1, TimeUnit.DAYS);
-        config.put("[META]tamaya.transaction.startedAt", String.valueOf(configChange.getStartedAt()), 1, TimeUnit.DAYS);
+        config.put("[(META)tamaya.transaction].lastId", configChange.getTransactionID(), 1, TimeUnit.DAYS);
+        config.put("[(META)tamaya.transaction].startedAt", String.valueOf(configChange.getStartedAt()), 1, TimeUnit.DAYS);
         config.flush();
         refresh();
     }