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/11/18 21:20:40 UTC
[07/16] incubator-tamaya-sandbox git commit: TAMAYA-274 Reduced API
footprint by using Java 8 features. Added some lambdas. TAMAYA-355 Enable
mapping of lists and arrays into internal datastructures. TAMAYA-353 Adding
support for different classloader
TAMAYA-274 Reduced API footprint by using Java 8 features. Added some lambdas.
TAMAYA-355 Enable mapping of lists and arrays into internal datastructures.
TAMAYA-353 Adding support for different classloaders.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/70980cc9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/70980cc9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/70980cc9
Branch: refs/heads/master
Commit: 70980cc9883d98c7a02c34c56e8b74ecd3ca1ab9
Parents: af31937
Author: Anatole Tresch <at...@gmail.com>
Authored: Sat Nov 3 01:46:18 2018 +0100
Committer: Anatole Tresch <at...@gmail.com>
Committed: Sat Nov 3 01:46:18 2018 +0100
----------------------------------------------------------------------
.../commons/CommonsConfigPropertySource.java | 10 +-
.../tamaya/commons/IniConfigurationFormat.java | 8 +-
.../tamaya/commons/XmlConfigurationFormat.java | 5 +-
.../collections/AdaptiveCombinationPolicy.java | 2 +-
.../tamaya/collections/ArrayListConverter.java | 18 +-
.../tamaya/collections/CollectionConverter.java | 216 ++++++++++++++++++-
.../collections/ConcurrentHashMapConverter.java | 10 +-
.../tamaya/collections/HashMapConverter.java | 18 +-
.../tamaya/collections/HashSetConverter.java | 10 +-
.../tamaya/collections/ItemTokenizer.java | 69 +++---
.../tamaya/collections/LinkedListConverter.java | 10 +-
.../tamaya/collections/ListConverter.java | 15 +-
.../apache/tamaya/collections/MapConverter.java | 15 +-
.../apache/tamaya/collections/SetConverter.java | 16 +-
.../tamaya/collections/SortedSetConverter.java | 4 +-
.../tamaya/collections/TreeMapConverter.java | 10 +-
.../tamaya/collections/TreeSetConverter.java | 22 +-
.../collections/CollectionAdvancedTests.java | 16 +-
.../CollectionsTypedReadOnlyTests.java | 16 +-
.../META-INF/javaconfiguration.properties | 46 ++--
.../sysprops/ConfiguredSystemProperties.java | 20 +-
.../tamaya/consul/ConsulPropertySource.java | 4 +-
.../org/apache/tamaya/etcd/EtcdAccessor.java | 52 ++---
.../apache/tamaya/etcd/EtcdPropertySource.java | 10 +-
.../apache/tamaya/etcd/EtcdAccessorTest.java | 2 +-
.../tamaya/jodatime/DateTimeConverterTest.java | 2 +-
.../jodatime/DateTimeZoneConverterTest.java | 2 +-
.../tamaya/jodatime/DurationConverterTest.java | 2 +-
.../org/apache/tamaya/jodatime/FullStackIT.java | 3 -
.../tamaya/jodatime/PeriodConverterTest.java | 2 +-
.../management/ConfigManagementSupport.java | 4 +-
.../apache/tamaya/management/ManagedConfig.java | 3 +-
.../tamaya/management/ManagedConfigMBean.java | 2 +-
.../management/internal/ManagedConfigTest.java | 4 +-
.../apache/tamaya/metamodel/CachedFilter.java | 4 +-
.../org/apache/tamaya/metamodel/Enabled.java | 4 +-
.../tamaya/metamodel/EnabledPropertySource.java | 4 +-
.../org/apache/tamaya/metamodel/HideFilter.java | 2 +-
.../tamaya/metamodel/ImmutableFilter.java | 2 +-
.../org/apache/tamaya/metamodel/MapFilter.java | 2 +-
.../org/apache/tamaya/metamodel/MaskFilter.java | 2 +-
.../apache/tamaya/metamodel/MetaContext.java | 30 +--
.../apache/tamaya/metamodel/SecuredFilter.java | 2 +-
.../ext/EnabledPropertySourceProvider.java | 4 +-
.../metamodel/ext/FilteredPropertySource.java | 4 +-
.../internal/ComponentConfigurator.java | 16 +-
.../metamodel/internal/ComponentFactory.java | 2 +-
.../internal/PropertySourceReader.java | 8 +-
.../ResourcePropertySourceProviderFactory.java | 6 +-
.../factories/URLPropertySourceFactory.java | 6 +-
.../internal/resolver/PropertiesResolver.java | 2 +-
.../metamodel/spi/ItemFactoryManager.java | 4 +-
.../internal/resolver/JavaResolverTest.java | 2 +-
.../ConfigDirPropertySourceProvider.java | 2 +-
.../MetainfConfigPropertySourceProvider.java | 2 +-
.../SimplePropertySourceBuilder.java | 4 +-
.../tamaya/remote/BaseRemotePropertySource.java | 4 +-
.../apache/tamaya/uom/UnitConverterTest.java | 2 +-
.../apache/tamaya/usagetracker/ConfigUsage.java | 2 +-
.../apache/tamaya/usagetracker/UsageStat.java | 14 +-
.../internal/DefaultConfigUsage.java | 2 +-
.../internal/UsageTrackerFilter.java | 2 +-
.../tamaya/usagetracker/spi/ConfigUsageSpi.java | 8 +-
.../test/resources/examples/configmodel.json | 2 +-
.../src/test/resources/examples/configmodel.xml | 2 +-
.../test/resources/examples/configmodel.yaml | 2 +-
validation/pom.xml | 2 +-
.../apache/tamaya/validation/ConfigModel.java | 10 +-
.../tamaya/validation/ConfigModelManager.java | 6 +-
.../apache/tamaya/validation/ModelTarget.java | 6 +-
.../apache/tamaya/validation/Validation.java | 16 +-
.../tamaya/validation/ValidationResult.java | 6 +-
.../internal/ConfigDocumentationBean.java | 4 +-
.../ConfiguredInlineModelProviderSpi.java | 2 +-
.../ConfiguredPropertiesModelProviderSpi.java | 6 +-
.../ConfiguredResourcesModelProviderSpi.java | 21 +-
.../ConfiguredTypeEventsModelPopulator.java | 10 +-
.../ConfiguredTypeEventsModelProvider.java | 2 +-
.../validation/spi/AbstractConfigModel.java | 2 +-
.../spi/ConfigDocumentationMBean.java | 2 +-
.../validation/spi/ConfigModelReader.java | 12 +-
.../tamaya/validation/spi/GroupModel.java | 2 +-
.../tamaya/validation/spi/ModelProviderSpi.java | 4 +-
.../tamaya/validation/spi/ParameterModel.java | 10 +-
.../tamaya/validation/spi/SectionModel.java | 2 +-
.../validation/ConfigModelProviderTest.java | 2 +-
.../tamaya/validation/ValidationTests.java | 2 +-
.../internal/ConfigDocumentationBeanTest.java | 4 +-
.../java/test/model/TestConfigAccessor.java | 2 +-
.../resources/META-INF/configmodel.properties | 4 +-
.../test/resources/examples/configmodel.json | 6 +-
.../resources/examples/configmodel.properties | 4 +-
.../src/test/resources/examples/configmodel.xml | 8 +-
.../test/resources/examples/configmodel.yaml | 6 +-
.../vertx/TamayaConfigurationProducer.java | 8 +-
95 files changed, 588 insertions(+), 385 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java
----------------------------------------------------------------------
diff --git a/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java b/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java
index 206878a..7986536 100644
--- a/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java
+++ b/apache-commons/src/main/java/org/apache/tamaya/commons/CommonsConfigPropertySource.java
@@ -61,8 +61,7 @@ public class CommonsConfigPropertySource implements PropertySource {
@Override
public PropertyValue get(String key) {
- return PropertyValue.of(key, commonsConfig.getString(key),
- getName());
+ return PropertyValue.createValue(key, commonsConfig.getString(key)).setMeta("source", getName());
}
@Override
@@ -71,13 +70,10 @@ public class CommonsConfigPropertySource implements PropertySource {
Iterator<String> keyIter = commonsConfig.getKeys();
while (keyIter.hasNext()) {
String key = keyIter.next();
- config.put(key, PropertyValue.of(key, commonsConfig.getString(key), getName()));
+ config.put(key, PropertyValue.createValue(key, commonsConfig.getString(key))
+ .setMeta("source", getName()));
}
return config;
}
- @Override
- public boolean isScannable() {
- return true;
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/apache-commons/src/main/java/org/apache/tamaya/commons/IniConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/apache-commons/src/main/java/org/apache/tamaya/commons/IniConfigurationFormat.java b/apache-commons/src/main/java/org/apache/tamaya/commons/IniConfigurationFormat.java
index bb12b8b..7c86d65 100644
--- a/apache-commons/src/main/java/org/apache/tamaya/commons/IniConfigurationFormat.java
+++ b/apache-commons/src/main/java/org/apache/tamaya/commons/IniConfigurationFormat.java
@@ -23,6 +23,7 @@ import org.apache.commons.configuration.SubnodeConfiguration;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.format.ConfigurationData;
import org.apache.tamaya.format.ConfigurationFormat;
+import org.apache.tamaya.spi.ObjectValue;
import org.apache.tamaya.spi.PropertyValue;
import java.io.File;
@@ -51,7 +52,7 @@ public class IniConfigurationFormat implements ConfigurationFormat {
@Override
public ConfigurationData readConfiguration(String name, InputStream inputStream) {
- PropertyValue data = PropertyValue.create();
+ PropertyValue data = PropertyValue.createObject();
data.setMeta("name", name);
try {
HierarchicalINIConfiguration commonIniConfiguration;
@@ -63,12 +64,13 @@ public class IniConfigurationFormat implements ConfigurationFormat {
}
for (String section : commonIniConfiguration.getSections()) {
SubnodeConfiguration sectionConfig = commonIniConfiguration.getSection(section);
- PropertyValue sectionNode = data.getOrCreateChild(section);
+ PropertyValue sectionNode = ((ObjectValue) data).getOrSetField(section,
+ () -> PropertyValue.createObject(section));
Map<String, String> properties = new HashMap<>();
Iterator<String> keyIter = sectionConfig.getKeys();
while (keyIter.hasNext()) {
String key = keyIter.next();
- sectionNode.addProperty(key, sectionConfig.getString(key));
+ ((ObjectValue) sectionNode).setField(key, sectionConfig.getString(key));
}
}
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/apache-commons/src/main/java/org/apache/tamaya/commons/XmlConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/apache-commons/src/main/java/org/apache/tamaya/commons/XmlConfigurationFormat.java b/apache-commons/src/main/java/org/apache/tamaya/commons/XmlConfigurationFormat.java
index ed76830..54aa401 100644
--- a/apache-commons/src/main/java/org/apache/tamaya/commons/XmlConfigurationFormat.java
+++ b/apache-commons/src/main/java/org/apache/tamaya/commons/XmlConfigurationFormat.java
@@ -22,6 +22,7 @@ import org.apache.commons.configuration.XMLConfiguration;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.format.ConfigurationData;
import org.apache.tamaya.format.ConfigurationFormat;
+import org.apache.tamaya.spi.ObjectValue;
import org.apache.tamaya.spi.PropertyValue;
import java.io.File;
@@ -48,7 +49,7 @@ public class XmlConfigurationFormat implements ConfigurationFormat {
@Override
public ConfigurationData readConfiguration(String name, InputStream inputStream) {
- PropertyValue data = PropertyValue.create();
+ PropertyValue data = PropertyValue.createObject();
data.setMeta("name", name);
data.setMeta("format.class", getClass().getName());
try {
@@ -62,7 +63,7 @@ public class XmlConfigurationFormat implements ConfigurationFormat {
Iterator<String> keyIter = commonXmlConfiguration.getKeys();
while (keyIter.hasNext()) {
String key = keyIter.next();
- data.addProperty(key, commonXmlConfiguration.getString(key));
+ ((ObjectValue) data).setField(key, commonXmlConfiguration.getString(key));
}
} catch (Exception e) {
throw new ConfigException("Failed to parse xml-file format from " + name, e);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/AdaptiveCombinationPolicy.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/AdaptiveCombinationPolicy.java b/collections/src/main/java/org/apache/tamaya/collections/AdaptiveCombinationPolicy.java
index 32d0949..c6daec8 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/AdaptiveCombinationPolicy.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/AdaptiveCombinationPolicy.java
@@ -65,7 +65,7 @@ public class AdaptiveCombinationPolicy implements PropertyValueCombinationPolicy
if(currentValue==null){
return newValue;
}
- return PropertyValue.create().addChild(newValue).addChild(currentValue);
+ return newValue.toListValue().add(currentValue);
}else{
if(currentValue!=null){
return currentValue;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/ArrayListConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/ArrayListConverter.java b/collections/src/main/java/org/apache/tamaya/collections/ArrayListConverter.java
index 90e8cdb..616b22a 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/ArrayListConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/ArrayListConverter.java
@@ -22,9 +22,6 @@ import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -47,17 +44,12 @@ public class ArrayListConverter implements PropertyConverter<ArrayList> {
@Override
public ArrayList convert(String value) {
- List<String> rawList = ItemTokenizer.split(value);
- ArrayList<Object> mlist = new ArrayList<>();
- for(String raw:rawList){
- Object convValue = ItemTokenizer.convertValue(raw);
- if (convValue != null) {
- mlist.add(convValue);
- }else{
- LOG.log(Level.SEVERE, "Failed to convert collection value type for '"+raw+"'.");
- }
+ ConversionContext context = ConversionContext.current();
+ if(context!=null){
+ // Use configurable mechanism
+ return CollectionConverter.convertList(context, ArrayList::new);
}
- return mlist;
+ return CollectionConverter.convertSimpleList(value);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/CollectionConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/CollectionConverter.java b/collections/src/main/java/org/apache/tamaya/collections/CollectionConverter.java
index 55c3e56..69aa99e 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/CollectionConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/CollectionConverter.java
@@ -18,22 +18,230 @@
*/
package org.apache.tamaya.collections;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.TypeLiteral;
import org.apache.tamaya.spi.PropertyConverter;
import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyValue;
-import java.util.Collection;
+import java.lang.reflect.Type;
+import java.util.*;
+import java.util.function.Supplier;
+import java.util.logging.Logger;
/**
* PropertyConverter for gnerating a LIST representation of values.
*/
-public class CollectionConverter implements PropertyConverter<Collection> {
+public final class CollectionConverter implements PropertyConverter<Collection> {
+
+ private static final Logger LOG = Logger.getLogger(CollectionConverter.class.getName());
+
+ private enum MappingType{
+ /** The list values are identiified by parsing the node value(s) into items.
+ * Hereby only the items of the most significant config entry are considered. */
+ value,
+ /** The list values are identiified by parsing the node value(s) into items, hereby
+ * the items of all values are combined. */
+ value_all,
+ /** The list values are identiified by using the node's child value(s) as items.
+ * Hereby only the items of the most significant config entry are considered.*/
+ node,
+ /** The list values are identiified by using the node's child value(s) as items. Hereby
+ * the items of all values are combined. */
+ node_all
+ }
+
+ private MappingType mappingType = MappingType.value_all;
+
+ public static <T extends Collection> T convertList(ConversionContext context,
+ Supplier<T> collectionSupplier) {
+ MappingType mappingType = MappingType.valueOf((String)context.getMeta()
+ .getOrDefault("mapping", "value_all"));
+ TypeLiteral<?> targetType = context.getTargetType();
+ Type[] types = TypeLiteral.getTypeParameters(targetType.getType());
+ TypeLiteral<?> collectionTargetType;
+ if(types.length>0) {
+ collectionTargetType = TypeLiteral.of(types[0]);
+ }else {
+ collectionTargetType = TypeLiteral.of(String.class);
+ }
+ T result = collectionSupplier.get();
+ switch (mappingType) {
+ case node_all:
+ return convertListByNodes(context.getValues(), context.getConfiguration(),
+ collectionTargetType, result, true);
+ case node:
+ return convertListByNodes(context.getValues(), context.getConfiguration(),
+ collectionTargetType, result, false);
+ case value:
+ return convertListByValues(context.getValues(), context.getConfiguration(),
+ collectionTargetType, result, false);
+ default:
+ case value_all:
+ return convertListByValues(context.getValues(), context.getConfiguration(),
+ collectionTargetType, result, true);
+ }
+ }
+
+ private static <T extends Collection> T convertListByValues(List<PropertyValue> values,
+ Configuration config,
+ TypeLiteral<?> targetType,
+ T result,
+ boolean combine) {
+ if(!combine){
+ values = Collections.singletonList(values.get(0));
+ }
+ for (PropertyValue val : values) {
+ List<String> tokenList = ItemTokenizer.split(val.getValue());
+ for (String token : tokenList) {
+ Object o = ItemTokenizer.convertValue(token, targetType);
+ if (o != null) {
+ result.add(o);
+ }else{
+ LOG.warning(String.format("Failed to convert '{0}' to type: {1}, key: {2}",
+ token, targetType, val.getQualifiedKey()));
+ }
+ }
+ }
+ return result;
+ }
+
+ private static <T extends Collection> T convertListByNodes(List<PropertyValue> values,
+ Configuration config,
+ TypeLiteral<?> targetType,
+ T result,
+ boolean combine) {
+ if(!combine){
+ values = Collections.singletonList(values.get(0));
+ }
+ for (PropertyValue val : values) {
+ for(PropertyValue itemNode:val) {
+ if(targetType.equals(TypeLiteral.of(String.class))){
+ result.add(itemNode.getValue());
+ }else {
+ Object o = ItemTokenizer.convertValue(itemNode.getValue(), targetType);
+ if (o != null) {
+ result.add(o);
+ }else{
+ LOG.warning(String.format("Failed to convert '{0}' to type: {1}, key: {2}",
+ itemNode.getValue(), targetType, itemNode.getQualifiedKey()));
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ public static <T extends Map> T convertMap(ConversionContext context,
+ Supplier<T> collectionSupplier) {
+ TypeLiteral<?> targetType = context.getTargetType();
+ Type[] types = TypeLiteral.getTypeParameters(targetType.getType());
+ TypeLiteral<?> collectionTargetType;
+ if (types.length > 1) {
+ collectionTargetType = TypeLiteral.of(types[1]);
+ } else {
+ collectionTargetType = TypeLiteral.of(String.class);
+ }
+ MappingType mappingType = MappingType.valueOf((String) context.getMeta()
+ .getOrDefault("mapping", "value_all"));
+ T result = collectionSupplier.get();
+ switch (mappingType) {
+ case node_all:
+ return convertMapByNodes(context.getValues(), context.getConfiguration(),
+ collectionTargetType, result, true);
+ case node:
+ return convertMapByNodes(context.getValues(), context.getConfiguration(),
+ collectionTargetType, result, false);
+ case value:
+ return convertMapByValues(context.getValues(), context.getConfiguration(),
+ collectionTargetType, result, false);
+ default:
+ case value_all:
+ return convertMapByValues(context.getValues(), context.getConfiguration(),
+ collectionTargetType, result, true);
+ }
+ }
+
+
+ private static <T extends Map> T convertMapByValues(List<PropertyValue> values,
+ Configuration config,
+ TypeLiteral<?> targetType,
+ T result,
+ boolean combine) {
+ if(!combine){
+ values = Collections.singletonList(values.get(0));
+ }
+ for (PropertyValue val : values) {
+ List<String> tokenList = ItemTokenizer.split(val.getValue());
+ for(String token:tokenList) {
+ String[] keyValue = ItemTokenizer.splitMapEntry(token);
+ Object o = ItemTokenizer.convertValue(keyValue[1], targetType);
+ if (o != null) {
+ result.put(keyValue[0], o);
+ }else{
+ LOG.warning(String.format("Failed to convert '{0}' to type: {1}, key: {2}",
+ keyValue[1], targetType, val.getQualifiedKey()));
+ }
+ }
+ }
+ return result;
+ }
+
+ private static <T extends Map> T convertMapByNodes(List<PropertyValue> values,
+ Configuration config,
+ TypeLiteral<?> targetType,
+ T result,
+ boolean combine) {
+ if(!combine){
+ values = Collections.singletonList(values.get(0));
+ }
+ for (PropertyValue val : values) {
+ for(PropertyValue itemNode:val) {
+ Object o = ItemTokenizer.convertValue(itemNode.getValue(), targetType);
+ if (o != null) {
+ result.put(itemNode.getKey(), o);
+ }else{
+ LOG.warning(String.format("Failed to convert '{0}' to type: {1}, key: {2}",
+ itemNode.getValue(), targetType, itemNode.getQualifiedKey()));
+ }
+ }
+ }
+ return result;
+ }
+
+
+ public static ArrayList<String> convertSimpleList(String value) {
+ List<String> rawList = ItemTokenizer.split(value);
+ ArrayList<String> mlist = new ArrayList<>();
+ for(String raw:rawList){
+ String convValue = raw;
+ if (convValue != null) {
+ mlist.add(convValue);
+ }
+ }
+ return mlist;
+ }
+
+ public static Map<String,String> convertSimpleMap(String value) {
+ List<String> rawList = ItemTokenizer.split(value);
+ HashMap<String,String> result = new HashMap(rawList.size());
+ for(String raw:rawList){
+ String[] items = ItemTokenizer.splitMapEntry(raw);
+ if(items.length==1){
+ result.put(items[0], items[0]);
+ }else{
+ result.put(items[0], items[1]);
+ }
+ }
+ return result;
+ }
@Override
public Collection convert(String value) {
ConversionContext context = ConversionContext.current();
- String collectionType = null;
+ String collectionType = "List";
if(context!=null) {
- collectionType = context.getConfiguration().getOrDefault('_' + context.getKey() + ".collection-type", "List");
+ collectionType = (String)context.getMeta().getOrDefault("collection-type", "List");
if (collectionType.startsWith("java.util.")) {
collectionType = collectionType.substring("java.util.".length());
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/ConcurrentHashMapConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/ConcurrentHashMapConverter.java b/collections/src/main/java/org/apache/tamaya/collections/ConcurrentHashMapConverter.java
index 405766b..3c56749 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/ConcurrentHashMapConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/ConcurrentHashMapConverter.java
@@ -18,6 +18,8 @@
*/
package org.apache.tamaya.collections;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import java.util.List;
@@ -44,15 +46,19 @@ public class ConcurrentHashMapConverter implements PropertyConverter<ConcurrentH
@Override
public ConcurrentHashMap convert(String value) {
+ ConversionContext context = ConversionContext.current();
+ if(context!=null){
+ return CollectionConverter.convertMap(context, ConcurrentHashMap::new);
+ }
List<String> rawList = ItemTokenizer.split(value);
ConcurrentHashMap result = new ConcurrentHashMap(rawList.size());
for(String raw:rawList){
String[] items = ItemTokenizer.splitMapEntry(raw);
- Object convValue = ItemTokenizer.convertValue(items[1]);
+ Object convValue = ItemTokenizer.convertValue(items[1], TypeLiteral.of(String.class));
if(convValue!=null){
result.put(items[0], convValue);
}else{
- LOG.log(Level.SEVERE, "Failed to convert collection value type for '"+raw+"'.");
+ LOG.log(Level.SEVERE, "Failed to convert collection createValue type for '"+raw+"'.");
}
}
return result;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/HashMapConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/HashMapConverter.java b/collections/src/main/java/org/apache/tamaya/collections/HashMapConverter.java
index 5196eb0..3e27b5d 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/HashMapConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/HashMapConverter.java
@@ -18,11 +18,10 @@
*/
package org.apache.tamaya.collections;
+import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import java.util.HashMap;
-import java.util.List;
-import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -44,18 +43,11 @@ public class HashMapConverter implements PropertyConverter<HashMap> {
@Override
public HashMap convert(String value) {
- List<String> rawList = ItemTokenizer.split(value);
- HashMap result = new HashMap(rawList.size());
- for(String raw:rawList){
- String[] items = ItemTokenizer.splitMapEntry(raw);
- Object convValue = ItemTokenizer.convertValue(items[1]);
- if(convValue!=null){
- result.put(items[0], convValue);
- }else{
- LOG.log(Level.SEVERE, "Failed to convert collection value type for '"+raw+"'.");
- }
+ ConversionContext context = ConversionContext.current();
+ if(context!=null){
+ return CollectionConverter.convertMap(context, HashMap::new);
}
- return result;
+ return (HashMap)CollectionConverter.convertSimpleMap(value);
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/HashSetConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/HashSetConverter.java b/collections/src/main/java/org/apache/tamaya/collections/HashSetConverter.java
index c76fe39..b7ca65e 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/HashSetConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/HashSetConverter.java
@@ -18,6 +18,8 @@
*/
package org.apache.tamaya.collections;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import java.util.HashSet;
@@ -45,15 +47,19 @@ public class HashSetConverter implements PropertyConverter<HashSet> {
@Override
public HashSet convert(String value) {
+ ConversionContext context = ConversionContext.current();
+ if(context!=null){
+ return CollectionConverter.convertList(context, HashSet::new);
+ }
List<String> rawList = ItemTokenizer.split(value);
HashSet<Object> result = new HashSet<>();
for(String raw:rawList){
String[] items = ItemTokenizer.splitMapEntry(raw);
- Object convValue = ItemTokenizer.convertValue(items[1]);
+ Object convValue = ItemTokenizer.convertValue(items[1], TypeLiteral.of(String.class));
if(convValue!=null){
result.add(convValue);
}else{
- LOG.log(Level.SEVERE, "Failed to convert collection value type for '"+raw+"'.");
+ LOG.log(Level.SEVERE, "Failed to convert collection createValue type for '"+raw+"'.");
}
}
return result;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java b/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java
index 53864a8..4267c24 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java
@@ -28,7 +28,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
/**
- * Helper class that implements the tokenizing of the entries of a configuration value.
+ * Helper class that implements the tokenizing of the entries of a configuration createValue.
*/
final class ItemTokenizer {
@@ -40,23 +40,23 @@ final class ItemTokenizer {
private ItemTokenizer(){}
/**
- * Splits the given value using the given separator. Matcjhing is done by traversing the String value using
+ * Splits the given createValue using the given separator. Matcjhing is done by traversing the String createValue using
* {@code indexOf} calls, one by one. The last unresolvable item (without any next separator token)
- * is added at the end of the list.
- * @param value the value, not null.
- * @return the tokenized value as list, in order of occurrence.
+ * is added at the end of the createList.
+ * @param value the createValue, not null.
+ * @return the tokenized createValue as createList, in order of occurrence.
*/
public static List<String> split(String value){
ConversionContext ctx = ConversionContext.current();
if(ctx != null){
- return split(value, ctx.getConfiguration().getOrDefault(
- '_' + ctx.getKey() + ".item-separator", ","));
+ String itemSeparator = (String)ctx.getMeta().getOrDefault("item-separator", ",");
+ return split(value, itemSeparator);
}
return split(value, ",");
}
/**
- * Splits the given value using the given separator. Matcjhing is done by traversing the String value using
+ * Splits the given createValue using the given separator. Matching is done by traversing the String value using
* {@code indexOf} calls, one by one. The last unresolvable item (without any next separator token)
* is added at the end of the list.
* @param value the value, not null.
@@ -71,9 +71,6 @@ final class ItemTokenizer {
if (value.charAt(end - 1) != '\\') {
result.add(value.substring(start, end));
start = end + separator.length();
- end = value.indexOf(separator,start);
- }else{
- end = value.indexOf(separator,end + separator.length());
}
end = value.indexOf(separator,start);
}
@@ -84,28 +81,28 @@ final class ItemTokenizer {
}
/**
- * Splits the given String value as a map entry, splitting it into key and value part with the given separator.
- * If the value cannot be split then {@code key = value = mapEntry} is used for further processing. key or value
+ * Splits the given String createValue as a map entry, splitting it into key and createValue part with the given separator.
+ * If the createValue cannot be split then {@code key = createValue = mapEntry} is used for further processing. key or createValue
* parts are normally trimmed, unless they are enclosed with brackets {@code []}.
* @param mapEntry the entry, not null.
- * @return an array of length 2, with the trimmed and parsed key/value pair.
+ * @return an array of length 2, with the trimmed and parsed key/createValue pair.
*/
public static String[] splitMapEntry(String mapEntry){
ConversionContext ctx = ConversionContext.current();
if(ctx != null){
- return splitMapEntry(mapEntry, ctx.getConfiguration().getOrDefault(
- '_' + ctx.getKey() + ".map-entry-separator", "="));
+ String entrySeparator = (String)ctx.getMeta().getOrDefault("map-entry-separator", "=");
+ return splitMapEntry(mapEntry, entrySeparator);
}
return splitMapEntry(mapEntry, "=");
}
/**
- * Splits the given String value as a map entry, splitting it into key and value part with the given separator.
- * If the value cannot be split then {@code key = value = mapEntry} is used for further processing. key or value
+ * Splits the given String createValue as a map entry, splitting it into key and createValue part with the given separator.
+ * If the createValue cannot be split then {@code key = createValue = mapEntry} is used for further processing. key or createValue
* parts are normally trimmed, unless they are enmcosed with brackets {@code []}.
* @param mapEntry the entry, not null.
* @param separator the separator, not null.
- * @return an array of length 2, with the trimmed and parsed key/value pair.
+ * @return an array of length 2, with the trimmed and parsed key/createValue pair.
*/
public static String[] splitMapEntry(final String mapEntry, final String separator) {
int index = mapEntry.indexOf(separator);
@@ -131,35 +128,33 @@ final class ItemTokenizer {
}
/**
- * Parses the given value into the required collection target type, defined by the context.
- * @param value the raw String value.
- * @return the parsed value, or null.
+ * Parses the given createValue into the required collection target type, defined by the context.
+ * @param value the raw String createValue.
+ * @return the parsed createValue, or null.
*/
- public static Object convertValue(String value) {
+ public static <T> T convertValue(String value, TypeLiteral<T> targetType) {
ConversionContext context = ConversionContext.current();
if (context != null) {
- String converterClass = context.getConfiguration().get('_' + context.getKey() + ".item-converters");
- List<PropertyConverter<Object>> valueConverters = new ArrayList<>(1);
+ String converterClass = context.getMeta().get("item-converter");
+ List<PropertyConverter<T>> valueConverters = new ArrayList<>(1);
if (converterClass != null) {
try {
- valueConverters.add((PropertyConverter<Object>) Class.forName(converterClass).newInstance());
+ valueConverters.add((PropertyConverter<T>) Class.forName(converterClass).newInstance());
} catch (Exception e) {
LOG.log(Level.SEVERE, "Error convertion config to ArrayList type.", e);
}
}
- if (TypeLiteral.getTypeParameters(context.getTargetType().getType()).length > 0) {
- valueConverters.addAll(context.getConfigurationContext().getPropertyConverters(
- TypeLiteral.of(TypeLiteral.getTypeParameters(context.getTargetType().getType())[0])));
- }
-
+ valueConverters.addAll(context.getConfigurationContext().getPropertyConverters(targetType));
try{
- ConversionContext.set(new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
- TypeLiteral.of(context.getTargetType().getType())).build());
- Object result = null;
if (valueConverters.isEmpty()) {
- return value;
+ if(targetType.getRawType().equals(String.class)) {
+ return (T)value;
+ }
} else {
- for (PropertyConverter<Object> conv : valueConverters) {
+ ConversionContext.set(new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
+ targetType).build());
+ T result = null;
+ for (PropertyConverter<T> conv : valueConverters) {
try {
result = conv.convert(value);
if (result != null) {
@@ -170,11 +165,11 @@ final class ItemTokenizer {
}
}
}
- LOG.log(Level.SEVERE, "Failed to convert collection value type for '" + value + "'.");
}finally {
ConversionContext.set(context);
}
}
+ LOG.log(Level.SEVERE, "Failed to convert collection createValue type for '" + value + "'.");
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/LinkedListConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/LinkedListConverter.java b/collections/src/main/java/org/apache/tamaya/collections/LinkedListConverter.java
index 459ab77..6c3fa3d 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/LinkedListConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/LinkedListConverter.java
@@ -18,6 +18,8 @@
*/
package org.apache.tamaya.collections;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import java.util.LinkedList;
@@ -44,16 +46,20 @@ public class LinkedListConverter implements PropertyConverter<LinkedList> {
@Override
public LinkedList convert(String value) {
+ ConversionContext context = ConversionContext.current();
+ if(context!=null){
+ return CollectionConverter.convertList(context, LinkedList::new);
+ }
List<String> rawList = ItemTokenizer.split(value);
LinkedList<Object> result = new LinkedList<>();
for(String raw:rawList){
String[] items = ItemTokenizer.splitMapEntry(raw);
- Object convValue = ItemTokenizer.convertValue(items[1]);
+ Object convValue = ItemTokenizer.convertValue(items[1], TypeLiteral.of(String.class));
if(convValue!=null){
result.add(convValue);
continue;
}else{
- LOG.log(Level.SEVERE, "Failed to convert collection value type for '"+raw+"'.");
+ LOG.log(Level.SEVERE, "Failed to convert collection createValue type for '"+raw+"'.");
}
}
return result;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/ListConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/ListConverter.java b/collections/src/main/java/org/apache/tamaya/collections/ListConverter.java
index 45ab932..1a97132 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/ListConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/ListConverter.java
@@ -23,6 +23,7 @@ import org.apache.tamaya.spi.ConversionContext;
import java.util.Collections;
import java.util.List;
+import java.util.function.Supplier;
/**
* PropertyConverter for gnerating a LIST representation of values.
@@ -32,12 +33,14 @@ public class ListConverter implements PropertyConverter<List> {
@Override
public List convert(String value) {
ConversionContext context = ConversionContext.current();
- String collectionType = null;
+ String collectionType = "ArrayList";
+ boolean readOnly = false;
if(context!=null) {
- collectionType = context.getConfiguration().getOrDefault('_' + context.getKey() + ".collection-type", "List");
+ collectionType = (String)context.getMeta().getOrDefault("collection-type", "ArrayList");
if (collectionType.startsWith("java.util.")) {
collectionType = collectionType.substring("java.util.".length());
}
+ readOnly = Boolean.parseBoolean((String)context.getMeta().getOrDefault("read-only", "false"));
}
List result = null;
switch(collectionType){
@@ -50,12 +53,8 @@ public class ListConverter implements PropertyConverter<List> {
result = ArrayListConverter.getInstance().convert(value);
break;
}
- ConversionContext ctx = ConversionContext.current();
- if(ctx != null){
- if(ctx.getConfiguration().getOrDefault(
- '_' + ctx.getKey() + ".read-only", Boolean.class, true)){
- return Collections.unmodifiableList(result);
- }
+ if(readOnly){
+ return Collections.unmodifiableList(result);
}
return result;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/MapConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/MapConverter.java b/collections/src/main/java/org/apache/tamaya/collections/MapConverter.java
index 70cc22e..d7e149e 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/MapConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/MapConverter.java
@@ -32,16 +32,19 @@ public class MapConverter implements PropertyConverter<Map> {
@Override
public Map convert(String value) {
ConversionContext context = ConversionContext.current();
- String collectionType = null;
+ String collectionType = "HashMap";
+ boolean readOnly = false;
if(context!=null) {
- collectionType = context.getConfiguration().getOrDefault('_' + context.getKey() + ".collection-type", "Map");
+ collectionType = (String)context.getMeta().getOrDefault("collection-type", "HashMap");
if (collectionType.startsWith("java.util.")) {
collectionType = collectionType.substring("java.util.".length());
}
+ readOnly = Boolean.parseBoolean((String)context.getMeta().getOrDefault("read-only", "false"));
}
Map result = null;
switch(collectionType){
case "TreeMap":
+ case "SortedMap":
result = TreeMapConverter.getInstance().convert(value);
break;
case "ConcurrentHashMap":
@@ -53,12 +56,8 @@ public class MapConverter implements PropertyConverter<Map> {
result = HashMapConverter.getInstance().convert(value);
break;
}
- ConversionContext ctx = ConversionContext.current();
- if(ctx != null){
- if(ctx.getConfiguration().getOrDefault(
- '_' + ctx.getKey() + ".read-only", Boolean.class, true)){
- return Collections.unmodifiableMap(result);
- }
+ if(readOnly){
+ return Collections.unmodifiableMap(result);
}
return result;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/SetConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/SetConverter.java b/collections/src/main/java/org/apache/tamaya/collections/SetConverter.java
index aa7e6ba..c9a70b5 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/SetConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/SetConverter.java
@@ -32,14 +32,16 @@ public class SetConverter implements PropertyConverter<Set> {
@Override
public Set convert(String value) {
ConversionContext context = ConversionContext.current();
- String collectionType = null;
+ String collectionType = "Set";
+ boolean readOnly = false;
if(context!=null) {
- collectionType = context.getConfiguration().getOrDefault('_' + context.getKey() + ".collection-type", "Set");
+ collectionType = (String)context.getMeta().getOrDefault("collection-type", "HashSet");
if (collectionType.startsWith("java.util.")) {
collectionType = collectionType.substring("java.util.".length());
}
+ readOnly = Boolean.parseBoolean((String)context.getMeta().getOrDefault("read-only", "false"));
}
- Set result = null;
+ Set result;
switch(collectionType){
case "TreeSet":
result = TreeSetConverter.getInstance().convert(value);
@@ -50,12 +52,8 @@ public class SetConverter implements PropertyConverter<Set> {
result = HashSetConverter.getInstance().convert(value);
break;
}
- ConversionContext ctx = ConversionContext.current();
- if(ctx != null){
- if(ctx.getConfiguration().getOrDefault(
- '_' + ctx.getKey() + ".read-only", Boolean.class, true)){
- return Collections.unmodifiableSet(result);
- }
+ if(readOnly){
+ return Collections.unmodifiableSet(result);
}
return result;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/SortedSetConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/SortedSetConverter.java b/collections/src/main/java/org/apache/tamaya/collections/SortedSetConverter.java
index d71af91..6ae4f5b 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/SortedSetConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/SortedSetConverter.java
@@ -18,10 +18,12 @@
*/
package org.apache.tamaya.collections;
+import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import java.util.Collections;
import java.util.SortedSet;
+import java.util.TreeSet;
/**
* PropertyConverter for gnerating a LIST representation of values.
@@ -30,6 +32,6 @@ public class SortedSetConverter implements PropertyConverter<SortedSet> {
@Override
public SortedSet convert(String value) {
- return Collections.unmodifiableSortedSet(TreeSetConverter.getInstance().convert(value));
+ return TreeSetConverter.getInstance().convert(value);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/TreeMapConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/TreeMapConverter.java b/collections/src/main/java/org/apache/tamaya/collections/TreeMapConverter.java
index 26b35ca..08378a6 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/TreeMapConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/TreeMapConverter.java
@@ -18,6 +18,8 @@
*/
package org.apache.tamaya.collections;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import java.util.List;
@@ -45,15 +47,19 @@ public class TreeMapConverter implements PropertyConverter<TreeMap> {
@Override
public TreeMap convert(String value) {
+ ConversionContext context = ConversionContext.current();
+ if(context!=null){
+ return CollectionConverter.convertMap(context, TreeMap::new);
+ }
List<String> rawList = ItemTokenizer.split(value);
TreeMap result = new TreeMap();
for(String raw:rawList){
String[] items = ItemTokenizer.splitMapEntry(raw);
- Object convValue = ItemTokenizer.convertValue(items[1]);
+ Object convValue = ItemTokenizer.convertValue(items[1], TypeLiteral.of(String.class));
if(convValue!=null){
result.put(items[0], convValue);
}else{
- LOG.log(Level.SEVERE, "Failed to convert collection value type for '"+raw+"'.");
+ LOG.log(Level.SEVERE, "Failed to convert collection createValue type for '"+raw+"'.");
}
}
return result;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/main/java/org/apache/tamaya/collections/TreeSetConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/TreeSetConverter.java b/collections/src/main/java/org/apache/tamaya/collections/TreeSetConverter.java
index 94bd8d7..0625957 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/TreeSetConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/TreeSetConverter.java
@@ -18,8 +18,10 @@
*/
package org.apache.tamaya.collections;
+import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
+import java.util.Collections;
import java.util.List;
import java.util.TreeSet;
import java.util.logging.Level;
@@ -45,16 +47,16 @@ public class TreeSetConverter implements PropertyConverter<TreeSet> {
@Override
public TreeSet convert(String value) {
- List<String> rawList = ItemTokenizer.split(value);
- TreeSet<Object> result = new TreeSet<>();
- for(String raw:rawList){
- String[] items = ItemTokenizer.splitMapEntry(raw);
- Object convValue = ItemTokenizer.convertValue(items[1]);
- if(convValue!=null){
- result.add(convValue);
- continue;
- }else{
- LOG.log(Level.SEVERE, "Failed to convert collection value type for '"+raw+"'.");
+ TreeSet result = null;
+ ConversionContext context = ConversionContext.current();
+ if(context!=null) {
+ result = CollectionConverter.convertList(context, TreeSet::new);
+ }
+ else {
+ List<String> rawList = ItemTokenizer.split(value);
+ result = new TreeSet<>();
+ for (String raw : rawList) {
+ result.add(raw);
}
}
return result;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java b/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java
index 1c6d4b2..f9ac048 100644
--- a/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java
+++ b/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java
@@ -38,9 +38,9 @@ public class CollectionAdvancedTests {
/**
* Tests if a custom separator works, Config is
* <pre>
- * sep-list=a,b,c|d,e,f|g,h,i
- * _sep-list.collection-type=List
- * _sep-list.collection-separator=|
+ * sep-createList=a,b,c|d,e,f|g,h,i
+ * _sep-createList.collection-type=List
+ * _sep-createList.collection-separator=|
* </pre>
*/
@Test
@@ -58,8 +58,8 @@ public class CollectionAdvancedTests {
/**
* Test typed content.
* <pre>
- * currency-list=CHF,USD,YEN
- * _currency-list.collection-type=List
+ * currency-createList=CHF,USD,YEN
+ * _currency-createList.collection-type=List
* </pre>
*/
@Test
@@ -77,9 +77,9 @@ public class CollectionAdvancedTests {
/**
* Tests if a custom parser works, Config is
* <pre>
- * parser-list=a,b,c
- * _parser-list.collection-type=List
- * _parser-list.item-converter=org.apache.tamaya.collections.MyUpperCaseConverter
+ * parser-createList=a,b,c
+ * _parser-createList.collection-type=List
+ * _parser-createList.item-converter=org.apache.tamaya.collections.MyUpperCaseConverter
* </pre>
*/
@Test
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java b/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java
index e8a94db..848d1b3 100644
--- a/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java
+++ b/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java
@@ -57,7 +57,7 @@ public class CollectionsTypedReadOnlyTests {
items.add("test");
}
- @Test(expected=UnsupportedOperationException.class)
+ @Test
public void testLinkedListList_1(){
Configuration config = Configuration.current();
List<String> items = config.get("typed.linkedlist", new TypeLiteral<List<String>>(){});
@@ -67,7 +67,7 @@ public class CollectionsTypedReadOnlyTests {
items.add("test");
}
- @Test(expected=UnsupportedOperationException.class)
+ @Test
public void testLinkedListList_2(){
Configuration config = Configuration.current();
List<String> items = (List<String>) config.get("typed.linkedlist", List.class);
@@ -78,7 +78,7 @@ public class CollectionsTypedReadOnlyTests {
}
- @Test(expected=UnsupportedOperationException.class)
+ @Test
public void testHashSet_1(){
Configuration config = Configuration.current();
Set<String> items = config.get("typed.hashset", new TypeLiteral<Set<String>>(){});
@@ -87,7 +87,7 @@ public class CollectionsTypedReadOnlyTests {
assertEquals(10, items.size());
items.add("test");
}
- @Test(expected=UnsupportedOperationException.class)
+ @Test
public void testHashSet_2(){
Configuration config = Configuration.current();
Set<String> items = (Set<String>) config.get("typed.hashset", Set.class);
@@ -97,7 +97,7 @@ public class CollectionsTypedReadOnlyTests {
items.add("test");
}
- @Test(expected=UnsupportedOperationException.class)
+ @Test
public void testTreeSet_1(){
Configuration config = Configuration.current();
Set<String> items = config.get("typed.treeset", new TypeLiteral<Set<String>>(){});
@@ -106,7 +106,7 @@ public class CollectionsTypedReadOnlyTests {
assertEquals(10, items.size());
items.add("test");
}
- @Test(expected=UnsupportedOperationException.class)
+ @Test
public void testTreeSet_2(){
Configuration config = Configuration.current();
Set<String> items = items = (Set<String>) config.get("typed.treeset", Set.class);
@@ -144,7 +144,7 @@ public class CollectionsTypedReadOnlyTests {
}
- @Test(expected=UnsupportedOperationException.class)
+ @Test
public void testTreeMap_1(){
Configuration config = Configuration.current();
Map<String,String> items = config.get("typed.treemap", new TypeLiteral<Map<String,String>>(){});
@@ -157,7 +157,7 @@ public class CollectionsTypedReadOnlyTests {
assertEquals(" ", items.get("4"));
items.put("g","hjhhj");
}
- @Test(expected=UnsupportedOperationException.class)
+ @Test
public void testTreeMap_2(){
Configuration config = Configuration.current();
Map<String,String> items = (Map<String,String>) config.get("typed.treemap", Map.class);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/collections/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/collections/src/test/resources/META-INF/javaconfiguration.properties b/collections/src/test/resources/META-INF/javaconfiguration.properties
index 1521809..3764840 100644
--- a/collections/src/test/resources/META-INF/javaconfiguration.properties
+++ b/collections/src/test/resources/META-INF/javaconfiguration.properties
@@ -24,50 +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
-_typed2.arraylist.collection-type=ArrayList
-_typed2.arraylist.read-only=false
+[META]typed2.arraylist.collection-type=ArrayList
typed2.linkedlist=1,2,3,4,5,6,7,8,9,0
-_typed2.linkedlist.collection-type=java.util.LinkedList
-_typed2.linkedlist.read-only=false
+[META]typed2.linkedlist.collection-type=java.util.LinkedList
typed2.hashset=1,2,3,4,5,6,7,8,9,0
-_typed2.hashset.collection-type=HashSet
-_typed2.hashset.read-only=false
+[META]typed2.hashset.collection-type=HashSet
typed2.treeset=1,2,3,4,5,6,7,8,9,0
-_typed2.treeset.collection-type=TreeSet
-_typed2.treeset.read-only=false
+[META]typed2.treeset.collection-type=TreeSet
typed2.hashmap=1=a, 2=b, 3=c, [4= ]
-_typed2.hashmap.collection-type=java.util.HashMap
-_typed2.hashmap.read-only=false
+[META]typed2.hashmap.collection-type=java.util.HashMap
typed2.treemap=1=a, 2=b, 3=c, [4= ]
-_typed2.treemap.collection-type=TreeMap
-_typed2.treemap.read-only=false
+[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
-_typed.arraylist.collection-type=ArrayList
+[META]typed.arraylist.collection-type=ArrayList
+[META]typed.arraylist.read-only=true
typed.linkedlist=1,2,3,4,5,6,7,8,9,0
-_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
-_typed.hashset.collection-type=HashSet
+[META]typed.hashset.collection-type=HashSet
typed.treeset=1,2,3,4,5,6,7,8,9,0
-_typed.treeset.collection-type=TreeSet
+[META]typed.treeset.collection-type=TreeSet
typed.hashmap=1=a, 2=b, 3=c, [4= ]
-_typed.hashmap.collection-type=java.util.HashMap
+[META]typed.hashmap.collection-type=java.util.HashMap
+[META]typed.hashmap.read-only=true
typed.treemap=1=a, 2=b, 3=c, [4= ]
-_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
-_sep-list.collection-type=List
-_sep-list.item-separator=|
+[META]sep-list.collection-type=List
+[META]sep-list.item-separator=|
currency-list=CHF,USD,USS
-_currency-list.collection-type=List
+[META]currency-list.collection-type=List
parser-list=a,b,c
-_parser-list.collection-type=List
-_parser-list.item-converters=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
-_redefined-map.map-entry-separator===
-_redefined-map.item-separator=|
+[META]redefined-map.map-entry-separator===
+[META]redefined-map.item-separator=|
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
----------------------------------------------------------------------
diff --git a/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java b/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
index f65b539..e88deb5 100644
--- a/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
+++ b/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
@@ -280,28 +280,28 @@ public class ConfiguredSystemProperties extends Properties {
// }
//
// @Override
-// public Object putIfAbsent(Object key, Object value) {
-// return getContextualProperties().putIfAbsent(key, value);
+// public Object putIfAbsent(Object key, Object createValue) {
+// return getContextualProperties().putIfAbsent(key, createValue);
// }
//
// @Override
-// public boolean remove(Object key, Object value) {
-// return getContextualProperties().remove(key, value);
+// public boolean remove(Object key, Object createValue) {
+// return getContextualProperties().remove(key, createValue);
// }
//
// @Override
-// public boolean replace(Object key, Object oldValue, Object newValue) {
-// return getContextualProperties().replace(key, oldValue, newValue);
+// public boolean replace(Object key, Object oldValue, Object createValue) {
+// return getContextualProperties().replace(key, oldValue, createValue);
// }
//
// @Override
-// public Object replace(Object key, Object value) {
-// return getContextualProperties().replace(key, value);
+// public Object replace(Object key, Object createValue) {
+// return getContextualProperties().replace(key, createValue);
// }
//
// @Override
-// public Object merge(Object key, Object value, BiFunction<? super Object, ? super Object, ?> remappingFunction) {
-// return getContextualProperties().merge(key, value, remappingFunction);
+// public Object merge(Object key, Object createValue, BiFunction<? super Object, ? super Object, ?> remappingFunction) {
+// return getContextualProperties().merge(key, createValue, remappingFunction);
// }
public Properties getInitialProperties() {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java
----------------------------------------------------------------------
diff --git a/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java b/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java
index b16596a..a456708 100644
--- a/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java
+++ b/consul/src/main/java/org/apache/tamaya/consul/ConsulPropertySource.java
@@ -95,7 +95,7 @@ implements MutablePropertySource{
}
/**
- * Returns the default ordinal used, when no ordinal is setCurrent, or the ordinal was not parseable to an int value.
+ * Returns the default ordinal used, when no ordinal is setCurrent, or the ordinal was not parseable to an int createValue.
* @return the default ordinal used, by default 1000.
*/
public int getDefaultOrdinal(){
@@ -139,7 +139,7 @@ implements MutablePropertySource{
if(!valueOpt.isPresent()) {
LOG.log(Level.FINE, "key not found in consul: " + reqKey);
}else{
- // No prefix mapping necessary here, since we only access/return the value...
+ // No prefix mapping necessary here, since we only access/return the createValue...
Value value = valueOpt.get();
Map<String,String> props = new HashMap<>();
props.put(reqKey+".createIndex", String.valueOf(value.getCreateIndex()));
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/etcd/src/main/java/org/apache/tamaya/etcd/EtcdAccessor.java
----------------------------------------------------------------------
diff --git a/etcd/src/main/java/org/apache/tamaya/etcd/EtcdAccessor.java b/etcd/src/main/java/org/apache/tamaya/etcd/EtcdAccessor.java
index 8fd66da..4ceb7b2 100644
--- a/etcd/src/main/java/org/apache/tamaya/etcd/EtcdAccessor.java
+++ b/etcd/src/main/java/org/apache/tamaya/etcd/EtcdAccessor.java
@@ -139,17 +139,17 @@ public class EtcdAccessor {
}
/**
- * Ask etcd for a single key, value pair. Hereby the response returned from
+ * Ask etcd for a single key, createValue pair. Hereby the response returned from
* etcd:
*
* <pre>
* {
* "action": "current",
- * "getChild": {
+ * "getField": {
* "createdIndex": 2,
* "key": "/message",
* "modifiedIndex": 2,
- * "value": "Hello world"
+ * "createValue": "Hello world"
* }
* }
* </pre>
@@ -157,7 +157,7 @@ public class EtcdAccessor {
* is mapped to:
*
* <pre>
- * key=value
+ * key=createValue
* _key.source=[etcd]http://127.0.0.1:4001
* _key.createdIndex=12
* _key.modifiedIndex=34
@@ -180,9 +180,9 @@ public class EtcdAccessor {
final JsonReader reader = readerFactory
.createReader(new StringReader(EntityUtils.toString(entity)));
final JsonObject o = reader.readObject();
- final JsonObject node = o.getJsonObject("getChild");
- if (node.containsKey("value")) {
- result.put(key, node.getString("value"));
+ final JsonObject node = o.getJsonObject("getField");
+ if (node.containsKey("createValue")) {
+ result.put(key, node.getString("createValue"));
result.put("_" + key + ".source", "[etcd]" + serverURL);
}
if (node.containsKey("createdIndex")) {
@@ -213,7 +213,7 @@ public class EtcdAccessor {
* Creates/updates an entry in etcd without any ttl setCurrent.
*
* @param key the property key, not null
- * @param value the value to be setCurrent
+ * @param value the createValue to be setCurrent
* @return the result map as described above.
* @see #set(String, String, Integer)
*/
@@ -227,16 +227,16 @@ public class EtcdAccessor {
* <pre>
* {
* "action": "setCurrent",
- * "getChild": {
+ * "getField": {
* "createdIndex": 3,
* "key": "/message",
* "modifiedIndex": 3,
- * "value": "Hello etcd"
+ * "createValue": "Hello etcd"
* },
* "prevNode": {
* "createdIndex": 2,
* "key": "/message",
- * "value": "Hello world",
+ * "createValue": "Hello world",
* "modifiedIndex": 2
* }
* }
@@ -245,7 +245,7 @@ public class EtcdAccessor {
* is mapped to:
*
* <pre>
- * key=value
+ * key=createValue
* _key.source=[etcd]http://127.0.0.1:4001
* _key.createdIndex=12
* _key.modifiedIndex=34
@@ -259,7 +259,7 @@ public class EtcdAccessor {
* </pre>
*
* @param key the property key, not null
- * @param value the value to be setCurrent
+ * @param value the createValue to be setCurrent
* @param ttlSeconds the ttl in seconds (optional)
* @return the result map as described above.
*/
@@ -270,7 +270,7 @@ public class EtcdAccessor {
put.setConfig(RequestConfig.copy(RequestConfig.DEFAULT).setSocketTimeout(socketTimeout)
.setConnectionRequestTimeout(timeout).setConnectTimeout(connectTimeout).build());
final List<NameValuePair> nvps = new ArrayList<>();
- nvps.add(new BasicNameValuePair("value", value));
+ nvps.add(new BasicNameValuePair("createValue", value));
if (ttlSeconds != null) {
nvps.add(new BasicNameValuePair("ttl", ttlSeconds.toString()));
}
@@ -282,7 +282,7 @@ public class EtcdAccessor {
final JsonReader reader = readerFactory
.createReader(new StringReader(EntityUtils.toString(entity)));
final JsonObject o = reader.readObject();
- final JsonObject node = o.getJsonObject("getChild");
+ final JsonObject node = o.getJsonObject("getField");
if (node.containsKey("createdIndex")) {
result.put("_" + key + ".createdIndex", String.valueOf(node.getInt("createdIndex")));
}
@@ -295,7 +295,7 @@ public class EtcdAccessor {
if (node.containsKey("ttl")) {
result.put("_" + key + ".ttl", String.valueOf(node.getInt("ttl")));
}
- result.put(key, node.getString("value"));
+ result.put(key, node.getString("createValue"));
result.put("_" + key + ".source", "[etcd]" + serverURL);
parsePrevNode(key, result, node);
EntityUtils.consume(entity);
@@ -322,7 +322,7 @@ public class EtcdAccessor {
* _key.prevNode.modifiedIndex=34
* _key.prevNode.ttl=300
* _key.prevNode.expiration=...
- * _key.prevNode.value=...
+ * _key.prevNode.createValue=...
* </pre>
*
* @param key the key to be deleted.
@@ -340,7 +340,7 @@ public class EtcdAccessor {
final JsonReader reader = readerFactory
.createReader(new StringReader(EntityUtils.toString(entity)));
final JsonObject o = reader.readObject();
- final JsonObject node = o.getJsonObject("getChild");
+ final JsonObject node = o.getJsonObject("getField");
if (node.containsKey("createdIndex")) {
result.put("_" + key + ".createdIndex", String.valueOf(node.getInt("createdIndex")));
}
@@ -382,7 +382,7 @@ public class EtcdAccessor {
if (prevNode.containsKey("ttl")) {
result.put("_" + key + ".prevNode.ttl", String.valueOf(prevNode.getInt("ttl")));
}
- result.put("_" + key + ".prevNode.value", prevNode.getString("value"));
+ result.put("_" + key + ".prevNode.createValue", prevNode.getString("createValue"));
}
}
@@ -403,10 +403,10 @@ public class EtcdAccessor {
* <pre>
* {
* "action": "current",
- * "getChild": {
+ * "getField": {
* "key": "/",
* "dir": true,
- * "getChildren": [
+ * "getList": [
* {
* "key": "/foo_dir",
* "dir": true,
@@ -415,7 +415,7 @@ public class EtcdAccessor {
* },
* {
* "key": "/foo",
- * "value": "two",
+ * "createValue": "two",
* "modifiedIndex": 1,
* "createdIndex": 1
* }
@@ -460,7 +460,7 @@ public class EtcdAccessor {
final HttpEntity entity = response.getEntity();
final JsonReader reader = readerFactory.createReader(new StringReader(EntityUtils.toString(entity)));
final JsonObject o = reader.readObject();
- final JsonObject node = o.getJsonObject("getChild");
+ final JsonObject node = o.getJsonObject("getField");
if (node != null) {
addNodes(result, node);
}
@@ -479,12 +479,12 @@ public class EtcdAccessor {
* Recursively read out all key/values from this etcd JSON array.
*
* @param result map with key, values and metadata.
- * @param node the getChild to parse.
+ * @param node the getField to parse.
*/
private void addNodes(Map<String, String> result, JsonObject node) {
if (!node.containsKey("dir") || "false".equals(node.get("dir").toString())) {
final String key = node.getString("key").substring(1);
- result.put(key, node.getString("value"));
+ result.put(key, node.getString("createValue"));
if (node.containsKey("createdIndex")) {
result.put("_" + key + ".createdIndex", String.valueOf(node.getInt("createdIndex")));
}
@@ -499,7 +499,7 @@ public class EtcdAccessor {
}
result.put("_" + key + ".source", "[etcd]" + serverURL);
} else {
- final JsonArray nodes = node.getJsonArray("getChildren");
+ final JsonArray nodes = node.getJsonArray("getList");
if (nodes != null) {
for (int i = 0; i < nodes.size(); i++) {
addNodes(result, nodes.getJsonObject(i));
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java
----------------------------------------------------------------------
diff --git a/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java b/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java
index c512b24..bae780c 100644
--- a/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java
+++ b/etcd/src/main/java/org/apache/tamaya/etcd/EtcdPropertySource.java
@@ -149,10 +149,10 @@ public class EtcdPropertySource extends BasePropertySource
try{
props = accessor.get(key);
if(!props.containsKey("_ERROR")) {
- // No prefix mapping necessary here, since we only access/return the value...
+ // No prefix mapping necessary here, since we only access/return the createValue...
metaData.putAll(props);
metaData.remove(key);
- return PropertyValue.create(key, props.get(key)).setMeta("source", getName()).setMeta(metaData);
+ return PropertyValue.createValue(key, props.get(key)).setMeta("source", getName()).setMeta(metaData);
} else{
LOG.log(Level.FINE, "etcd error on " + accessor.getUrl() + ": " + props.get("_ERROR"));
}
@@ -188,7 +188,7 @@ public class EtcdPropertySource extends BasePropertySource
if (!entry.getKey().startsWith("_")) {
PropertyValue val = values.get(entry.getKey());
if (val == null) {
- val = PropertyValue.create(entry.getKey(), "").setMeta("source", getName()).setMeta(metaData);
+ val = PropertyValue.createValue(entry.getKey(), "").setMeta("source", getName()).setMeta(metaData);
values.put(entry.getKey(), val);
}
}
@@ -209,13 +209,13 @@ public class EtcdPropertySource extends BasePropertySource
}
}
}
- // Map to value map.
+ // Map to createValue map.
// Map<String, PropertyValue> values = new HashMap<>();
for(Map.Entry<String,PropertyValue> en:values.entrySet()) {
if(prefix.isEmpty()){
values.put(en.getKey(), en.getValue());
}else{
- values.put(prefix + en.getKey(), en.getValue().setKey(prefix + en.getKey()));
+ values.put(prefix + en.getKey(), en.getValue().mutable().setKey(prefix + en.getKey()));
}
}
return values;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/etcd/src/test/java/org/apache/tamaya/etcd/EtcdAccessorTest.java
----------------------------------------------------------------------
diff --git a/etcd/src/test/java/org/apache/tamaya/etcd/EtcdAccessorTest.java b/etcd/src/test/java/org/apache/tamaya/etcd/EtcdAccessorTest.java
index 11b354d..630a028 100644
--- a/etcd/src/test/java/org/apache/tamaya/etcd/EtcdAccessorTest.java
+++ b/etcd/src/test/java/org/apache/tamaya/etcd/EtcdAccessorTest.java
@@ -99,7 +99,7 @@ public class EtcdAccessorTest {
assertEquals(value, accessor.get("testDelete").get("testDelete"));
assertNotNull(result.get("_testDelete.createdIndex"));
result = accessor.delete("testDelete");
- assertEquals(value, result.get("_testDelete.prevNode.value"));
+ assertEquals(value, result.get("_testDelete.prevNode.createValue"));
assertNull(accessor.get("testDelete").get("testDelete"));
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java
----------------------------------------------------------------------
diff --git a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java
index 194022f..7283cb2 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeConverterTest.java
@@ -72,7 +72,7 @@ public class DateTimeConverterTest {
for (Object[] pair : inputResultPairs) {
DateTime date = converter.convert((String)pair[0]);
- assertThat("Converter failed to convert input value " + pair[0], date, notNullValue());
+ assertThat("Converter failed to convert input createValue " + pair[0], date, notNullValue());
assertThat(date.isEqual((DateTime)pair[1]), is(true));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
----------------------------------------------------------------------
diff --git a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
index e46c75f..6061d29 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/DateTimeZoneConverterTest.java
@@ -59,7 +59,7 @@ public class DateTimeZoneConverterTest {
for (Object[] pair : inputResultPairs) {
DateTimeZone zone = converter.convert((String) pair[0]);
- assertThat("Converter failed to convert input value " + pair[0], zone, notNullValue());
+ assertThat("Converter failed to convert input createValue " + pair[0], zone, notNullValue());
assertThat(zone, equalTo((DateTimeZone)pair[1]));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java
----------------------------------------------------------------------
diff --git a/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java b/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java
index 513deeb..07270d1 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/DurationConverterTest.java
@@ -61,7 +61,7 @@ public class DurationConverterTest {
for (Object[] pair : inputResultPairs) {
Duration duration = converter.convert((String) pair[0]);
- assertThat("Converter failed to convert input value " + pair[0], duration, notNullValue());
+ assertThat("Converter failed to convert input createValue " + pair[0], duration, notNullValue());
assertThat(duration, equalTo((Duration) pair[1]));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
----------------------------------------------------------------------
diff --git a/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java b/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
index 9372aac..85bc6ca 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/FullStackIT.java
@@ -19,14 +19,11 @@
package org.apache.tamaya.jodatime;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.MutablePeriod;
import org.joda.time.Period;
import org.joda.time.format.ISOPeriodFormat;
-import org.junit.Ignore;
import org.junit.Test;
import java.util.Locale;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java
----------------------------------------------------------------------
diff --git a/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java b/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java
index 9dc97e7..15e0018 100644
--- a/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java
+++ b/jodatime/src/test/java/org/apache/tamaya/jodatime/PeriodConverterTest.java
@@ -65,7 +65,7 @@ public class PeriodConverterTest {
for (Object[] pair : inputResultPairs) {
Period period = converter.convert((String) pair[0]);
- assertThat("Converter failed to convert input value " + pair[0], period, notNullValue());
+ assertThat("Converter failed to convert input createValue " + pair[0], period, notNullValue());
assertThat(period, equalTo((Period)pair[1]));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java
----------------------------------------------------------------------
diff --git a/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java b/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java
index 64fa062..f2becb5 100644
--- a/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java
+++ b/management/src/main/java/org/apache/tamaya/management/ConfigManagementSupport.java
@@ -65,7 +65,7 @@ public class ConfigManagementSupport {
/**
* Registers the {@link ManagedConfigMBean} mbean for accessing config documentation into the local platform
* mbean server.
- * @param context An optional context parameter to be added to the object name.
+ * @param context An optional context parameter to be added to the createObject name.
* @return the registered ObjectName, or null, if no bean could be created.
*/
public static ObjectName registerMBean(String context) {
@@ -104,7 +104,7 @@ public class ConfigManagementSupport {
/**
* Unegisters the {@link ManagedConfigMBean} mbean for accessing config documentation into the local
* platform mbean server.
- * @param context An optional context parameter to be added to the object name.
+ * @param context An optional context parameter to be added to the createObject name.
* @return the unregistered ObjectName, or null, if no bean could be created.
*/
public static ObjectName unregisterMBean(String context) {
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
----------------------------------------------------------------------
diff --git a/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java b/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
index c804d22..79cf5c4 100644
--- a/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
+++ b/management/src/main/java/org/apache/tamaya/management/ManagedConfig.java
@@ -20,7 +20,6 @@ package org.apache.tamaya.management;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
import org.apache.tamaya.functions.ConfigurationFunctions;
import java.util.Map;
@@ -92,7 +91,7 @@ public class ManagedConfig implements ManagedConfigMBean {
/**
* Evaluate the current configuration. By default this class is temporarely setting the
- * TCCL to the instance active on bean creation and then calls {@link ConfigurationProvider#getConfiguration()}.
+ * TCCL to the instance active on bean creation and then calls {@link Configuration#current()} .
*
* @return the configuration instance to be used.
*/
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/70980cc9/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
----------------------------------------------------------------------
diff --git a/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java b/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
index 1682819..01db541 100644
--- a/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
+++ b/management/src/main/java/org/apache/tamaya/management/ManagedConfigMBean.java
@@ -57,7 +57,7 @@ public interface ManagedConfigMBean {
* ConfigurationContext[gqContextClassName] {
* version = 2345-34334-2333-3434,
* config {
- * key = "value",
+ * key = "createValue",
* key2 = "value2"
* ...
* },