http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/cb3c154a/documentation/extensions/mod_filter.html ---------------------------------------------------------------------- diff --git a/documentation/extensions/mod_filter.html b/documentation/extensions/mod_filter.html new file mode 100644 index 0000000..2d153c8 --- /dev/null +++ b/documentation/extensions/mod_filter.html @@ -0,0 +1,301 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta charset="utf-8"/> + <title>Apache Tamaya&#8201;&#8212;&#8201;Extension: User Filtering</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + <meta name="description" content=""/> + <meta name="author" content=""/> + <meta name="keywords" content=""/> + <meta name="generator" content="'JBake '+'${version}"/> + + <!-- Le styles --> + <link href="../../css/bootstrap.min.css" rel="stylesheet"/> + <link href="../../css/asciidoctor.css" rel="stylesheet"/> + <link href="../../css/base.css" rel="stylesheet"/> + <link href="../../css/prettify.css" rel="stylesheet"/> + + <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="../../js/html5shiv.min.js"></script> + <![endif]--> + + <!-- Fav and touch icons from ASF --> + <link rel="shortcut icon" href="../../favicon.ico"/> + <link rel="apple-touch-icon" sizes="57x57" href="../../favicons/apple-touch-icon-57x57.png"/> + <link rel="apple-touch-icon" sizes="60x60" href="../../favicons/apple-touch-icon-60x60.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../../favicons/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="76x76" href="../../favicons/apple-touch-icon-76x76.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../../favicons/apple-touch-icon-114x114.png"/> + <link rel="apple-touch-icon" sizes="120x120" href="../../favicons/apple-touch-icon-120x120.png"/> + <link rel="apple-touch-icon" sizes="144x144" href="../../favicons/apple-touch-icon-144x144.png"/> + <link rel="apple-touch-icon" sizes="152x152" href="../../favicons/apple-touch-icon-152x152.png"/> + <link rel="apple-touch-icon" sizes="180x180" href="../../favicons/apple-touch-icon-180x180.png"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-32x32.png" sizes="32x32"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-194x194.png" sizes="194x194"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-96x96.png" sizes="96x96"/> + <link rel="icon" type="image/png" href="../../favicons/android-chrome-192x192.png" sizes="192x192"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-16x16.png" sizes="16x16"/> + <link rel="manifest" href="../../favicons/manifest.json"/> + <link rel="shortcut icon" href="../../favicons/favicon.ico"/> + <meta name="msapplication-TileColor" content="#603cba"/> + <meta name="msapplication-TileImage" content="../../favicons/mstile-144x144.png"/> + <meta name="msapplication-config" content="../../favicons/browserconfig.xml"/> + <meta name="theme-color" content="#303284"/> + </head> + <body onload="prettyPrint()"> + <div id="wrap"> + <div> + + <!-- Fixed navbar --> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../../">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../index.html">Home</a></li> + <li><a href="../../about.html">About</a></li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../documentation/usecases.html">Use Cases and Requirements</a></li> + <li><a href="../../documentation/quickstart.html">Quickstart</a></li> + <li><a href="../../documentation/api.html">API</a></li> + <li><a href="../../documentation/core.html">Core</a></li> + <li><a href="../../documentation/extensions.html">Extension Guide</a></li> + <li class="divider"></li> + <li><a href="../../apidocs/index.html">Javadoc ${tamaya_version} (external)</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../development/source.html">Sources</a></li> + <li><a href="../../development/community.html">Community</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Releases <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../download.html">Download</a></li> + <li><a href="../../history.html">Release History</a></li> + </ul> + </li> +<!-- Example: + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="#">Action</a></li> + <li><a href="#">Another action</a></li> + <li><a href="#">Something else here</a></li> + <li class="divider"></li> + <li class="dropdown-header">Nav header</li> + <li><a href="#">Separated link</a></li> + <li><a href="#">One more separated link</a></li> + </ul> + </li> +--> + <li><a href="../../sitemap.xml">Sitemap</a></li> + <li><a href="../../feed.xml">Subscribe</a></li> + </ul> + </div><!--/.nav-collapse --> + </div> + </div> + + </div> + <div class="container"> + + <div class="page-header"> + <h1>Apache Tamaya&#8201;&#8212;&#8201;Extension: User Filtering</h1> + </div> + + <p><em>2016-12-19</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Optional">User Filtering (Extension Module)</h2> +<div class="sectionbody"> +<div class="sect2"> +<h3 id="_overview">Overview</h3> +<div class="paragraph"> +<p>The Tamaya filter module provides a simple singleton accessor that allows to explicitly add PropertyFilter instances +active on the current thread only. This can be very useful in many scenarios. Additionally this module adds +standard filters that hide metadata entries when the full configuration map is accessed. When keys are accessed +explicitily no filtering is applied and everything is visible.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>The module is based on Java 7, so it will not run on Java 7 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>To benefit from configuration builder support you only must add the corresponding dependency to your module:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-filter</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_the_extensions_provided">The Extensions Provided</h3> +<div class="paragraph"> +<p>Tamaya Filter comes basically with 3 artifacts:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>The org.apache.tamaya.filter.ConfigurationFilter provides several static methods to register PropertyFilter +instances on the current thread.</p> +</li> +<li> +<p>The org.apache.tamaya.filter.DefaultMetdataFilter is a PropertyFilter with hides all entries starting with +an underscore ('_'), when a full property map is accessed.</p> +</li> +</ul> +</div> +</div> +<div class="sect2"> +<h3 id="_the_configurationfilter">The ConfigurationFilter</h3> +<div class="paragraph"> +<p>The accessor mentioned implements the API for for adding PropertyFilters to the current thread (as thread local):</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final class ConfigurationFilter implements PropertyFilter{ + + ... + + /** + * Seactivates metadata filtering also on global map access for this thread. + * @see #clearFilters() + * @param active true,to enable metadata filtering (default). + */ + public static void setFilterMetadata(boolean active); + + /** + * Access the filtering configuration that is used for filtering single property values accessed. + * @return the filtering config, never null. + */ + public static FilterContext getSingleFilterContext(); + + /** + * Access the filtering configuration that is used for filtering configuration properties accessed as full + * map. + * @return the filtering config, never null. + */ + public static FilterContext getMapFilters(); + + /** + * Removes all programmable filters active on the current thread. + */ + public static void clearFilters(); + + ... + +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>For using regular expression when filtering configuration keys a corresponding implementation of a PropertyFilter +is part of this module, So you can add a customized filter as follows:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">try { + ConfigurationFilter.getMapFilters().addFilter(new myFilter()); + + // do your code with filtering active +} +finally { + // cleanup + ConfigurationFilter.clearFilters(); +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>The FilterContext is a simple structure just providing some handy accessors to the dynamic thread-local +managed filters:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final class FilterContext implements PropertyFilter { + + public void addIncludes(PropertyFilter filter); + public void addExcludes(int pos, PropertyFilter filter); + public PropertyFilter removeFilter(int pos); + public void clearFilters(); + public void setIncludes(PropertyFilter... filters); + public void setExcludes(Collection<PropertyFilter> filters); + public List<PropertyFilter> getFilters(); + +}</code></pre> +</div> +</div> +</div> +</div> +</div></p> + + <hr /> + </div> + </div> + <div> + <div id="push"></div> + + <div id="footer"> + <div class="container"> + <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> + | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> + at <span>2016-12-19</span> + </p> + <p> + <b>Disclaimer</b> + Apache Tamaya (incubating) is an effort undergoing + incubation at + The Apache Software Foundation (ASF), sponsored by + the name of Apache Incubator. Incubation is required of + all newly accepted projects until a further review indicates + that the infrastructure, communications, and decision making + process have stabilized in a manner consistent with other + successful ASF projects. While incubation status is not + necessarily a reflection of the completeness or stability of + the code, it does indicate that the project has yet to + be fully endorsed by the ASF.<br /> + <a href="http://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"><img class="incubator-logo" src="../../logos/egg-logo2.png"/></a> + </p> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="../../js/jquery-1.11.1.min.js"></script> + <script src="../../js/bootstrap.min.js"></script> + <script src="../../js/prettify.js"></script> + + </div> + </body> +</html>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/cb3c154a/documentation/extensions/mod_formats.html ---------------------------------------------------------------------- diff --git a/documentation/extensions/mod_formats.html b/documentation/extensions/mod_formats.html new file mode 100644 index 0000000..513c1d0 --- /dev/null +++ b/documentation/extensions/mod_formats.html @@ -0,0 +1,462 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta charset="utf-8"/> + <title>Apache Tamaya&#8201;&#8212;&#8201;Extension: Formats</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + <meta name="description" content=""/> + <meta name="author" content=""/> + <meta name="keywords" content=""/> + <meta name="generator" content="'JBake '+'${version}"/> + + <!-- Le styles --> + <link href="../../css/bootstrap.min.css" rel="stylesheet"/> + <link href="../../css/asciidoctor.css" rel="stylesheet"/> + <link href="../../css/base.css" rel="stylesheet"/> + <link href="../../css/prettify.css" rel="stylesheet"/> + + <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="../../js/html5shiv.min.js"></script> + <![endif]--> + + <!-- Fav and touch icons from ASF --> + <link rel="shortcut icon" href="../../favicon.ico"/> + <link rel="apple-touch-icon" sizes="57x57" href="../../favicons/apple-touch-icon-57x57.png"/> + <link rel="apple-touch-icon" sizes="60x60" href="../../favicons/apple-touch-icon-60x60.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../../favicons/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="76x76" href="../../favicons/apple-touch-icon-76x76.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../../favicons/apple-touch-icon-114x114.png"/> + <link rel="apple-touch-icon" sizes="120x120" href="../../favicons/apple-touch-icon-120x120.png"/> + <link rel="apple-touch-icon" sizes="144x144" href="../../favicons/apple-touch-icon-144x144.png"/> + <link rel="apple-touch-icon" sizes="152x152" href="../../favicons/apple-touch-icon-152x152.png"/> + <link rel="apple-touch-icon" sizes="180x180" href="../../favicons/apple-touch-icon-180x180.png"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-32x32.png" sizes="32x32"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-194x194.png" sizes="194x194"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-96x96.png" sizes="96x96"/> + <link rel="icon" type="image/png" href="../../favicons/android-chrome-192x192.png" sizes="192x192"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-16x16.png" sizes="16x16"/> + <link rel="manifest" href="../../favicons/manifest.json"/> + <link rel="shortcut icon" href="../../favicons/favicon.ico"/> + <meta name="msapplication-TileColor" content="#603cba"/> + <meta name="msapplication-TileImage" content="../../favicons/mstile-144x144.png"/> + <meta name="msapplication-config" content="../../favicons/browserconfig.xml"/> + <meta name="theme-color" content="#303284"/> + </head> + <body onload="prettyPrint()"> + <div id="wrap"> + <div> + + <!-- Fixed navbar --> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../../">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../index.html">Home</a></li> + <li><a href="../../about.html">About</a></li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../documentation/usecases.html">Use Cases and Requirements</a></li> + <li><a href="../../documentation/quickstart.html">Quickstart</a></li> + <li><a href="../../documentation/api.html">API</a></li> + <li><a href="../../documentation/core.html">Core</a></li> + <li><a href="../../documentation/extensions.html">Extension Guide</a></li> + <li class="divider"></li> + <li><a href="../../apidocs/index.html">Javadoc ${tamaya_version} (external)</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../development/source.html">Sources</a></li> + <li><a href="../../development/community.html">Community</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Releases <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../download.html">Download</a></li> + <li><a href="../../history.html">Release History</a></li> + </ul> + </li> +<!-- Example: + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="#">Action</a></li> + <li><a href="#">Another action</a></li> + <li><a href="#">Something else here</a></li> + <li class="divider"></li> + <li class="dropdown-header">Nav header</li> + <li><a href="#">Separated link</a></li> + <li><a href="#">One more separated link</a></li> + </ul> + </li> +--> + <li><a href="../../sitemap.xml">Sitemap</a></li> + <li><a href="../../feed.xml">Subscribe</a></li> + </ul> + </div><!--/.nav-collapse --> + </div> + </div> + + </div> + <div class="container"> + + <div class="page-header"> + <h1>Apache Tamaya&#8201;&#8212;&#8201;Extension: Formats</h1> + </div> + + <p><em>2016-12-19</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Core">Tamaya Formats (Extension Module)</h2> +<div class="sectionbody"> +<div class="sect2"> +<h3 id="_overview">Overview</h3> +<div class="paragraph"> +<p>Tamaya Formats is an extension module. Refer to the <a href="modules.html">extensions documentation</a> for further details.</p> +</div> +<div class="paragraph"> +<p>Tamaya Formats provides an abstraction for configuration formats provding the following benefits:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>Parsing of resources in can be implemented separately from interpreting the different aspects/parts parsed. As an +example a file format can define different sections. Depending on the company specific semantics of the sections +a different set of PropertySource instances must be created.</p> +</li> +<li> +<p>Similarly the configuration abstraction can also be used as an interface for integrating Tamaya with alternate +frameworks that provide logic for reading configuration files, such as Apache commons.configuration.</p> +</li> +</ul> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>The module is based on Java 7, so it can be used with Java 7 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>To benefit from dynamic value resolution you only must add the corresponding dependency to your module:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-formats</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_the_idea">The Idea</h3> +<div class="paragraph"> +<p>Formats should be reusable, meaning you should have to write a format parser only once and then be able to map the data read into whatever +data structure (in our cases: property sources).</p> +</div> +<div class="sect3"> +<h4 id="_configurationdata">ConfigurationData</h4> +<div class="paragraph"> +<p>Configuration formats can be very different. Some are simple key/value pairs, whereas other also consist of multiple sections (e.g. ini-files) or +hierarchical data (e.g. yaml, xml). This is solved in Tamaya by mapping the configuration read into a normalized intermediary format called +ConfigurationData:</p> +</div> +<div class="listingblock"> +<div class="title">ConfigurationData</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final class ConfigurationData { + + public ConfigurationFormat getFormat(); + public String getResource(); + + public Set<String> getSectionNames(); + public Map<String,String> getSection(String name); + + public boolean hasDefaultProperties(); + public Map<String,String> getDefaultProperties(); + public Map<String,String> getCombinedProperties(); + + public boolean isEmpty(); +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>In detail the data read from a file is organized into <em>sections</em> as follows:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>with getResource() and getFormat() the underlying resource and the format that read this data can be accessed.</p> +</li> +<li> +<p>properties can be owned by</p> +<div class="ulist"> +<ul> +<li> +<p>named sections</p> +</li> +<li> +<p>an (unnamed) default section</p> +</li> +</ul> +</div> +</li> +<li> +<p>each section section contains a map of properties. Hereby the same key can be part of the default section and multiple +named sections, depending on the configuration format.</p> +</li> +<li> +<p>The method getSectionNames() returns a set of all section names.</p> +</li> +<li> +<p>With getSection(String name) a named section can be accessed.</p> +</li> +<li> +<p>With getDefaultSection() the 'default' section can be accessed. This is a convenience method.</p> +</li> +<li> +<p>With getCombinedProperties() a flattened entry map can be accessed built up (by default) out of</p> +<div class="ulist"> +<ul> +<li> +<p>all entries from the default section, without any changes.</p> +</li> +<li> +<p>all entries from named sections, where the key for each entry is prefix with the section name and a '::' separator.</p> +</li> +</ul> +</div> +</li> +<li> +<p>The configuration format used determines the mapping of configuration data read into this structure. The format +implementation can as well provide alternate implementations of how the data read should be mapped into the +combined properties map.</p> +</li> +</ul> +</div> +</div> +<div class="sect3"> +<h4 id="_configurationformat">ConfigurationFormat</h4> +<div class="paragraph"> +<p>A ConfigurationFormat is basically an abstraction that reads a configuration resource (modelled by an InputStream) and +creates a corresponding ConfigurationData instance.</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public interface ConfigurationFormat { + + String getName(); + boolean accepts(URL url); + ConfigurationData readConfiguration(String resource, InputStream inputStream); +}</code></pre> +</div> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_how_to_tranform_configurationdata_into_a_propertysource">How to tranform ConfigurationData into a PropertySource</h3> +<div class="paragraph"> +<p>For for the conversion of ConfigurationData into a PropertySource different approaches can be useful:</p> +</div> +<div class="olist arabic"> +<ol class="arabic"> +<li> +<p>The ConfigurationFormat that reads the data can provides all properties read either as sectioned properties +or/and as default properties. The most simple cases is, where all properties have been added as 'default' +properties. In this case the default properties can be used as the property sources properties without any change.</p> +</li> +<li> +<p>If the format did also add section based properties, the combined properties returned can be used, hereby +replacing the '::' separator with a '.' separator.</p> +</li> +<li> +<p>In all other cases a custom mapping is useful, which can be acomplished by using the MappedConfigurationDataPropertySource +and overriding the Map<String,String> populateData(ConfigurationData data) method.</p> +</li> +</ol> +</div> +<div class="paragraph"> +<p>In most cases the usage of a FlattenedDefaultPropertySource, is a good choice to start. This class +provides a convenient default mapping and also allows to customized the mapping easily:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">ConfigurationData data = ...; +FlattenedDefaultPropertySource ps = new FlattenedDefaultPropertySource(data){ + protected Map<String, String> populateData(ConfigurationData data) { + ... + } +};</code></pre> +</div> +</div> +<div class="paragraph"> +<p>Nevertheless, depending on the context, where a configuration source was read (classloader, time, source etc.) the +resulting properties can have different semnatics, especially different priorities. Also section +names may be mapped into different ordinals instead of using them as key prefixes (e.g. imagine configuration formats +with a 'default', 'main', and 'overrides' sections). For such more complex or custom cases no simple mapping +can be defined. Consequently the functionality mapping the normalized ConfigurationData read to the +appropriate collection of PropertySource instances must be implemented.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_examples">Examples</h3> +<div class="sect3"> +<h4 id="_mapping_ini_files">Mapping ini-Files</h4> +<div class="paragraph"> +<p>Consider the following ini-file:</p> +</div> +<div class="listingblock"> +<div class="title">Example.ini</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-listing" data-lang="listing">a=valA +a.b=valB + +[section1] +aa=sectionValA +aa.b.c=SectionValC + +[section2] +a=val2Section2</code></pre> +</div> +</div> +<div class="paragraph"> +<p>This file content coud be mapped to the following structure:</p> +</div> +<div class="listingblock"> +<div class="title">Mapping of Example.ini</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-listing" data-lang="listing">a=valA +a.b=valB +section1::valA=sectionValA +section1::a.b.c=SectionValC +section2::a=val2Section2</code></pre> +</div> +</div> +<div class="paragraph"> +<p>Nevertheless from the ConfigurationData instance a more complex algorithm can access all the different parts:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>the_default_ properties (a, a.b)</p> +</li> +<li> +<p>the section section1, with properties aa, aa.b.c</p> +</li> +<li> +<p>the section section2, qith properties a</p> +</li> +</ul> +</div> +</div> +<div class="sect3"> +<h4 id="_mapping_xml_files">Mapping xml-Files</h4> +<div class="paragraph"> +<p>The same concept can also be applied to xml-files. Consider the following configuration file:</p> +</div> +<div class="listingblock"> +<div class="title">Example.conf</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><config> + <default> + <a>valA</a> + <a.b>valB</a.B> + </default> + + <section id="section1"> + <param id="aa">sectionValA</aa> + <param id="aa.b.c">SectionValC</aa.b.c> + </section> + <section id="section2"> + <param id="a">val2Section2</aa> + </section> +</config></code></pre> +</div> +</div> +<div class="paragraph"> +<p>This file basically describes the same configuration as the ini-based version we have seen before. The formats +module hereby ships with 3 format classes:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>PropertiesFormat providing support for .properties files.</p> +</li> +<li> +<p>PropertiesXmlFormat providing support for xml.property files.</p> +</li> +<li> +<p>IniConfiguratonFormat providing support for xml.property files.</p> +</li> +</ul> +</div> +</div> +</div> +</div> +</div></p> + + <hr /> + </div> + </div> + <div> + <div id="push"></div> + + <div id="footer"> + <div class="container"> + <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> + | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> + at <span>2016-12-19</span> + </p> + <p> + <b>Disclaimer</b> + Apache Tamaya (incubating) is an effort undergoing + incubation at + The Apache Software Foundation (ASF), sponsored by + the name of Apache Incubator. Incubation is required of + all newly accepted projects until a further review indicates + that the infrastructure, communications, and decision making + process have stabilized in a manner consistent with other + successful ASF projects. While incubation status is not + necessarily a reflection of the completeness or stability of + the code, it does indicate that the project has yet to + be fully endorsed by the ASF.<br /> + <a href="http://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"><img class="incubator-logo" src="../../logos/egg-logo2.png"/></a> + </p> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="../../js/jquery-1.11.1.min.js"></script> + <script src="../../js/bootstrap.min.js"></script> + <script src="../../js/prettify.js"></script> + + </div> + </body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/cb3c154a/documentation/extensions/mod_functions.html ---------------------------------------------------------------------- diff --git a/documentation/extensions/mod_functions.html b/documentation/extensions/mod_functions.html new file mode 100644 index 0000000..c58d9b6 --- /dev/null +++ b/documentation/extensions/mod_functions.html @@ -0,0 +1,338 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta charset="utf-8"/> + <title>Apache Tamaya&#8201;&#8212;&#8201;Extension: Functions</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + <meta name="description" content=""/> + <meta name="author" content=""/> + <meta name="keywords" content=""/> + <meta name="generator" content="'JBake '+'${version}"/> + + <!-- Le styles --> + <link href="../../css/bootstrap.min.css" rel="stylesheet"/> + <link href="../../css/asciidoctor.css" rel="stylesheet"/> + <link href="../../css/base.css" rel="stylesheet"/> + <link href="../../css/prettify.css" rel="stylesheet"/> + + <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="../../js/html5shiv.min.js"></script> + <![endif]--> + + <!-- Fav and touch icons from ASF --> + <link rel="shortcut icon" href="../../favicon.ico"/> + <link rel="apple-touch-icon" sizes="57x57" href="../../favicons/apple-touch-icon-57x57.png"/> + <link rel="apple-touch-icon" sizes="60x60" href="../../favicons/apple-touch-icon-60x60.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../../favicons/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="76x76" href="../../favicons/apple-touch-icon-76x76.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../../favicons/apple-touch-icon-114x114.png"/> + <link rel="apple-touch-icon" sizes="120x120" href="../../favicons/apple-touch-icon-120x120.png"/> + <link rel="apple-touch-icon" sizes="144x144" href="../../favicons/apple-touch-icon-144x144.png"/> + <link rel="apple-touch-icon" sizes="152x152" href="../../favicons/apple-touch-icon-152x152.png"/> + <link rel="apple-touch-icon" sizes="180x180" href="../../favicons/apple-touch-icon-180x180.png"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-32x32.png" sizes="32x32"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-194x194.png" sizes="194x194"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-96x96.png" sizes="96x96"/> + <link rel="icon" type="image/png" href="../../favicons/android-chrome-192x192.png" sizes="192x192"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-16x16.png" sizes="16x16"/> + <link rel="manifest" href="../../favicons/manifest.json"/> + <link rel="shortcut icon" href="../../favicons/favicon.ico"/> + <meta name="msapplication-TileColor" content="#603cba"/> + <meta name="msapplication-TileImage" content="../../favicons/mstile-144x144.png"/> + <meta name="msapplication-config" content="../../favicons/browserconfig.xml"/> + <meta name="theme-color" content="#303284"/> + </head> + <body onload="prettyPrint()"> + <div id="wrap"> + <div> + + <!-- Fixed navbar --> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../../">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../index.html">Home</a></li> + <li><a href="../../about.html">About</a></li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../documentation/usecases.html">Use Cases and Requirements</a></li> + <li><a href="../../documentation/quickstart.html">Quickstart</a></li> + <li><a href="../../documentation/api.html">API</a></li> + <li><a href="../../documentation/core.html">Core</a></li> + <li><a href="../../documentation/extensions.html">Extension Guide</a></li> + <li class="divider"></li> + <li><a href="../../apidocs/index.html">Javadoc ${tamaya_version} (external)</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../development/source.html">Sources</a></li> + <li><a href="../../development/community.html">Community</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Releases <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../download.html">Download</a></li> + <li><a href="../../history.html">Release History</a></li> + </ul> + </li> +<!-- Example: + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="#">Action</a></li> + <li><a href="#">Another action</a></li> + <li><a href="#">Something else here</a></li> + <li class="divider"></li> + <li class="dropdown-header">Nav header</li> + <li><a href="#">Separated link</a></li> + <li><a href="#">One more separated link</a></li> + </ul> + </li> +--> + <li><a href="../../sitemap.xml">Sitemap</a></li> + <li><a href="../../feed.xml">Subscribe</a></li> + </ul> + </div><!--/.nav-collapse --> + </div> + </div> + + </div> + <div class="container"> + + <div class="page-header"> + <h1>Apache Tamaya&#8201;&#8212;&#8201;Extension: Functions</h1> + </div> + + <p><em>2016-12-19</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Core">Tamaya Functions (Extension Module)</h2> +<div class="sectionbody"> +<div class="sect2"> +<h3 id="_overview">Overview</h3> +<div class="paragraph"> +<p>Tamaya Functions is an extension module. Refer to the <a href="modules.html">extensions documentation</a> for further details.</p> +</div> +<div class="paragraph"> +<p>Tamaya Functions provides several functional extensions using the ConfigOperator,ConfigQuery extension points. Most +functional extension are accessible from the ConfigurationFunction singleton. When importing its methods statically +one can use the methods to achieve some interesting effects, e.g.</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">import static org.apache.tamaya.functions.ConfigurationFunctions.*; + +Set<String> sections = ConfigurationProvider.getConfiguration().with(areas("a", false).with(transitiveAreas());</code></pre> +</div> +</div> +<div class="paragraph"> +<p>The expression above returns all fully qualified section names that are child sections of the root section 'a'. +So given the entries a.b.entry1, a.b.entry2, a.a.entry3, a.b.c.entry4 the reult would be a, a.a, a.b, a.b.c.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>The module is based on Java 7, so it can be used with Java 7 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>For using the functionality shown in this document you only must add the corresponding dependency to your module:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-functions</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_the_provided_functions">The Provided Functions</h3> +<div class="sect3"> +<h4 id="_functions_on_configurationfunctions">Functions on ConfigurationFunctions</h4> +<div class="paragraph"> +<p>The following sections explain the provided functions defined by ConfigurationFunctions singleton.</p> +</div> +<div class="ulist"> +<ul> +<li> +<p><strong>ConfigOperator filter(PropertyMatcher matcher)</strong> creates a ConfigOperator that creates a Configuration +containing only keys that are selected by the given <em>matcher predicate</em>. The PropertyMatcher hereby allows to evaluate not only +the <em>key</em>, but also the <em>value</em>.</p> +</li> +<li> +<p><strong>ConfigOperator map(KeyMapper keyMapper)</strong> creates a ConfigOperator that maps the keys as defined +by the given <em>keyMapper</em>.</p> +</li> +<li> +<p><strong>ConfigOperator section(String section)</strong> creates a ConfigOperator that creates a Configuration containing only +entries that are direct or indirect members of the given section.</p> +</li> +<li> +<p><strong>ConfigOperator section(String areaKey, boolean stripKeys)</strong> creates a ConfigOperator that creates a Configuration +containing only entries that are direct or indirect members of the given section. Hereby <em>stripKeys</em> allows to determine +if the returned entries should be relative to the search criteria {{stripKeys=true}} or absolute keys.</p> +</li> +<li> +<p><strong>isKeyInSection(String section, String sectionKey)</strong> allows to easily determine if a given <em>key</em> is a direct or indirect member +of a given section.</p> +</li> +<li> +<p><strong>boolean isKeyInSections(String key, String…​ sectionKeys)</strong> allows to easily determine if one key of given +<em>key</em> is a direct or indirect member of at least one of the given <em>sectionKeys</em>.</p> +</li> +<li> +<p><strong>ConfigQuery<Set<String>> sections()</strong> allows to query all the contained fully qualified section names (the ones that +also have parameters present).</p> +</li> +<li> +<p><strong>ConfigQuery<Set<String>> transitiveSections()</strong> allows to query all the contained fully qualified section names, +including the transitive closure of sections.</p> +</li> +<li> +<p><strong>ConfigQuery<Set<String>> sections(final Predicate<String> predicate)</strong> allows to query all the contained fully +qualified section names that are selected by the given <em>predicate</em>.</p> +</li> +<li> +<p><strong>ConfigQuery<Set<String>> sections(final Predicate<String> predicate)</strong> allows to query all the contained fully +qualified section names that are selected by the given <em>predicate</em>, including the transitive closure of sections +identified.</p> +</li> +<li> +<p><strong>ConfigOperator sectionsRecursive(String…​ sectionKeys)</strong> provides a ConfigOperator that filters all sections identified +by the given <em>sectionKeys</em> and its child sections.</p> +</li> +<li> +<p><strong>ConfigOperator sectionRecursive(final boolean stripKeys, final String…​ sectionKeys)</strong> provides a ConfigOperator +that filters all sections identified by the given <em>sectionKeys</em> and its child sections. <em>stripKeys</em> allows to +determine if the resulting configuration should be relative to the selected areas ({{stripKeys=true}}) or +absolute (filtering only).</p> +</li> +<li> +<p><strong>ConfigQuery<String> jsonInfo()</strong> returns a query that converts a Configuration into a JSON formatted String +representation.</p> +</li> +</ul> +</div> +</div> +<div class="sect3"> +<h4 id="_functions_on_propertysourcefunctions">Functions on PropertySourceFunctions</h4> +<div class="paragraph"> +<p>The following sections explain the provided functions defined by PropertySourceFunctions singleton.</p> +</div> +<div class="ulist"> +<ul> +<li> +<p><strong>PropertySource addMetaData(PropertySource propertySource, Map<String,String> metaData)</strong> Creates a new PropertySource +with the given metadata added.</p> +</li> +<li> +<p><strong>boolean isKeyInSection(String key, String sectionKey)</strong> Checks if the given <em>key</em> is a direct or indirect member of +one of the given <em>sectionKey</em>.</p> +</li> +<li> +<p><strong>boolean isKeyInSections(String key, String…​ sectionKeys)</strong> Checks if the given <em>key</em> is a direct or indirect member of +one of one of the given <em>sectionKeys</em>.</p> +</li> +<li> +<p><strong>Set<String> sections(Map<String, String> properties)</strong> Extracts the sections from the given properties.</p> +</li> +<li> +<p><strong>Set<String> transitiveSections(Map<String, String> properties)</strong> Extracts the transitive sections from the given +properties.</p> +</li> +<li> +<p><strong>Set<String> sections(Map<String, String> properties, final Predicate<String> predicate)</strong> Extracts the sections +from the given properties, also filtering with the given predicate.</p> +</li> +<li> +<p><strong>Set<String> transitiveSections(Map<String, String> properties, Predicate<String> predicate)</strong> Extracts the transitive +sections from the given properties, also filtering with the given predicate.</p> +</li> +<li> +<p><strong>Map<String,String> sectionsRecursive(Map<String, String> properties, String…​ sectionKeys)</strong> Creates w PropertySource +only containing the sections that a direct or indirect children of the given <em>sectionKeys</em>.</p> +</li> +<li> +<p><strong>Map<String,String> sectionRecursive(Map<String, String> properties, boolean stripKeys, String…​ sectionKeys)</strong> Creates w PropertySource +only containing the sections that a direct or indirect children of the given <em>sectionKeys</em>. With <em>stripKeys</em> one can +select of the returned values should be relative to its selection of be fully qualified.</p> +</li> +<li> +<p><strong>String stripSectionKeys(String key, String…​ sectionKeys)</strong> This function strips away the matching section key as given +in <em>sectionKeys</em> from a given <em>key</em>.</p> +</li> +</ul> +</div> +</div> +</div> +</div> +</div></p> + + <hr /> + </div> + </div> + <div> + <div id="push"></div> + + <div id="footer"> + <div class="container"> + <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> + | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> + at <span>2016-12-19</span> + </p> + <p> + <b>Disclaimer</b> + Apache Tamaya (incubating) is an effort undergoing + incubation at + The Apache Software Foundation (ASF), sponsored by + the name of Apache Incubator. Incubation is required of + all newly accepted projects until a further review indicates + that the infrastructure, communications, and decision making + process have stabilized in a manner consistent with other + successful ASF projects. While incubation status is not + necessarily a reflection of the completeness or stability of + the code, it does indicate that the project has yet to + be fully endorsed by the ASF.<br /> + <a href="http://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"><img class="incubator-logo" src="../../logos/egg-logo2.png"/></a> + </p> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="../../js/jquery-1.11.1.min.js"></script> + <script src="../../js/bootstrap.min.js"></script> + <script src="../../js/prettify.js"></script> + + </div> + </body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/cb3c154a/documentation/extensions/mod_injection.html ---------------------------------------------------------------------- diff --git a/documentation/extensions/mod_injection.html b/documentation/extensions/mod_injection.html new file mode 100644 index 0000000..c11c218 --- /dev/null +++ b/documentation/extensions/mod_injection.html @@ -0,0 +1,700 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta charset="utf-8"/> + <title>Apache Tamaya&#8201;&#8212;&#8201;Extension: Injection</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + <meta name="description" content=""/> + <meta name="author" content=""/> + <meta name="keywords" content=""/> + <meta name="generator" content="'JBake '+'${version}"/> + + <!-- Le styles --> + <link href="../../css/bootstrap.min.css" rel="stylesheet"/> + <link href="../../css/asciidoctor.css" rel="stylesheet"/> + <link href="../../css/base.css" rel="stylesheet"/> + <link href="../../css/prettify.css" rel="stylesheet"/> + + <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="../../js/html5shiv.min.js"></script> + <![endif]--> + + <!-- Fav and touch icons from ASF --> + <link rel="shortcut icon" href="../../favicon.ico"/> + <link rel="apple-touch-icon" sizes="57x57" href="../../favicons/apple-touch-icon-57x57.png"/> + <link rel="apple-touch-icon" sizes="60x60" href="../../favicons/apple-touch-icon-60x60.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../../favicons/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="76x76" href="../../favicons/apple-touch-icon-76x76.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../../favicons/apple-touch-icon-114x114.png"/> + <link rel="apple-touch-icon" sizes="120x120" href="../../favicons/apple-touch-icon-120x120.png"/> + <link rel="apple-touch-icon" sizes="144x144" href="../../favicons/apple-touch-icon-144x144.png"/> + <link rel="apple-touch-icon" sizes="152x152" href="../../favicons/apple-touch-icon-152x152.png"/> + <link rel="apple-touch-icon" sizes="180x180" href="../../favicons/apple-touch-icon-180x180.png"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-32x32.png" sizes="32x32"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-194x194.png" sizes="194x194"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-96x96.png" sizes="96x96"/> + <link rel="icon" type="image/png" href="../../favicons/android-chrome-192x192.png" sizes="192x192"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-16x16.png" sizes="16x16"/> + <link rel="manifest" href="../../favicons/manifest.json"/> + <link rel="shortcut icon" href="../../favicons/favicon.ico"/> + <meta name="msapplication-TileColor" content="#603cba"/> + <meta name="msapplication-TileImage" content="../../favicons/mstile-144x144.png"/> + <meta name="msapplication-config" content="../../favicons/browserconfig.xml"/> + <meta name="theme-color" content="#303284"/> + </head> + <body onload="prettyPrint()"> + <div id="wrap"> + <div> + + <!-- Fixed navbar --> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../../">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../index.html">Home</a></li> + <li><a href="../../about.html">About</a></li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../documentation/usecases.html">Use Cases and Requirements</a></li> + <li><a href="../../documentation/quickstart.html">Quickstart</a></li> + <li><a href="../../documentation/api.html">API</a></li> + <li><a href="../../documentation/core.html">Core</a></li> + <li><a href="../../documentation/extensions.html">Extension Guide</a></li> + <li class="divider"></li> + <li><a href="../../apidocs/index.html">Javadoc ${tamaya_version} (external)</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../development/source.html">Sources</a></li> + <li><a href="../../development/community.html">Community</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Releases <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../download.html">Download</a></li> + <li><a href="../../history.html">Release History</a></li> + </ul> + </li> +<!-- Example: + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="#">Action</a></li> + <li><a href="#">Another action</a></li> + <li><a href="#">Something else here</a></li> + <li class="divider"></li> + <li class="dropdown-header">Nav header</li> + <li><a href="#">Separated link</a></li> + <li><a href="#">One more separated link</a></li> + </ul> + </li> +--> + <li><a href="../../sitemap.xml">Sitemap</a></li> + <li><a href="../../feed.xml">Subscribe</a></li> + </ul> + </div><!--/.nav-collapse --> + </div> + </div> + + </div> + <div class="container"> + + <div class="page-header"> + <h1>Apache Tamaya&#8201;&#8212;&#8201;Extension: Injection</h1> + </div> + + <p><em>2016-12-19</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Core">Tamaya Injection (Extension Module)</h2> +<div class="sectionbody"> +<div class="sect2"> +<h3 id="_overview">Overview</h3> +<div class="paragraph"> +<p>Tamaya Injection is an extension module. Refer to the <a href="modules.html">extensions documentation</a> for further details +about modules.</p> +</div> +<div class="paragraph"> +<p>Tamaya Injection provides functionality for injecting configured values into beans, or creating configuration +template instances.</p> +</div> +<div class="paragraph"> +<p>Inversion of Control (aka IoC/the Hollywood Principle) has proven to be very useful and effective in avoiding boilerplate +code. In Java there are different frameworks available that all provide IoC mechanisms. Unfortunately IoC is not a +built-in language feature. So for a portable solution that works also in Java SE Tamaya itself has to provide the +according injection services. This module adds this functionality to Tamaya.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>The module is based on Java 7, so it can be used with Java 7 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>Basically Tamaya’s injection API is deployed as API artifact:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-injection-api</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +<div class="paragraph"> +<p>To use injection with Java SE you must add the corresponding dependency to your module:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-injection</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +<div class="paragraph"> +<p>Similarly there are other injection implementations available, targetig platforms such as</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>Spring, Spring Boot</p> +</li> +<li> +<p>Java EE/CDI</p> +</li> +<li> +<p>OSGI, Apache Felix/Apache Karaf</p> +</li> +</ul> +</div> +</div> +<div class="sect2"> +<h3 id="_core_concepts">Core Concepts</h3> +<div class="paragraph"> +<p>Basically you annotate fields or methods in your beans with @Config to enable configuration injection. Tamaya +additionally defines further annotations that allo you to define additional aspects such as default values, custom +converters etc. The following example illustrates the basic functionality: +code snippet:</p> +</div> +<div class="listingblock"> +<div class="title">Annotated Example Class</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">package foo.bar; + +public class ConfiguredClass { + + // resolved by default, using property name, class and package name: foo.bar.ConfiguredClass.testProperty + private String testProperty; + + // Trying to resolve mutiple keys, with a default value, if none could be resolved + @Config({"a.b.c.key1","a.b.legacyKey",area1.key2"}, defaultValue="The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.") + String value1; + + // Typical case + @Config("a.b.c.key2") + private int value2; + + // resolved by default as foo.bar.ConfiguredClass.accessUrl + // Using a (default) String -> URL converter + @Config(defaultValue="http://127.0.0.1:8080/res/api/v1/info.json") + private URL accessUrl; + + // Config injection disabled for this property + @NoConfig + private Integer int1; + + // Overriding the String -> BigDecimal converter with a custom implementation. + @Config("BD") + @WithPropertyConverter(MyBigDecimalRoundingAdapter.class) + private BigDecimal bigNumber; + + ... +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>When configuring data or configuration classes it is also possible to auto-inject the fields identified. For activating +this feature a class must be annotated with @ConfigAutoInject:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">. An autoinjected bean class +-------------------------------------------- +package a.b;</code></pre> +</div> +</div> +<div class="paragraph"> +<p>@ConfigAutoInject +public final class Tenant { + private int id; + private String name; + private String description; + @NoConfig // prevents auto injection for this field + private String id2;</p> +</div> +<div class="literalblock"> +<div class="content"> +<pre> public int getId(){ + return id; + } + public String getName(){ + return name; + } + public String getDescription(){ + return description; + } +}</pre> +</div> +</div> +<div class="listingblock"> +<div class="content"> +<pre>These examples do not show all possibilities provided. Configuring instance of these +class using Tamaya is very simple: Just pass the instance to Tamaya to let +Tamaya inject the configuration (or throw a +ConfigException+, if this is not possible): + +[source,java] +.Configuring the +ConfiguredClass+ Instance</pre> +</div> +</div> +<div class="paragraph"> +<p>ConfiguredClass classInstance = new ConfiguredClass(); +ConfigurationInjector.configure(configuredClass);</p> +</div> +<div class="paragraph"> +<p>Tenant tenant = new Tenant(); +ConfigurationInjector.configure(tenant);</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>NOTE: Configuration injection works similarly, when used with other integration modules, e.g. when Tamaya is used +with CDI, Spring or within an OSGI container. For further details refer also to the corresponding integration module's +documentation. + + +=== The Annotations in detail +==== The ConfigurationInjector + +The +ConfigurationInjector+ interface provides methods that allow any kind of instances to be configured +by passing the instances to +T ConfigurationInjector.getInstance().configure(T);+. The classes passed +hereby must not be annotated with +@Config+ for being configurable. By default Tamaya +tries to determine configuration for each property of an instance passed, using the following resolution policy: + +Given a class +a.b.MyClass+ and a field +myField+ it would try to look up the following keys: +[source, listing]</pre> +</div> +</div> +<div class="paragraph"> +<p>a.b.MyClass.myField +a.b.MyClass.my-field +MyClass.myField +MyClass.my-field +myField +my-field</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>So given the following properties: + +[source, properties]</pre> +</div> +</div> +<div class="paragraph"> +<p>a.b.Tenant.id=1234 +Tenant.description=Any kind of tenant. +name=<unnamed></p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>==== Accessing Supplier instances + +In many cases you want to create a supplier that simply creates instances that are correctly configured as defined +by the current context. This can be done using +Suppliers+: + +[source, java]</pre> +</div> +</div> +<div class="paragraph"> +<p>Supplier<Tenant> configuredTenantSupplier = ConfigurationInjector.getInstance().getConfiguredSupplier( + new Supplier<Tenant>(){ + public Tenant get(){ + return new Tenant(); + } +});</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>With Java 8 it's even more simple: + +[source, java]</pre> +</div> +</div> +<div class="paragraph"> +<p>Supplier<Tenant> configuredTenantSupplier = ConfigurationInjector.getInstance().getConfiguredSupplier( + Tenant::new);</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>Hereby this annotation can be used in multiple ways and combined with other annotations such as ++@WithLoadPolicy+, +@WithConfigOperator+, +@WithPropertyConverter+. + +==== Minimal Example + +To illustrate the mechanism below the most simple variant of a configured class is given: + +[source,java] +.Most simple configured class</pre> +</div> +</div> +<div class="paragraph"> +<p>pubic class ConfiguredItem{ + @Config + private String aValue; +}</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>When this class is configured, e.g. by passing it to +ConfigurationInjector.getInstance().configure(Object)+, +the following is happening: + +* The current valid +Configuration+ is evaluated by calling +Configuration cfg = ConfigurationProvider.getConfiguration();+ +* The current property value (String) is evaluated by calling +cfg.get("aValue");+ for each possible key (mutliple + keys are possible). +* if not successful, an error is thrown (+ConfigException+) +* On success, since no type conversion is involved, the value is injected. + +==== Using @DefaultValue + +In the next example we explicitly define the property value: +[source,java]</pre> +</div> +</div> +<div class="paragraph"> +<p>pubic class ConfiguredItem{</p> +</div> +<div class="literalblock"> +<div class="content"> +<pre> @Config(value={"aValue", "a.b.value","a.b.deprecated.value"}, defaultValue="${env:java.version}") + private String aValue; +}</pre> +</div> +</div> +<div class="listingblock"> +<div class="content"> +<pre>==== Inject a DynamicValue Property + +Within this example we evaluate a dynamic value. This mechanism allows you to listen for configuration changes and to +commit new values exactly, when convenient for you. + +[source,java]</pre> +</div> +</div> +<div class="paragraph"> +<p>pubic class ConfiguredItem{</p> +</div> +<div class="literalblock"> +<div class="content"> +<pre> @Config(value={"aValue", "a.b.value","a.b.deprecated.value"}, defaultValue="${env:java.version}") + private DynamicValue aValue; +}</pre> +</div> +</div> +<div class="listingblock"> +<div class="content"> +<pre>The +DynamicValue+ provides you the following functionality: + +[source,java]</pre> +</div> +</div> +<div class="paragraph"> +<p>public interface DynamicValue<T> {</p> +</div> +<div class="literalblock"> +<div class="content"> +<pre>enum UpdatePolicy{ + IMMEDIATE, + EXPLCIT, + NEVER, + LOG_AND_DISCARD +}</pre> +</div> +</div> +<div class="literalblock"> +<div class="content"> +<pre>T get(); +T getNewValue(); +T evaluateValue(); +T commitAndGet(); +void commit(); +void discard(); +boolean updateValue();</pre> +</div> +</div> +<div class="literalblock"> +<div class="content"> +<pre>void setUpdatePolicy(UpdatePolicy updatePolicy); +UpdatePolicy getUpdatePolicy(); +void addListener(PropertyChangeListener l); +void removeListener(PropertyChangeListener l);</pre> +</div> +</div> +<div class="literalblock"> +<div class="content"> +<pre>boolean isPresent(); +T orElse(T other); +// Enabled with Java 8 +// T orElseGet(ConfiguredItemSupplier<? extends T> other); +// <X extends Throwable> T orElseThrow(ConfiguredItemSupplier<? extends X> exceptionSupplier) throws X;</pre> +</div> +</div> +<div class="paragraph"> +<p>}</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>Summarizing this class looks somehow similar to the new +Optional+ class added with Java 8. It provides +a wrapper class around a configured instance. Additionally this class provides functionality that gives +active control, to manage a configured value based on a ++LoadingPolicy+: + +* +IMMEDEATE+ means that when the configuration system detects a change on the underlying value, the new value + is automatically applied without any further notice. +* +EXPLICIT+ means that a new configuration value is signalled by setting the +newValue+ property. if +getNewValue()+ + returns a non null value, the new value can be applied by calling +commit()+. You can always access the newest value, + hereby implicitly applying it, by accessing it via +commitAndGet()+. Also it is possible ti ignore a change by calling + +discard()+. +* +NEVER+ means the configured value is evaluated once and never updated. All changes are silently discarded. +* +LOG_AND_DISCARD+ similar to +NEVER+, but changes are logged before they are discarded. + +Summarizing a +DynamicValue+ allows you + +* to reload actively updates of configured values. +* update implicitly or explicitly all changes on the value. +* add listeners that observe changes of a certain value. + +Dynamic values also allow on-the-fly reevaluation of the value by calling +evaluateValue()+. Hereby the value of the +instance is not changed. + + +==== Ommitting Injection using @NoConfig + +Adding the @NoConfig annotation prevents a field or method to be auto-injected from +configuration. This is especially useful, if a type is annotated as @ConfigAutoInject with auto-confiuration +turned on as follows: + +[source,java]</pre> +</div> +</div> +<div class="paragraph"> +<p>@ConfigAutoInject +pubic class ConfiguredItem{</p> +</div> +<div class="literalblock"> +<div class="content"> +<pre>@NoConfig +private transient int sum;</pre> +</div> +</div> +<div class="literalblock"> +<div class="content"> +<pre> private String a; + private String b; + Private String c; +}</pre> +</div> +</div> +<div class="listingblock"> +<div class="content"> +<pre>In this case the fields +a,b,c+ are configured, whereas the field +sum+ is ignored regarding +configuration. + +==== Adding custom operators using @WithConfigOperator + +The @WithConfigOperator annotation allows you define a class of type +ConfigOperator+, to being applied +to the final +Configuration+, BEFORE the value is injected. This can be used for various use cases, e.g. +filtering or validating the visible properties for a certain use case. + +[source,java]</pre> +</div> +</div> +<div class="paragraph"> +<p>@WithConfigOperator(MyConfigView.class) +pubic class ConfiguredItem{</p> +</div> +<div class="literalblock"> +<div class="content"> +<pre>@Config +private String a;</pre> +</div> +</div> +<div class="paragraph"> +<p>}</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>==== Adding custom property converters using @WithPropertyConverter + +The @WithPropertyConverter annotation allows you to define a class of type +PropertyConverter+, to be applied +on a property configured to convert the String value to the expected injected type. This can be used for +various use cases, e.g. adding custom formats, config models, decryption. + +[source,java]</pre> +</div> +</div> +<div class="paragraph"> +<p>pubic class ConfiguredItem{</p> +</div> +<div class="literalblock"> +<div class="content"> +<pre>@WithPropertyConverter(MyPropertyConverter.class) +@Config +private String a;</pre> +</div> +</div> +<div class="paragraph"> +<p>}</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>==== Defining the loading policy to be applied to configured values using @WithLoadPolicy + +The @WithLoadPolicy annotation allows to define the loading behaviour to be applied. The +LoadPolicy+ +enum hereby defines the various loading modes. + +[source,java]</pre> +</div> +</div> +<div class="paragraph"> +<p>@WithLoadPolicy(LoadPolicy.NEVER) +pubic class BootTimeStableConfig{</p> +</div> +<div class="literalblock"> +<div class="content"> +<pre>@WithPropertyConverter(MyPropertyConverter.class) +@Config +private String a;</pre> +</div> +</div> +<div class="paragraph"> +<p>}</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre>=== Configuration Events + +Similar to CDI Tamaya publishes Configuration events, when instances were configured. It depends on the effective +event backend in use, if and how events are published: + +* when you have the CDI extension active events are published using the default CDI event mechanism. +* in all other scenarios events are delegated to the +tamaya-events+ module, if available, +* if no event delegation is available no events are published. + +The event published is very simple: + +[source,java]</pre> +</div> +</div> +<div class="paragraph"> +<p>public interface ConfiguredType { + Class getType(); + String getName(); + Collection<ConfiguredField> getConfiguredFields(); + Collection<ConfiguredMethod> getConfiguredMethods(); + void configure(Object instance, Configuration config); +}</p> +</div> +<div class="paragraph"> +<p>public interface ConfiguredField { + Class<?> getType(); + Collection<String> getConfiguredKeys(); + String getName(); + String getSignature(); + Field getAnnotatedField(); + void configure(Object instance, Configuration config); +}</p> +</div> +<div class="paragraph"> +<p>public interface ConfiguredMethod { + Collection<String> getConfiguredKeys(); + Class<?>[] getParameterTypes(); + Method getAnnotatedMethod(); + String getName(); + String getSignature(); + void configure(Object instance, Configuration config); +}</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre></pre> +</div> +</div> +</div> +</div> +</div></p> + + <hr /> + </div> + </div> + <div> + <div id="push"></div> + + <div id="footer"> + <div class="container"> + <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> + | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> + at <span>2016-12-19</span> + </p> + <p> + <b>Disclaimer</b> + Apache Tamaya (incubating) is an effort undergoing + incubation at + The Apache Software Foundation (ASF), sponsored by + the name of Apache Incubator. Incubation is required of + all newly accepted projects until a further review indicates + that the infrastructure, communications, and decision making + process have stabilized in a manner consistent with other + successful ASF projects. While incubation status is not + necessarily a reflection of the completeness or stability of + the code, it does indicate that the project has yet to + be fully endorsed by the ASF.<br /> + <a href="http://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"><img class="incubator-logo" src="../../logos/egg-logo2.png"/></a> + </p> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="../../js/jquery-1.11.1.min.js"></script> + <script src="../../js/bootstrap.min.js"></script> + <script src="../../js/prettify.js"></script> + + </div> + </body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/cb3c154a/documentation/extensions/mod_jodatime.html ---------------------------------------------------------------------- diff --git a/documentation/extensions/mod_jodatime.html b/documentation/extensions/mod_jodatime.html new file mode 100644 index 0000000..2eab0e3 --- /dev/null +++ b/documentation/extensions/mod_jodatime.html @@ -0,0 +1,223 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta charset="utf-8"/> + <title>Apache Tamaya&#8201;&#8212;&#8201;Extension: JodaTime</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + <meta name="description" content=""/> + <meta name="author" content=""/> + <meta name="keywords" content=""/> + <meta name="generator" content="'JBake '+'${version}"/> + + <!-- Le styles --> + <link href="../../css/bootstrap.min.css" rel="stylesheet"/> + <link href="../../css/asciidoctor.css" rel="stylesheet"/> + <link href="../../css/base.css" rel="stylesheet"/> + <link href="../../css/prettify.css" rel="stylesheet"/> + + <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="../../js/html5shiv.min.js"></script> + <![endif]--> + + <!-- Fav and touch icons from ASF --> + <link rel="shortcut icon" href="../../favicon.ico"/> + <link rel="apple-touch-icon" sizes="57x57" href="../../favicons/apple-touch-icon-57x57.png"/> + <link rel="apple-touch-icon" sizes="60x60" href="../../favicons/apple-touch-icon-60x60.png"/> + <link rel="apple-touch-icon" sizes="72x72" href="../../favicons/apple-touch-icon-72x72.png"/> + <link rel="apple-touch-icon" sizes="76x76" href="../../favicons/apple-touch-icon-76x76.png"/> + <link rel="apple-touch-icon" sizes="114x114" href="../../favicons/apple-touch-icon-114x114.png"/> + <link rel="apple-touch-icon" sizes="120x120" href="../../favicons/apple-touch-icon-120x120.png"/> + <link rel="apple-touch-icon" sizes="144x144" href="../../favicons/apple-touch-icon-144x144.png"/> + <link rel="apple-touch-icon" sizes="152x152" href="../../favicons/apple-touch-icon-152x152.png"/> + <link rel="apple-touch-icon" sizes="180x180" href="../../favicons/apple-touch-icon-180x180.png"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-32x32.png" sizes="32x32"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-194x194.png" sizes="194x194"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-96x96.png" sizes="96x96"/> + <link rel="icon" type="image/png" href="../../favicons/android-chrome-192x192.png" sizes="192x192"/> + <link rel="icon" type="image/png" href="../../favicons/favicon-16x16.png" sizes="16x16"/> + <link rel="manifest" href="../../favicons/manifest.json"/> + <link rel="shortcut icon" href="../../favicons/favicon.ico"/> + <meta name="msapplication-TileColor" content="#603cba"/> + <meta name="msapplication-TileImage" content="../../favicons/mstile-144x144.png"/> + <meta name="msapplication-config" content="../../favicons/browserconfig.xml"/> + <meta name="theme-color" content="#303284"/> + </head> + <body onload="prettyPrint()"> + <div id="wrap"> + <div> + + <!-- Fixed navbar --> + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="../../">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../index.html">Home</a></li> + <li><a href="../../about.html">About</a></li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../documentation/usecases.html">Use Cases and Requirements</a></li> + <li><a href="../../documentation/quickstart.html">Quickstart</a></li> + <li><a href="../../documentation/api.html">API</a></li> + <li><a href="../../documentation/core.html">Core</a></li> + <li><a href="../../documentation/extensions.html">Extension Guide</a></li> + <li class="divider"></li> + <li><a href="../../apidocs/index.html">Javadoc ${tamaya_version} (external)</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Development <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../development/source.html">Sources</a></li> + <li><a href="../../development/community.html">Community</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + </ul> + </li> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Releases <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="../../download.html">Download</a></li> + <li><a href="../../history.html">Release History</a></li> + </ul> + </li> +<!-- Example: + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> + <ul class="dropdown-menu"> + <li><a href="#">Action</a></li> + <li><a href="#">Another action</a></li> + <li><a href="#">Something else here</a></li> + <li class="divider"></li> + <li class="dropdown-header">Nav header</li> + <li><a href="#">Separated link</a></li> + <li><a href="#">One more separated link</a></li> + </ul> + </li> +--> + <li><a href="../../sitemap.xml">Sitemap</a></li> + <li><a href="../../feed.xml">Subscribe</a></li> + </ul> + </div><!--/.nav-collapse --> + </div> + </div> + + </div> + <div class="container"> + + <div class="page-header"> + <h1>Apache Tamaya&#8201;&#8212;&#8201;Extension: JodaTime</h1> + </div> + + <p><em>2016-12-19</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Core">Tamaya JodaTime (Extension Module)</h2> +<div class="sectionbody"> +<div class="sect2"> +<h3 id="_overview">Overview</h3> +<div class="paragraph"> +<p>Tamaya JodaTime is an extension module to support the usage of <a href="http://www.joda.org/joda-time/">Joda-Time</a> +in conjunction with Tamaya. Tamaya JodaTime defines some additional property +converters to retrieve Joda-Time types from a given configuration.</p> +</div> +<div class="paragraph"> +<p>Refer to the <a href="modules.html">extensions documentation</a> for further details +about modules.</p> +</div> +<div class="paragraph"> +<p>tools to locate resources in your classpath or file system based on descriptive +ant-styled resource patterns. To use this module add the following dependency:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-listing" data-lang="listing"><dependency> + <grooupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-jodatime</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +<div class="paragraph"> +<p>After adding this dependency to your project you can retrieve +Joda-Time based values directly from a given configuration.</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">Configuration configuration = ConfigurationProvider.getConfiguration(); + +DateTime pit = configuration.get("pointInTime", DateTime.class)</code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_specifying_date_and_time_values">Specifying date and time values</h3> +<div class="paragraph"> +<p>To be written.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_specifing_periods_and_durations">Specifing periods and durations</h3> +<div class="paragraph"> +<p>To be written.</p> +</div> +</div> +</div> +</div></p> + + <hr /> + </div> + </div> + <div> + <div id="push"></div> + + <div id="footer"> + <div class="container"> + <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> + | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> + at <span>2016-12-19</span> + </p> + <p> + <b>Disclaimer</b> + Apache Tamaya (incubating) is an effort undergoing + incubation at + The Apache Software Foundation (ASF), sponsored by + the name of Apache Incubator. Incubation is required of + all newly accepted projects until a further review indicates + that the infrastructure, communications, and decision making + process have stabilized in a manner consistent with other + successful ASF projects. While incubation status is not + necessarily a reflection of the completeness or stability of + the code, it does indicate that the project has yet to + be fully endorsed by the ASF.<br /> + <a href="http://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"><img class="incubator-logo" src="../../logos/egg-logo2.png"/></a> + </p> + </div> + </div> + + <!-- Le javascript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="../../js/jquery-1.11.1.min.js"></script> + <script src="../../js/bootstrap.min.js"></script> + <script src="../../js/prettify.js"></script> + + </div> + </body> +</html>