You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2016/07/15 12:04:47 UTC
[21/21] incubator-tamaya git commit: - Minimalized current API for
further discussions.
- Minimalized current API for further discussions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/43468987
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/43468987
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/43468987
Branch: refs/heads/tamaya-next
Commit: 434689876f9f132535b92726aaaf4f7d588ee138
Parents: f54cc77
Author: anatole <an...@apache.org>
Authored: Fri Jul 15 14:03:50 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Fri Jul 15 14:03:51 2016 +0200
----------------------------------------------------------------------
.../org.apache.tamaya.spi.ServiceContext | 2 +-
.../test/resources/ServiceContextWithOrdinal | 2 +-
...pache.tamaya.spi.ConfigurationContextBuilder | 2 +-
...g.apache.tamaya.spi.ConfigurationProviderSpi | 2 +-
.../org.apache.tamaya.spi.PropertyConverter | 30 +-
.../org.apache.tamaya.spi.PropertySource | 4 +-
...org.apache.tamaya.spi.PropertySourceProvider | 2 +-
.../org.apache.tamaya.spi.ServiceContext | 2 +-
.../org.apache.tamaya.spi.PropertySource | 4 +-
...org.apache.tamaya.spi.PropertySourceProvider | 2 +-
.../resources/findbugs/findbugs-exclude.xml | 2 +-
code/api/pom.xml | 4 +-
.../java/org/apache/tamaya/ConfigOperator.java | 37 --
.../java/org/apache/tamaya/ConfigQuery.java | 36 --
.../java/org/apache/tamaya/Configuration.java | 98 +---
.../apache/tamaya/ConfigurationProvider.java | 87 ++--
.../java/org/apache/tamaya/TypeLiteral.java | 202 ---------
.../apache/tamaya/spi/ConfigurationContext.java | 160 -------
.../tamaya/spi/ConfigurationContextBuilder.java | 174 -------
.../tamaya/spi/ConfigurationProviderSpi.java | 76 ----
.../apache/tamaya/spi/ConversionContext.java | 255 -----------
.../org/apache/tamaya/spi/Experimental.java | 32 --
.../org/apache/tamaya/spi/FilterContext.java | 104 -----
.../apache/tamaya/spi/PropertyConverter.java | 44 --
.../org/apache/tamaya/spi/PropertyFilter.java | 48 --
.../org/apache/tamaya/spi/PropertySource.java | 158 -------
.../tamaya/spi/PropertySourceProvider.java | 60 ---
.../org/apache/tamaya/spi/PropertyValue.java | 117 -----
.../apache/tamaya/spi/PropertyValueBuilder.java | 103 -----
.../spi/PropertyValueCombinationPolicy.java | 66 ---
.../org/apache/tamaya/spi/ServiceContext.java | 59 ---
.../tamaya/spi/ServiceContextManager.java | 118 -----
.../org/apache/tamaya/ConfigExceptionTest.java | 90 ++--
.../org/apache/tamaya/ConfigurationTest.java | 64 +--
.../org/apache/tamaya/TestConfiguration.java | 145 +++---
.../tamaya/TestConfigurationProvider.java | 24 +-
.../java/org/apache/tamaya/TypeLiteralTest.java | 122 ++---
.../tamaya/spi/PropertyValueBuilderTest.java | 84 ----
.../apache/tamaya/spi/PropertyValueTest.java | 52 ---
.../apache/tamaya/spi/ServiceContextTest.java | 98 ----
.../apache/tamaya/spi/TestServiceContext.java | 90 ----
....tamaya.builder.spi.ConfigurationProviderSpi | 19 +
...org.apache.tamaya.builder.spi.ServiceContext | 19 +
...g.apache.tamaya.spi.ConfigurationProviderSpi | 19 -
.../org.apache.tamaya.spi.ServiceContext | 19 -
code/core/pom.xml | 2 +-
.../core/internal/DefaultConfiguration.java | 219 ---------
.../internal/DefaultConfigurationContext.java | 278 ------------
.../DefaultConfigurationContextBuilder.java | 153 -------
.../internal/DefaultConfigurationProvider.java | 65 ---
.../core/internal/DefaultServiceContext.java | 156 -------
.../tamaya/core/internal/OSGIActivator.java | 53 ---
.../core/internal/OSGIServiceComparator.java | 69 ---
.../core/internal/OSGIServiceContext.java | 83 ----
.../tamaya/core/internal/OSGIServiceLoader.java | 157 -------
.../internal/PriorityServiceComparator.java | 67 ---
.../core/internal/PropertyConverterManager.java | 448 -------------------
.../core/internal/PropertyFilterComparator.java | 60 ---
.../tamaya/core/internal/PropertyFiltering.java | 147 ------
.../core/internal/PropertySourceComparator.java | 54 ---
.../tamaya/core/internal/ReflectionUtil.java | 42 --
.../converters/BigDecimalConverter.java | 63 ---
.../converters/BigIntegerConverter.java | 94 ----
.../internal/converters/BooleanConverter.java | 57 ---
.../core/internal/converters/ByteConverter.java | 71 ---
.../core/internal/converters/CharConverter.java | 69 ---
.../internal/converters/ClassConverter.java | 63 ---
.../internal/converters/CurrencyConverter.java | 90 ----
.../internal/converters/DoubleConverter.java | 81 ----
.../core/internal/converters/EnumConverter.java | 68 ---
.../internal/converters/FloatConverter.java | 81 ----
.../internal/converters/IntegerConverter.java | 74 ---
.../core/internal/converters/LongConverter.java | 72 ---
.../internal/converters/NumberConverter.java | 72 ---
.../internal/converters/ShortConverter.java | 72 ---
.../core/internal/converters/URIConverter.java | 47 --
.../core/internal/converters/URLConverter.java | 47 --
.../core/propertysource/BasePropertySource.java | 101 -----
.../core/propertysource/CLIPropertySource.java | 101 -----
.../EnvironmentPropertySource.java | 102 -----
.../propertysource/SimplePropertySource.java | 136 ------
.../propertysource/SystemPropertySource.java | 126 ------
.../provider/JavaConfigurationProvider.java | 85 ----
.../services/org.apache.tamaya.Configuration | 2 +-
...pache.tamaya.spi.ConfigurationContextBuilder | 19 -
...g.apache.tamaya.spi.ConfigurationProviderSpi | 19 -
.../org.apache.tamaya.spi.PropertyConverter | 33 --
.../org.apache.tamaya.spi.PropertySource | 21 -
...org.apache.tamaya.spi.PropertySourceProvider | 19 -
.../org.apache.tamaya.spi.ServiceContext | 19 -
.../java/org/apache/tamaya/core/internal/A.java | 29 --
.../java/org/apache/tamaya/core/internal/B.java | 29 --
.../java/org/apache/tamaya/core/internal/C.java | 56 ---
.../tamaya/core/internal/CTestConverter.java | 32 --
.../internal/DefaultServiceContextTest.java | 140 ------
.../internal/PropertyConverterManagerTest.java | 179 --------
.../converters/BigDecimalConverter.java | 63 +++
.../converters/BigDecimalConverterTest.java | 103 -----
.../converters/BigIntegerConverter.java | 94 ++++
.../internal/converters/BooleanConverter.java | 57 +++
.../converters/BooleanConverterTest.java | 108 -----
.../core/internal/converters/ByteConverter.java | 71 +++
.../internal/converters/ByteConverterTest.java | 81 ----
.../core/internal/converters/CharConverter.java | 69 +++
.../internal/converters/CharConverterTest.java | 86 ----
.../internal/converters/ClassConverter.java | 63 +++
.../ConverterTestsPropertySource.java | 253 -----------
.../internal/converters/CurrencyConverter.java | 90 ++++
.../converters/CurrencyConverterTest.java | 154 -------
.../internal/converters/DoubleConverter.java | 81 ++++
.../converters/DoubleConverterTest.java | 175 --------
.../core/internal/converters/EnumConverter.java | 68 +++
.../internal/converters/EnumConverterTest.java | 60 ---
.../internal/converters/FloatConverter.java | 81 ++++
.../internal/converters/FloatConverterTest.java | 176 --------
.../internal/converters/IntegerConverter.java | 74 +++
.../converters/IntegerConverterTest.java | 111 -----
.../core/internal/converters/LongConverter.java | 72 +++
.../internal/converters/LongConverterTest.java | 111 -----
.../internal/converters/NumberConverter.java | 72 +++
.../converters/NumberConverterTest.java | 103 -----
.../internal/converters/ShortConverter.java | 72 +++
.../internal/converters/ShortConverterTest.java | 111 -----
.../core/internal/converters/URIConverter.java | 47 ++
.../core/internal/converters/URLConverter.java | 47 ++
.../propertysource/BasePropertySourceTest.java | 105 -----
.../propertysource/CLIPropertySourceTest.java | 58 ---
.../EnvironmentPropertySourceTest.java | 66 ---
.../PropertiesFilePropertySourceTest.java | 59 ---
.../SystemPropertySourceTest.java | 101 -----
.../provider/JavaConfigurationProviderTest.java | 60 ---
.../testdata/TestPropertyDefaultSource.java | 56 ---
.../core/testdata/TestPropertyFilter.java | 38 --
.../testdata/TestPropertySourceProvider.java | 78 ----
.../testdata/TestRemovingPropertyFilter.java | 42 --
.../META-INF/javaconfiguration.properties | 22 -
....apache.tamaya.builder.spi.PropertyConverter | 19 +
...tServiceContextTest$InvalidPriorityInterface | 18 -
...efaultServiceContextTest$MultiImplsInterface | 20 -
.../org.apache.tamaya.spi.PropertyConverter | 19 -
.../org.apache.tamaya.spi.PropertyFilter | 20 -
.../org.apache.tamaya.spi.PropertySource | 22 -
...org.apache.tamaya.spi.PropertySourceProvider | 20 -
.../test/resources/overrideOrdinal.properties | 25 --
.../core/src/test/resources/testfile.properties | 22 -
code/core/src/test/resources/x34.properties | 19 -
...org.apache.tamaya.builder.spi.PropertySource | 20 +
...he.tamaya.builder.spi.PropertySourceProvider | 19 +
.../org.apache.tamaya.spi.PropertySource | 20 -
...org.apache.tamaya.spi.PropertySourceProvider | 19 -
...he.tamaya.builder.spi.PropertySourceProvider | 19 +
...org.apache.tamaya.spi.PropertySourceProvider | 19 -
...he.tamaya.builder.spi.PropertySourceProvider | 20 +
...org.apache.tamaya.spi.PropertySourceProvider | 20 -
...org.apache.tamaya.builder.spi.PropertySource | 19 +
.../org.apache.tamaya.spi.PropertySource | 19 -
jqassistant/default.xml | 4 +-
jqassistant/serviceloader-rules.xml | 2 +-
.../tamaya/builder/ConfigurationBuilder.java | 72 +--
.../ProgrammaticConfigurationContext.java | 36 +-
.../tamaya/builder/PropertySourceBuilder.java | 8 +-
.../tamaya/builder/SimplePropertySource.java | 4 +-
.../internal/DefaultConfigurationContext.java | 278 ++++++++++++
.../DefaultConfigurationContextBuilder.java | 153 +++++++
.../internal/DefaultConfigurationProvider.java | 62 +++
.../builder/internal/DefaultServiceContext.java | 156 +++++++
.../tamaya/builder/internal/OSGIActivator.java | 53 +++
.../builder/internal/OSGIServiceComparator.java | 69 +++
.../builder/internal/OSGIServiceContext.java | 82 ++++
.../builder/internal/OSGIServiceLoader.java | 156 +++++++
.../internal/PriorityServiceComparator.java | 67 +++
.../internal/PropertyConverterManager.java | 448 +++++++++++++++++++
.../internal/PropertyFilterComparator.java | 60 +++
.../builder/internal/PropertyFiltering.java | 147 ++++++
.../internal/PropertySourceComparator.java | 54 +++
.../tamaya/builder/internal/ReflectionUtil.java | 42 ++
.../propertysource/BasePropertySource.java | 101 +++++
.../propertysource/CLIPropertySource.java | 101 +++++
.../EnvironmentPropertySource.java | 102 +++++
.../propertysource/SimplePropertySource.java | 137 ++++++
.../propertysource/SystemPropertySource.java | 125 ++++++
.../provider/JavaConfigurationProvider.java | 85 ++++
.../builder/spi/ConfigurationContext.java | 159 +++++++
.../spi/ConfigurationContextBuilder.java | 174 +++++++
.../builder/spi/ConfigurationProviderSpi.java | 76 ++++
.../tamaya/builder/spi/ConversionContext.java | 255 +++++++++++
.../apache/tamaya/builder/spi/Experimental.java | 32 ++
.../tamaya/builder/spi/FilterContext.java | 104 +++++
.../tamaya/builder/spi/PropertyConverter.java | 44 ++
.../tamaya/builder/spi/PropertyFilter.java | 48 ++
.../tamaya/builder/spi/PropertySource.java | 158 +++++++
.../builder/spi/PropertySourceProvider.java | 60 +++
.../tamaya/builder/spi/PropertyValue.java | 117 +++++
.../builder/spi/PropertyValueBuilder.java | 103 +++++
.../spi/PropertyValueCombinationPolicy.java | 66 +++
.../tamaya/builder/spi/ServiceContext.java | 59 +++
.../builder/spi/ServiceContextManager.java | 118 +++++
.../builder/ConfigurationBuilderTest.java | 1 +
.../builder/TestANonSPIPropertyFilter.java | 4 +-
.../builder/TestBNonSPIPropertyFilter.java | 4 +-
.../tamaya/builder/TestPropertyFilter.java | 4 +-
.../tamaya/builder/TestPropertySource.java | 5 +-
.../builder/TestPropertySourceProvider.java | 8 +-
.../builder/TestPropertySourceProviderB.java | 8 +-
.../org/apache/tamaya/builder/internal/A.java | 29 ++
.../org/apache/tamaya/builder/internal/B.java | 29 ++
.../org/apache/tamaya/builder/internal/C.java | 56 +++
.../tamaya/builder/internal/CTestConverter.java | 32 ++
.../internal/DefaultServiceContextTest.java | 139 ++++++
.../internal/PropertyConverterManagerTest.java | 178 ++++++++
.../converters/BigDecimalConverterTest.java | 103 +++++
.../converters/BooleanConverterTest.java | 108 +++++
.../internal/converters/ByteConverterTest.java | 81 ++++
.../internal/converters/CharConverterTest.java | 86 ++++
.../ConverterTestsPropertySource.java | 253 +++++++++++
.../converters/CurrencyConverterTest.java | 154 +++++++
.../converters/DoubleConverterTest.java | 175 ++++++++
.../internal/converters/EnumConverterTest.java | 59 +++
.../internal/converters/FloatConverterTest.java | 176 ++++++++
.../converters/IntegerConverterTest.java | 111 +++++
.../internal/converters/LongConverterTest.java | 111 +++++
.../converters/NumberConverterTest.java | 103 +++++
.../internal/converters/ShortConverterTest.java | 111 +++++
.../propertysource/BasePropertySourceTest.java | 104 +++++
.../propertysource/CLIPropertySourceTest.java | 58 +++
.../EnvironmentPropertySourceTest.java | 66 +++
.../PropertiesFilePropertySourceTest.java | 59 +++
.../SystemPropertySourceTest.java | 101 +++++
.../provider/JavaConfigurationProviderTest.java | 60 +++
.../builder/spi/PropertyValueBuilderTest.java | 84 ++++
.../tamaya/builder/spi/PropertyValueTest.java | 50 +++
.../tamaya/builder/spi/ServiceContextTest.java | 98 ++++
.../tamaya/builder/spi/TestServiceContext.java | 90 ++++
.../testdata/TestPropertyDefaultSource.java | 56 +++
.../builder/testdata/TestPropertyFilter.java | 38 ++
.../testdata/TestPropertySourceProvider.java | 78 ++++
.../testdata/TestRemovingPropertyFilter.java | 42 ++
.../types/CustomTypeCPropertyConverter.java | 4 +-
....apache.tamaya.builder.spi.PropertyConverter | 19 +
...org.apache.tamaya.builder.spi.PropertyFilter | 21 +
...org.apache.tamaya.builder.spi.PropertySource | 23 +
...he.tamaya.builder.spi.PropertySourceProvider | 22 +
...tServiceContextTest$InvalidPriorityInterface | 18 +
...efaultServiceContextTest$MultiImplsInterface | 20 +
.../org.apache.tamaya.spi.PropertyConverter | 19 -
.../org.apache.tamaya.spi.PropertyFilter | 19 -
.../org.apache.tamaya.spi.PropertySource | 19 -
...org.apache.tamaya.spi.PropertySourceProvider | 19 -
.../test/resources/javaconfiguration.properties | 22 +
.../test/resources/overrideOrdinal.properties | 25 ++
.../src/test/resources/testfile.properties | 22 +
.../builder/src/test/resources/x34.properties | 19 +
...org.apache.tamaya.builder.spi.ServiceContext | 19 +
.../org.apache.tamaya.spi.ServiceContext | 19 -
....apache.tamaya.builder.spi.PropertyConverter | 31 ++
...a.builder.spi.PropertyValueCombinationPolicy | 19 +
.../org.apache.tamaya.spi.PropertyConverter | 31 --
...he.tamaya.spi.PropertyValueCombinationPolicy | 19 -
.../events/ChangeableGlobalPropertySource.java | 1 -
...org.apache.tamaya.builder.spi.PropertySource | 19 +
...he.tamaya.builder.spi.PropertySourceProvider | 19 +
.../org.apache.tamaya.spi.PropertySource | 19 -
...org.apache.tamaya.spi.PropertySourceProvider | 19 -
...org.apache.tamaya.builder.spi.PropertyFilter | 19 +
.../org.apache.tamaya.spi.PropertyFilter | 19 -
.../functions/PropertySourceFunctionsTest.java | 1 -
.../tamaya/inject/TestPropertySource.java | 4 +-
.../internal/DefaultDynamicValueTest.java | 8 +-
...org.apache.tamaya.builder.spi.PropertySource | 19 +
.../org.apache.tamaya.spi.PropertySource | 19 -
...org.apache.tamaya.builder.spi.ServiceContext | 19 +
.../org.apache.tamaya.spi.ServiceContext | 19 -
...org.apache.tamaya.builder.spi.PropertySource | 19 +
.../org.apache.tamaya.spi.PropertySource | 19 -
...org.apache.tamaya.builder.spi.PropertySource | 19 +
.../org.apache.tamaya.spi.PropertySource | 19 -
.../tamaya/management/ManagedConfigMBean.java | 2 +-
...org.apache.tamaya.builder.spi.PropertyFilter | 19 +
.../org.apache.tamaya.spi.PropertyFilter | 19 -
.../mutableconfig/ChangePropagationPolicy.java | 2 -
.../mutableconfig/MutableConfiguration.java | 1 -
.../spi/MutablePropertySource.java | 1 -
...org.apache.tamaya.builder.spi.PropertySource | 20 +
.../org.apache.tamaya.spi.PropertySource | 20 -
...org.apache.tamaya.builder.spi.PropertyFilter | 19 +
.../org.apache.tamaya.spi.PropertyFilter | 19 -
...org.apache.tamaya.builder.spi.PropertySource | 19 +
.../org.apache.tamaya.spi.PropertySource | 19 -
.../org/apache/tamaya/json/YAMLFormatTest.java | 2 -
.../tamaya/json/YAMLPropertySourceTest.java | 1 -
....apache.tamaya.builder.spi.PropertyConverter | 21 +
.../org.apache.tamaya.spi.PropertyConverter | 21 -
.../tamaya/jodatime/DateTimeConverterTest.java | 4 -
.../jodatime/DateTimeZoneConverterTest.java | 1 -
.../tamaya/jodatime/PeriodConverterTest.java | 2 -
...he.tamaya.builder.spi.PropertySourceProvider | 20 +
...org.apache.tamaya.spi.PropertySourceProvider | 20 -
.../spi/BaseStagedPropertySourceProvider.java | 4 +-
.../spi/StagedConfigPropertiesProvider.java | 2 +-
....tamaya.builder.spi.ConfigurationProviderSpi | 19 +
...g.apache.tamaya.spi.ConfigurationProviderSpi | 19 -
src/site/asciidoc/API.adoc | 2 +-
src/site/asciidoc/Core.adoc | 4 +-
303 files changed, 9322 insertions(+), 10173 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
index 199956f..413f728 100644
--- a/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
+++ b/attic/java8/api/src/test/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.spi.TestServiceContext
\ No newline at end of file
+TestServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/api/src/test/resources/ServiceContextWithOrdinal
----------------------------------------------------------------------
diff --git a/attic/java8/api/src/test/resources/ServiceContextWithOrdinal b/attic/java8/api/src/test/resources/ServiceContextWithOrdinal
index 4112c18..b346946 100644
--- a/attic/java8/api/src/test/resources/ServiceContextWithOrdinal
+++ b/attic/java8/api/src/test/resources/ServiceContextWithOrdinal
@@ -19,7 +19,7 @@
# if we have more than one
# this one is without overriding ordinal so it shall take the default
-org.apache.tamaya.spi.TestServiceContext
+TestServiceContext
# this one has a higher ordinal (100)
org.apache.tamaya.spi.ServiceContextManagerTest$ServiceContextWithOrdinal
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
index 4efa42e..adf933a 100644
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
+++ b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationContextBuilder
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.core.internal.DefaultConfigurationContextBuilder
\ No newline at end of file
+DefaultConfigurationContextBuilder
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
index 7c0e249..8b2b16b 100644
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
+++ b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.core.internal.DefaultConfigurationProvider
+DefaultConfigurationProvider
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
index fff680a..bd82a39 100644
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
+++ b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
@@ -16,22 +16,22 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.core.internal.converters.BooleanConverter
-org.apache.tamaya.core.internal.converters.ByteConverter
-org.apache.tamaya.core.internal.converters.CharConverter
-org.apache.tamaya.core.internal.converters.ClassConverter
-org.apache.tamaya.core.internal.converters.DoubleConverter
-org.apache.tamaya.core.internal.converters.FloatConverter
-org.apache.tamaya.core.internal.converters.IntegerConverter
-org.apache.tamaya.core.internal.converters.LongConverter
-org.apache.tamaya.core.internal.converters.ShortConverter
-org.apache.tamaya.core.internal.converters.BigDecimalConverter
-org.apache.tamaya.core.internal.converters.BigIntegerConverter
-org.apache.tamaya.core.internal.converters.CurrencyConverter
+BooleanConverter
+ByteConverter
+CharConverter
+ClassConverter
+DoubleConverter
+FloatConverter
+IntegerConverter
+LongConverter
+ShortConverter
+BigDecimalConverter
+BigIntegerConverter
+CurrencyConverter
org.apache.tamaya.core.internal.converters.LocalDateConverter
org.apache.tamaya.core.internal.converters.LocalDateTimeConverter
org.apache.tamaya.core.internal.converters.LocalTimeConverter
org.apache.tamaya.core.internal.converters.ZoneIdConverter
-org.apache.tamaya.core.internal.converters.NumberConverter
-org.apache.tamaya.core.internal.converters.URIConverter
-org.apache.tamaya.core.internal.converters.URLConverter
+NumberConverter
+URIConverter
+URLConverter
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
index 1b8f8c0..1820079 100644
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
@@ -16,5 +16,5 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.core.propertysource.EnvironmentPropertySource
-org.apache.tamaya.core.propertysource.SystemPropertySource
\ No newline at end of file
+EnvironmentPropertySource
+SystemPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
index 4535a09..bc9e656 100644
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.core.provider.JavaConfigurationProvider
\ No newline at end of file
+JavaConfigurationProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
index 2721eff..dfc2994 100644
--- a/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
+++ b/attic/java8/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.ServiceContext
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-org.apache.tamaya.core.internal.DefaultServiceContext
\ No newline at end of file
+DefaultServiceContext
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
index 72dd3c3..e7f8ea5 100644
--- a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
@@ -17,6 +17,6 @@
# under the License.
#
org.apache.tamaya.core.testdata.TestPropertyDefaultSource
-org.apache.tamaya.core.propertysource.SystemPropertySource
-org.apache.tamaya.core.propertysource.EnvironmentPropertySource
+SystemPropertySource
+EnvironmentPropertySource
org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
index afc8910..b493db0 100644
--- a/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ b/attic/java8/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
@@ -17,4 +17,4 @@
# under the License.
#
org.apache.tamaya.core.testdata.TestPropertySourceProvider
-org.apache.tamaya.core.provider.JavaConfigurationProvider
\ No newline at end of file
+JavaConfigurationProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
----------------------------------------------------------------------
diff --git a/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml b/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
index 14533e9..af5497a 100644
--- a/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
+++ b/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
@@ -71,7 +71,7 @@ under the License.
<!-- False positive returnin null for Boolean is required by the implemented interface. -->
<Match>
- <Class name="org.apache.tamaya.core.internal.converters.BooleanConverter"/>
+ <Class name="BooleanConverter"/>
</Match>
<!-- False positive: example class used for config demo. -->
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/pom.xml
----------------------------------------------------------------------
diff --git a/code/api/pom.xml b/code/api/pom.xml
index 23d75cd..88686d6 100644
--- a/code/api/pom.xml
+++ b/code/api/pom.xml
@@ -63,9 +63,9 @@ under the License.
<!--osgi.extender;-->
<!--filter:="(osgi.extender=osgi.serviceloader.processor)",-->
<!--osgi.serviceloader;-->
- <!--filter:="(org.apache.tamaya.spi.ServiceContext)";-->
+ <!--filter:="(ServiceContext)";-->
<!--cardinality:=multiple;-->
- <!--filter:="(org.apache.tamaya.spi.ConfigurationProviderSpi)";-->
+ <!--filter:="(ConfigurationProviderSpi)";-->
<!--cardinality:=multiple-->
<!--</Require-Capability>-->
</instructions>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java b/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java
deleted file mode 100644
index 2295b07..0000000
--- a/code/api/src/main/java/org/apache/tamaya/ConfigOperator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-/**
- * Models a function that maps a given {@link org.apache.tamaya.Configuration} to another {@link org.apache.tamaya.Configuration}. This can be used
- * to modell additional functionality and applying it to a given {@link org.apache.tamaya.Configuration} instance by calling
- * the {@link org.apache.tamaya.Configuration#with(org.apache.tamaya.ConfigOperator)} method.
- */
-public interface ConfigOperator {
-
- /**
- * Creates a new {@link org.apache.tamaya.Configuration} based on the given Configuration. Operators basically acts similar to
- * decorators, whereas operated instances may have non compatible behaviour, e.g. by applying security constraints
- * or view restrictions.
- *
- * @param config the input configuration, not null.
- * @return the operated configuration, never null.
- */
- Configuration operate(Configuration config);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java b/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java
deleted file mode 100644
index 9ef0179..0000000
--- a/code/api/src/main/java/org/apache/tamaya/ConfigQuery.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-/**
- * Models a function that maps a given {@link Configuration} to something else. This can be used
- * to model additional functionality and applying it to a given {@link Configuration} instance by
- * calling the {@link Configuration#query(ConfigQuery)} method.
- */
-public interface ConfigQuery<T> {
-
- /**
- * Creates a result based on the given Configuration. Queries basically acts similar to
- * operators, whereas they returns any kind of result.
- *
- * @param config the input configuration, not null.
- * @return the query result.
- */
- T query(Configuration config);
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/Configuration.java b/code/api/src/main/java/org/apache/tamaya/Configuration.java
index 0af0cf4..a0e83b6 100644
--- a/code/api/src/main/java/org/apache/tamaya/Configuration.java
+++ b/code/api/src/main/java/org/apache/tamaya/Configuration.java
@@ -18,21 +18,12 @@
*/
package org.apache.tamaya;
-import org.apache.tamaya.spi.ConfigurationContext;
-
-import java.util.Collections;
import java.util.Map;
/**
- * <p>A configuration models a aggregated set current properties, identified by
- * a unique key, but adds higher level access functions to
- * a {@link org.apache.tamaya.spi.PropertySource}. Hereby in most
- * cases a configuration is a wrapper around a composite
- * {@link org.apache.tamaya.spi.PropertySource} instance, which may combine
- * multiple child config in well defined tree like structure,
- * where nodes define logically the rules current priority, filtering,
- * combination and overriding.
+ * <p>A configuration models a aggregated set of current properties, identified by
+ * a unique key.
* </p>
* <h3>Implementation Requirements</h3>
* Implementations current this interface must be
@@ -66,94 +57,9 @@ public interface Configuration {
String getOrDefault(String key, String defaultValue);
/**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @param <T> the type of the class modeled by the type parameter
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @param type The target type required, not null.
- * @param defaultValue value to be used, if no value is present.
- * @return the property value, never null..
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- <T> T getOrDefault(String key, Class<T> type, T defaultValue);
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @param <T> the type of the class modeled by the type parameter
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @param type The target type required, not {@code null}.
- * @return the property value, never {@code null}.
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- <T> T get(String key, Class<T> type);
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @param <T> the type of the type literal
- * @param key the property's absolute, or relative path, e.g. @code
- * a/b/c/d.myProperty}.
- * @param type The target type required, not null.
- * @return the property value, never null.
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- <T> T get(String key, TypeLiteral<T> type);
-
- /**
- * Get the property keys as type T. This will implicitly require a corresponding {@link
- * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
- * fromMap the given String keys.
- *
- * @param <T> the type of the type literal
- * @param key the property's absolute, or relative path, e.g.
- * {@code a/b/c/d.myProperty}.
- * @param type The target type required, not null.
- * @param defaultValue default value to be used, if no value is present.
- * @return the property value, never null.
- * @throws ConfigException if the keys could not be converted to the required target type.
- */
- <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue);
-
- /**
* Access all currently known configuration properties as a full {@code Map<String,String>}.
- * Be aware that entries from non scannable parts of the registered {@link org.apache.tamaya.spi.PropertySource}
- * instances may not be contained in the result, but nevertheless be accessible calling one of the
- * {@code get(...)} methods.
* @return all currently known configuration properties.
*/
Map<String,String> getProperties();
- /**
- * Extension point for adjusting configuration.
- *
- * @param operator A configuration operator, e.g. a filter, or an adjuster
- * combining configurations.
- * @return the new adjusted configuration returned by the {@code operator}, never {@code null}.
- */
- Configuration with(ConfigOperator operator);
-
- /**
- * Query a configuration.
- *
- * @param <T> the type of the configuration.
- * @param query the query, never {@code null}.
- * @return the result returned by the {@code query}.
- */
- <T> T query(ConfigQuery<T> query);
-
- /**
- * Access a configuration\u015d context.
- * @return the configuration context, never null.
- */
- ConfigurationContext getContext();
-
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
index 5b9c3f1..af4c3e7 100644
--- a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
+++ b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
@@ -18,29 +18,43 @@
*/
package org.apache.tamaya;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spi.ConfigurationProviderSpi;
-import org.apache.tamaya.spi.ServiceContextManager;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
+import java.util.ServiceLoader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* Static access to the {@link Configuration} for the very application.
*/
-public final class ConfigurationProvider {
+public abstract class ConfigurationProvider {
+
+ private static final Logger LOG = Logger.getLogger("ConfigurationProvider");
+
+ private static final Configuration INSTANCE = loadConfiguration();
- private static final ConfigurationProviderSpi PROVIDER_SPI = loadSpi();
- private static ConfigurationProviderSpi loadSpi() {
- ConfigurationProviderSpi spi = ServiceContextManager.getServiceContext()
- .getService(ConfigurationProviderSpi.class);
- if(spi==null){
- throw new IllegalStateException("ConfigurationProviderSpi not available.");
+ private static Configuration loadConfiguration() {
+ for(Configuration config: ServiceLoader.load(Configuration.class)){
+ // Sort and use priority, or delegate?
+ return config;
+ }
+ String configClass = System.getProperty("configuration");
+ if(configClass!=null){
+ try{
+ return (Configuration)Class.forName(configClass).newInstance();
+ }catch(Exception e){
+ throw new ConfigException("Error loading configuration...", e);
+ }finally{
+ showBanner();
+ }
}
+ throw new ConfigException("No configuration available.");
+ }
+
+ private static void showBanner(){
BufferedReader reader = null;
try{
URL url = ConfigurationProvider.class.getResource("/tamaya-banner.txt");
@@ -67,60 +81,19 @@ public final class ConfigurationProvider {
}
}
}
- return spi;
}
- private ConfigurationProvider() {
+ protected ConfigurationProvider() {
// just to prevent initialisation
}
/**
* Access the current configuration.
- *
- * @return the corresponding Configuration instance, never null.
- */
- public static Configuration getConfiguration() {
- return PROVIDER_SPI.getConfiguration();
- }
-
- /**
- * Get access to the current ConfigurationContext.
- *
- * @return the current ConfigurationContext, never null.
- * @deprecated Use {@link Configuration#getContext()} instead of.
+ * @return the configuration.
*/
- @Deprecated
- public static ConfigurationContext getConfigurationContext() {
- return PROVIDER_SPI.getConfigurationContext();
+ public static Configuration getConfiguration(){
+ return INSTANCE;
}
- /**
- * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new
- * instance. This can be used to update the context with a new one, e.g. because some of the configuration
- * data has changed and should be updated. It is the responsibility of the ConfigurationProvider to trigger
- * corresponding update events for the current {@link org.apache.tamaya.Configuration}, so observing
- * listeners can do whatever is appropriate to react to any given configuration changes.
- *
- * @param context the new ConfigurationContext to be applied.
- * @throws java.lang.UnsupportedOperationException if the current provider is read-only and does not support
- * applying a new ConfigurationContext.
- */
- public static void setConfigurationContext(ConfigurationContext context) {
- PROVIDER_SPI.setConfigurationContext(context);
- }
-
- /**
- * Create a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance. This method creates
- * a new builder instance that is not related to any concrete {@link org.apache.tamaya.spi.ConfigurationContext}.
- * You can use {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} to change the
- * current configuration context.
- *
- * @return a new, empty {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
- * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
- * @see org.apache.tamaya.spi.ConfigurationContext
- */
- public static ConfigurationContextBuilder getConfigurationContextBuilder() {
- return PROVIDER_SPI.getConfigurationContextBuilder();
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java b/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java
deleted file mode 100644
index 729f2b6..0000000
--- a/code/api/src/main/java/org/apache/tamaya/TypeLiteral.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya;
-
-import java.io.Serializable;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-
-/**
- * <p>Class for instantiation of objects that represent parameterized types
- * with current parameters.</p>
- *
- * <p>An object that represents a parameterized type may be obtained by
- * subclassing <tt>TypeLiteral</tt>.</p>
- *
- * <pre>
- * TypeLiteral<List<Integer>> stringListType = new TypeLiteral<List<Integer>>() {};
- * </pre>
- *
- * @param <T> the type, including all type parameters
- */
-public class TypeLiteral<T> implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
- /** The current defined type. */
- private final Type definedType;
-
- /**
- * Constructor.
- * @param definedType the defined type.
- */
- public TypeLiteral(Type definedType) {
- this.definedType = definedType;
- }
-
- /**
- * Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
- */
- public TypeLiteral() {
- this.definedType = getDefinedType(this.getClass());
- }
-
- /**
- * Creates a new TypeLiteral based on a given type.
- *
- * @param type the type , not null.
- * @param <R> the literal generic type.
- * @return the corresponding TypeLiteral, never null.
- */
- public static <R> TypeLiteral<R> of(Type type) {
- return new TypeLiteral<>(type);
- }
-
- /**
- * Checks the current implemented generic interfaces and evaluates the given single type parameter.
- *
- * @param clazz the class to check, not null.
- * @param interfaceType the interface type to be checked, not null.
- * @return the generic type parameter, or null, if it cannot be evaluated.
- */
- public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
- for (Type type : clazz.getGenericInterfaces()) {
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- if(parameterizedType.getRawType().equals(interfaceType)){
- return parameterizedType.getActualTypeArguments();
- }
- }
- }
- return EMPTY_TYPE_ARRAY;
- }
-
- /**
- * Method that checks the class's type for a generic interface implementation type.
- *
- * @param type the type, not null.
- * @return the generic type parameter of the given single type generic interfaceType, or null.
- */
- public static Type[] getTypeParameters(Type type) {
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- return parameterizedType.getActualTypeArguments();
- }
- return EMPTY_TYPE_ARRAY;
- }
-
- public final Type getType() {
- return definedType;
- }
-
- /**
- * Returns basic raw Java type.
- *
- * @return the actual type represented by this object
- */
- public final Class<T> getRawType() {
- Class<T> rawType;
-
- if (this.definedType instanceof Class) {
- rawType = (Class<T>) this.definedType;
- } else if (this.definedType instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) this.definedType;
- rawType = (Class<T>) pt.getRawType();
-
- } else if (this.definedType instanceof GenericArrayType) {
- rawType = (Class<T>) Object[].class;
- } else {
- throw new RuntimeException("Illegal type for the Type Literal Class");
- }
-
- return rawType;
- }
-
-
- protected Type getDefinedType(Class<?> clazz) {
- Type type;
-
- if (clazz == null) {
- throw new RuntimeException("Class parameter clazz can not be null");
- }
-
- Type superClazz = clazz.getGenericSuperclass();
-
- if (superClazz instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) superClazz;
- Type[] actualArgs = pt.getActualTypeArguments();
-
- if (actualArgs.length == 1) {
- type = actualArgs[0];
-
- } else {
- throw new RuntimeException("More than one parametric type");
- }
-
- } else if (superClazz.equals(Object.class)) {
- throw new RuntimeException("Super class must be parametrized type");
- } else {
- type = getDefinedType((Class<?>) superClazz);
- }
-
- return type;
- }
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((definedType == null) ? 0 : definedType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TypeLiteral<?> other = (TypeLiteral<?>) obj;
- if (definedType == null) {
- if (other.definedType != null) {
- return false;
- }
- } else if (!definedType.equals(other.definedType)) {
- return false;
- }
- return true;
- }
-
-
- @Override
- public String toString() {
- return "TypeLiteral{" +
- "type=" + definedType +
- '}';
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
deleted file mode 100644
index d61bde7..0000000
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-
-import org.apache.tamaya.TypeLiteral;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Central SPI for programmatically dealing with the setup of the configuration system.
- * This includes adding and enlisting {@link org.apache.tamaya.spi.PropertySource}s,
- * managing {@link PropertyConverter}s, ConfigFilters, etc.
- */
-public interface ConfigurationContext {
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesToAdd the PropertySources to add
- */
- void addPropertySources(PropertySource... propertySourcesToAdd);
-
- /**
- * This method returns the current list of registered PropertySources ordered via their ordinal.
- * PropertySources with a lower ordinal come last. The PropertySource with the
- * highest ordinal comes first.
- * If two PropertySources have the same ordinal number they will get sorted
- * using their class name just to ensure the user at least gets the same ordering
- * after a JVM restart, hereby names before are added last.
- * PropertySources are loaded when this method is called the first time, which basically is
- * when the first time configuration is accessed.
- *
- * @return a sorted list of registered PropertySources. The returned list need not be modifiable
- */
- List<PropertySource> getPropertySources();
-
-
- /**
- * This method can be used for programmatically adding {@link PropertyConverter}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param <T> the type of the type literal
- * @param typeToConvert the type which the converter is for
- * @param propertyConverter the PropertyConverters to add for this type
- */
- <T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter);
-
- /**
- * <p>
- * This method returns the Map of registered PropertyConverters
- * per type.
- * The List for each type is ordered via their {@link javax.annotation.Priority} and
- * cladd name.
- * </p>
- *
- * <p>A simplified scenario could be like:</p>
- * <pre>
- * {
- * Date.class -> {StandardDateConverter, TimezoneDateConverter, MyCustomDateConverter }
- * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
- * Integer.class -> {DynamicDefaultConverter}
- * }
- * </pre>
- *
- * @return map with sorted list of registered PropertySources per type.
- */
- Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters();
-
- /**
- * <p>
- * This method returns the registered PropertyConverters for a given type.
- * The List for each type is ordered via their {@link javax.annotation.Priority}.
- * </p>
- *
- * <p>
- * PropertyConverters with a higher Priority come first. The PropertyConverter with the
- * lowest Priority comes last.
- * If two PropertyConverter have the same ordinal number they will get sorted
- * using their class name just to ensure the user at least gets the same ordering
- * after a JVM restart.
- * </p>
- *
- * <p>
- * Additionally if a PropertyProvider is accessed, which is not registered the implementation
- * should try to figure out, if there could be a default implementation as follows:</p>
- * <ol>
- * <li>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
- * instanceOf(String), fomr(String)}</li>
- * <li>Look for a matching constructor: {@code T(String)}.</li>
- * </ol>
- *
- * <p>
- * If a correspoding factory method or constructor could be found, a corresponding
- * PropertyConverter should be created and registered automatically for the given
- * type.
- * </p>
- *
- * <p> The scenario could be like:</p>
- *
- * <pre>
- * {
- * Date.class -> {MyCustomDateConverter,StandardDateConverter, TimezoneDateConverter}
- * Boolean.class -> {StandardBooleanConverter, FrenchBooleanConverter}
- * Integer.class -> {DynamicDefaultConverter}
- * }
- * </pre>
- *
- * <p>
- * The converters returned for a type should be used as a chain, whereas the result of the
- * first converter that is able to convert the configured value, is taken as the chain's result.
- * No more converters are called after a converter has successfully converted the input into
- * the required target type.
- * </p>
- *
- * @param <T> the type of the type literal
- * @param type type of the desired converter
- * @return a sorted list of registered PropertySources per type.
- */
- <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> type);
-
- /**
- * Access the current PropertyFilter instances.
- * @return the list of registered PropertyFilters, never null.
- */
- List<PropertyFilter> getPropertyFilters();
-
- /**
- * Access the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used to evaluate the final
- * property values.
- * @return the {@link org.apache.tamaya.spi.PropertyValueCombinationPolicy} used, never null.
- */
- PropertyValueCombinationPolicy getPropertyValueCombinationPolicy();
-
- /**
- * Creates a {@link ConfigurationContextBuilder} preinitialized with the data from this instance.
- * @return a new builder instance, never null.
- */
- ConfigurationContextBuilder toBuilder();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
deleted file mode 100644
index 6416959..0000000
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import org.apache.tamaya.TypeLiteral;
-
-import java.util.Collection;
-
-/**
- * A builder for creating new or adapting instances of {@link ConfigurationContext}.
- * Builders can be obtained in exactly two ways:
- * <ol>
- * <li>By accessing a preinitialized builder from an existing {@link ConfigurationContext},
- * by calling {@link org.apache.tamaya.spi.ConfigurationContext#toBuilder()}.</li>
- * <li>By accessing an empty builder instance from
- * {@link org.apache.tamaya.ConfigurationProvider#getConfigurationContextBuilder()}.</li>
- * </ol>
- * After all changes are applied to a builder a new {@link ConfigurationContext} instance can
- * be created and can be applied by calling
- * {@link org.apache.tamaya.ConfigurationProvider#setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)}.
- *
- */
-
-/* @todo This is some Javadoc which is outdated. I am not sure if I can deleted it. The author
- * should take care. Oliver B. Fischer, 2015-12-23
- * Since this method can
- * throw an UnsupportedOperationException, you should check before if changing the current ConfigurationContext
- * programmatically is supported by calling
- * {@link org.apache.tamaya.ConfigurationProvider#is}.
- */
-public interface ConfigurationContextBuilder {
-
- /**
- * Init this builder instance with the given {@link ConfigurationContext} instance. This
- * method will replace any existing data in the current builder with the data contained in the given
- * {@link ConfigurationContext}.
- *
- * @param context the {@link ConfigurationContext} instance to be used, not null.
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder setContext(ConfigurationContext context);
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesToAdd the PropertySources to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertySources(PropertySource... propertySourcesToAdd);
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesToAdd the PropertySources to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySourcesToAdd);
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesNames the PropertySource names of the sources to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertySources(String... propertySourcesNames);
-
- /**
- * This method can be used for programmatically adding {@link PropertySource}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param propertySourcesNames the PropertySource names of the sources to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertySources(Collection<String> propertySourcesNames);
-
- /**
- * Adds the given PropertyFilter instances.
- *
- * @param filters the filters to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters);
-
- /**
- * Adds the given PropertyFilter instances.
- *
- * @param filters the filters to add
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters);
-
- /**
- * Removes the given PropertyFilter instances.
- *
- * @param filters the filters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters);
-
- /**
- * Removes the given PropertyFilter instances.
- *
- * @param filters the filters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters);
-
- /**
- * This method can be used for programmatically adding {@link PropertyConverter}s.
- * It is not needed for normal 'usage' by end users, but only for Extension Developers!
- *
- * @param <T> the type of the type literal
- * @param typeToConvert the type for which the converter is for
- * @param propertyConverter the PropertyConverters to add for this type
- * @return this builder, for chaining, never null.
- */
- <T> ConfigurationContextBuilder addPropertyConverter(TypeLiteral<T> typeToConvert,
- PropertyConverter<T> propertyConverter);
-
- /**
- * Removes the given PropertyConverter instances.
- *
- * @param typeToConvert the type which the converter is for
- * @param converters the converters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
- PropertyConverter<?>... converters);
-
- /**
- * Removes the given PropertyConverter instances.
- *
- * @param typeToConvert the type which the converter is for
- * @param converters the converters to remove
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
- Collection<PropertyConverter<?>> converters);
-
- /**
- * Sets the {@link PropertyValueCombinationPolicy} used to evaluate the final
- * property values.
- *
- * @param policy the {@link PropertyValueCombinationPolicy} used, not null
- * @return this builder, for chaining, never null.
- */
- ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy);
-
- /**
- * Builds a {@link ConfigurationContext} based on the data set.
- * @return final context with the current builder's properties.
- */
- ConfigurationContext build();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
deleted file mode 100644
index d179d1e..0000000
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import org.apache.tamaya.Configuration;
-
-/**
- * SPI that must be implemented to provide the component that manages all {@link org.apache.tamaya.Configuration}
- * instances in a system. In SE this may be a true singleton containing exact one {@link org.apache.tamaya.Configuration}
- * instance, whereas in Java EE and other more complex environments instances may be returned depending the current
- * runtime context.
- */
-public interface ConfigurationProviderSpi {
-
- /**
- * Access the current {@link org.apache.tamaya.Configuration}.
- *
- * @return the current {@link org.apache.tamaya.Configuration} instance, never null.
- */
- Configuration getConfiguration();
-
- /**
- * Get access to the current {@link ConfigurationContext}.
- *
- * @return the current {@link ConfigurationContext}, never null.
- * @deprecated Will be removed in favour of {@link Configuration#getContext()}.
- */
- @Deprecated
- ConfigurationContext getConfigurationContext();
-
- /**
- * This method allows to replace the current {@link org.apache.tamaya.spi.ConfigurationContext} with a new
- * instance. This can be used to update the context with a new one, e.g. because some of the configuration
- * data has changed and must be updated. It is the responsibility of the ConfigurationProvider to trigger
- * corresponding update event for the current {@link org.apache.tamaya.spi.ConfigurationContext} or
- * {@link org.apache.tamaya.Configuration}.
- *
- * @param context the new ConfigurationContext to be applied.
- * @throws java.lang.UnsupportedOperationException if the current provider is read-only.
- */
- void setConfigurationContext(ConfigurationContext context);
-
- /**
- * Method that allows to determine if a new {@link org.apache.tamaya.spi.ConfigurationContext} can be applied
- * programmatically.
- *
- * @return true, if {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} is supported
- * by the current implementation.
- * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
- */
- boolean isConfigurationContextSettable();
-
- /**
- * Creates a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance.
- *
- * @return a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
- */
- ConfigurationContextBuilder getConfigurationContextBuilder();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java b/code/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java
deleted file mode 100644
index 5b4835a..0000000
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.TypeLiteral;
-
-import java.lang.reflect.AnnotatedElement;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * A conversion context containing all the required values for implementing conversion. Use the included #Builder
- * for creating new instances of. This class is thread-safe to use. Adding supported formats is synchronized.
- * @see PropertyConverter
- */
-public class ConversionContext {
-
- private final Configuration configuration;
- private final String key;
- private final TypeLiteral<?> targetType;
- private final AnnotatedElement annotatedElement;
- private final List<String> supportedFormats = new ArrayList<>();
- private final ConfigurationContext configurationContext;
-
- /**
- * Private constructor used from builder.
- * @param builder the builder, not null.
- */
- protected ConversionContext(Builder builder){
- this.key = builder.key;
- this.annotatedElement = builder.annotatedElement;
- this.targetType = builder.targetType;
- this.supportedFormats.addAll(builder.supportedFormats);
- this.configuration = builder.configuration;
- this.configurationContext = builder.configurationContext;
- }
-
- /**
- * Get the key accessed. This information is very useful to evaluate additional metadata needed to determine/
- * control further aspects of the conversion.
- * @return the key. This may be null in case where a default value has to be converted and no unique underlying
- * key/value configuration is present.
- */
- public String getKey(){
- return key;
- }
-
- /**
- * Get the target type required.
- * @return the target type required.
- */
- public TypeLiteral<?> getTargetType(){
- return targetType;
- }
-
- /**
- * Get the annotated element, if conversion is performed using injection mechanisms.
- * @return the annotated element, or null.
- */
- public AnnotatedElement getAnnotatedElement(){
- return annotatedElement;
- }
-
- /**
- * Get the configuration, which is targeted.
- * @return the configuration instance, or null.
- */
- public Configuration getConfiguration(){
- return configuration;
- }
-
- /**
- * Allows to add information on the supported/tried formats, which can be shown to the user, especially when
- * conversion failed. Adding of formats is synchronized, all formats are added in order to the overall list.
- * This means formats should be passed in order of precedence.
- * @param converterType the converter, which implements the formats provided.
- * @param formatDescriptors the format descriptions in a human readable form, e.g. as regular expressions.
- */
- public void addSupportedFormats(Class<? extends PropertyConverter> converterType, String... formatDescriptors){
- synchronized (supportedFormats){
- for(String format: formatDescriptors) {
- supportedFormats.add(format + " (" + converterType.getSimpleName() + ")");
- }
- }
- }
-
- /**
- * Get the supported/tried formats in precedence order. The contents of this method depends on the
- * {@link PropertyConverter} instances involved in a conversion.
- * @return the supported/tried formats, never null.
- */
- public List<String> getSupportedFormats(){
- synchronized (supportedFormats){
- return new ArrayList<>(supportedFormats);
- }
- }
-
- @Override
- public String toString() {
- return "ConversionContext{" +
- "configuration=" + configuration +
- ", key='" + key + '\'' +
- ", targetType=" + targetType +
- ", annotatedElement=" + annotatedElement +
- ", supportedFormats=" + supportedFormats +
- '}';
- }
-
- public ConfigurationContext getConfigurationContext() {
- return configurationContext;
- }
-
- /**
- * Builder to create new instances of {@link ConversionContext}.
- */
- public static final class Builder{
- /** The backing configuration. */
- private Configuration configuration;
- /** The configuration context. */
- private ConfigurationContext configurationContext;
- /** The accessed key, or null. */
- private String key;
- /** The target type. */
- private final TypeLiteral<?> targetType;
- /** The injection target (only set with injection used). */
- private AnnotatedElement annotatedElement;
- /** The ordered list of formats tried. */
- private final Set<String> supportedFormats = new HashSet<>();
-
- /**
- * Creates a new Builder instance.
- * @param targetType the target type
- */
- public Builder(TypeLiteral<?> targetType) {
- this(null, null, null, targetType);
- }
-
- /**
- * Creates a new Builder instance.
- * @param key the requested key, may be null.
- * @param targetType the target type
- */
- public Builder(String key, TypeLiteral<?> targetType) {
- this(null, null, key, targetType);
- }
-
- /**
- * Creates a new Builder instance.
- * @param configuration the configuration, not null.
- * @param configurationContext configuration context, not null.
- * @param key the requested key, may be null.
- * @param targetType the target type
- */
- public Builder(Configuration configuration, ConfigurationContext configurationContext, String key, TypeLiteral<?> targetType){
- this.key = key;
- this.configuration = configuration;
- this.configurationContext = configurationContext;
- this.targetType = Objects.requireNonNull(targetType);
- }
-
- /**
- * Sets the key.
- * @param key the key, not null.
- * @return the builder instance, for chaining
- */
- public Builder setKey(String key){
- this.key = Objects.requireNonNull(key);
- return this;
- }
-
- /**
- * Sets the configuration.
- * @param configuration the configuration, not null
- * @return the builder instance, for chaining
- */
- public Builder setConfiguration(Configuration configuration){
- this.configuration = Objects.requireNonNull(configuration);
- return this;
- }
-
- /**
- * Sets the configuration.
- * @param configurationContext the configuration, not null
- * @return the builder instance, for chaining
- */
- public Builder setConfigurationContext(ConfigurationContext configurationContext){
- this.configurationContext = Objects.requireNonNull(configurationContext);
- return this;
- }
-
- /**
- * Sets the annotated element, when configuration is injected.
- * @param annotatedElement the annotated element, not null
- * @return the builder instance, for chaining
- */
- public Builder setAnnotatedElement(AnnotatedElement annotatedElement){
- this.annotatedElement = Objects.requireNonNull(annotatedElement);
- return this;
- }
-
- /**
- * Add the formats provided by a {@link PropertyConverter}. This method should be called by each converter
- * performing/trying conversion, so the user can be given feedback on the supported formats on failure.
- * @param converterType the converter type, not null.
- * @param formatDescriptors the formats supported in a human readable form, e.g. as regular expressions.
- * @return the builder instance, for chaining
- */
- public Builder addSupportedFormats(Class<? extends PropertyConverter> converterType, String... formatDescriptors){
- for(String format: formatDescriptors) {
- supportedFormats.add(format + " (" + converterType.getSimpleName() + ")");
- }
- return this;
- }
-
- /**
- * Builds a new context instance.
- * @return a new context, never null.
- */
- public ConversionContext build(){
- return new ConversionContext(this);
- }
-
- @Override
- public String toString() {
- return "Builder{" +
- "configuration=" + configuration +
- "context=" + configurationContext +
- ", key='" + key + '\'' +
- ", targetType=" + targetType +
- ", annotatedElement=" + annotatedElement +
- ", supportedFormats=" + supportedFormats +
- '}';
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/spi/Experimental.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/Experimental.java b/code/api/src/main/java/org/apache/tamaya/spi/Experimental.java
deleted file mode 100644
index 9831820..0000000
--- a/code/api/src/main/java/org/apache/tamaya/spi/Experimental.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import java.lang.annotation.*;
-
-/**
- * This is a simple annotation for flaging out functionality or features the Tamaya team is not sure if it is already
- * stabilized, so use it with some caution.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Inherited
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD,
- ElementType.TYPE})
-public @interface Experimental {
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java b/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java
deleted file mode 100644
index 3c675c8..0000000
--- a/code/api/src/main/java/org/apache/tamaya/spi/FilterContext.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spi;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * A filter context containing all the required values for implementing filtering.
- *
- * @see PropertyFilter
- */
-public class FilterContext {
- /** The key. */
- private final String key;
- @Experimental
- private Map<String, String> configEntries = new HashMap();
- @Experimental
- private boolean singlePropertyScoped;
-
-
- /**
- * Creates a new FilterContext.
- * @param key the key under evaluation, not null.
- * @param singlePropertyScope true, if the filtering is done only for one single property accessed explcitily.
- * @param configEntries the raw configuration data available in the current evaluation context, not null.
- */
- public FilterContext(String key, Map<String,String> configEntries, boolean singlePropertyScope) {
- this.singlePropertyScoped = singlePropertyScope;
- this.key = Objects.requireNonNull(key);
- this.configEntries.putAll(configEntries);
- this.configEntries = Collections.unmodifiableMap(this.configEntries);
- }
-
- /**
- * Get the key accessed. This information is very useful to evaluate additional metadata needed to determine/
- * control further aspects of the conversion.
- *
- * @return the key. This may be null in case where a default value has to be converted and no unique underlying
- * key/value configuration is present.
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Method that determines if filtering is done for a single property accessed, or as part of call to
- * {@code getProperties()}.
- * @return true, if its scoped to a single property accessed.
- */
- @Experimental
- public boolean isSinglePropertyScoped(){
- return singlePropertyScoped;
- }
-
- /**
- * This map contains the following keys:
- * <ul>
- * <li>the original value <b>before</b> any filters were applied on it.</li>
- * <li>all values starting with an {@code _<key>.}, for example {@code a.value}
- * may have a map set with {@code a.value} (oringinal value), {@code _a.value.origin,
- * _a.value.type, etc}. The exact contents is determine by the {@link PropertySource}s
- * active.</li>
- * </ul>
- * Also important to know is that this map given contains all the evaluated raw entries, regardless
- * of the filters that are later applied. This ensures that met-information required by one filter is
- * not hidden by another filter, because of an invalid filter ordering. In other words filters may remove
- * key/value pairs, e.g. fir security reasons, by returning {@code null}, but the values in the raw map
- * passed as input to the filter process will not be affected by any such removal (but the final properties
- * returned are affected, of course).
- *
- * Finally, when a single property is accessed, e.g. by calling {@code Configuration.get(String)}.
- *
- * @return the configuration instance, or null.
- */
- @Experimental
- public Map<String, String> getConfigEntries() {
- return configEntries;
- }
-
- @Override
- public String toString() {
- return "FilterContext{key='" + key + "', configEntries=" + configEntries + '}';
- }
-
-}