You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/02/28 21:56:59 UTC
incubator-tamaya git commit: Updated/added documentation for API and
core.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master 0d6859daa -> 98de6ee51
Updated/added documentation for API and core.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/98de6ee5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/98de6ee5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/98de6ee5
Branch: refs/heads/master
Commit: 98de6ee518785a1697fdae6e1bf1d15836f307aa
Parents: 0d6859d
Author: anatole <an...@apache.org>
Authored: Sat Feb 28 21:56:49 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Sat Feb 28 21:56:49 2015 +0100
----------------------------------------------------------------------
docs/Core.adoc | 101 +++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 97 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/98de6ee5/docs/Core.adoc
----------------------------------------------------------------------
diff --git a/docs/Core.adoc b/docs/Core.adoc
index 79cd64b..1134f73 100644
--- a/docs/Core.adoc
+++ b/docs/Core.adoc
@@ -37,10 +37,27 @@ solution. Nevertheless it is also very minimalistic:
. It provides a +ConfigurationContextBuilder+ and allows changing the current +ConfigurationContext+.
. It provides +PropertyConverter+ instances for the most commonly used types.
. It implements component priorization based on the +@Priority+ annotations.
-. It provides default +PropertySources+ for
+. It provides default +PropertySource+ implementations for
.. Environment Properties
.. System Properties
- .. a PropertySource based on a simple +Map<String,String>+.
+ .. PropertySources based on +Properties+.
+
+The overall size of the library is very small. Nevertheless it is flexible enough to be extended with additional
+features as needed, such as
+
+* placeholder and resolution mechanisms
+* dynamic resource path lookup, e.g. with ant styled patterns
+* configuration injection and configuration templates
+* abstraction for reusable formats
+* integration with other existing solutions
+* configuration and configuration isolation targeting Java EE
+* dynamic configuration and configuration updates
+* Configuration management extensions
+* remote configuration
+* and more
+
+For details about the extension modules available and their functionality refer to the extension user guide.
+
[[CorePropertyConverters]]
=== Default PropertyConverters in Core
@@ -50,7 +67,6 @@ As said the _Core_ module delivers several default +PropertyConverter+ instances
[width="100%",frame="1",options="header"]
|=======
|_Target Type_ |_Class Name_ |_Supported Formats_
-
|java.math.BigDecimal |BigDecimalConverter |1.2345, 0xFF
|java.math.BigInteger |BigIntegerConverter |0xFF, 1234
|java.lang.Boolean |BooleanConverter |true, false, T, F, 1 ,0
@@ -117,5 +133,82 @@ due to several reasons:
+NOTE: TODO Discuss the defaults provided by core!
+
+
+[[CorePropertySources]]
+=== Default PropertySources in Core
+
+The Tamaya Core implementation provides a couple of default +PropertySource+ implementations, which are automatically
+registered. They are all in the package +org.apache.tamaya.core.propertysource+:
+
+[width="100%",frame="1",options="header"]
+|=======
+|_Type_ |_Class Name_ |_Ordinal Used_
+|Environment Properties |EnvironmentPropertySource |300
+|System Properties |SystemPropertySource |400
+|Base Implementation |BasePropertySource |1000
+|Properties Implementation |PropertiesPropertySource |1000
+|Properties Implementation based on a URL |PropertiesFilePropertySource |1000
+|=======
+
+There is also a class +DefaultOrdinal+, which defines several default ordinals. Beside the ordinals for system
+and environment properties above, there may additional default ordinals defined in the future.
+
+=== Abstract Class PropertiesFilePropertySource
+
+The abstract class +PropertiesFilePropertySource+ can be used for implementing a +PropertySource+ based on a +URL+
+instance that points to a +.properites+ file. It requires a +URL+ to be passed on the constructor:
+
+[source,java]
+--------------------------------------------
+PropertiesFilePropertySource(URL url);
+--------------------------------------------
+
+
+==== Abstract Class PropertiesPropertySource
+
+The abstract class +PropertiesPropertySource+ can be used for implementing a +PropertySource+ based on a +Properties+
+instance. It requires a +PropertySource+ to be passed on the constructor:
+
+[source,java]
+--------------------------------------------
+PropertiesPropertySource(Properties properties);
+--------------------------------------------
+
+
+==== Abstract Class BasePropertySource
+
+The abstract class +BasePropertySource+ can be used for implementing custom +PropertySource+ classes. It requires only
+one method to implemented:
+
+[source,java]
+.Implementing a PropertySource using BasePropertySource
+--------------------------------------------
+public class MyPropertySource extends BasePropertySource{
+
+ public String getName(){
+ // return a unique name for the property source, e.g. based on the underlying resource. This name also
+ // allows to access the property source later
+ }
+
+ public Map<String, String> getProperties(){
+ // Get a map with all properties provided by this property source
+ // If the property source is not scannable, the map returned may be empty.
+ // In the ladder case the +boolean isScannale()+ must be overridden, since
+ // by default property sources are assumed to be scannable.
+ }
+
+}
+--------------------------------------------
+
+By default the ordinal of the property sources will be 1000, unless the key +tamaya.ordinal+ asdefined in
++PropertySource.TAMAYA_ORDINAL+ is present in the current +PropertySource+. Of course it is also possible to override
+the inherited +protected void initializeOrdinal(final int defaultOrdinal)+, or directly +int getOrdinal()+.
+
+
+[[CorePropertySourceProviders]]
+=== Default PropertySourceProvider in Core
-== SPI
+With +org.apache.tamaya.core.provider.JavaConfigurationProvider+ there is also a default +PropertySourceProvider+
+present that loads all .properties files found at +META-INF/javaconfiguration.properties+.