http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/4176b5bc/documentation/extensions/mod_etcd.html ---------------------------------------------------------------------- diff --git a/documentation/extensions/mod_etcd.html b/documentation/extensions/mod_etcd.html new file mode 100644 index 0000000..64307a6 --- /dev/null +++ b/documentation/extensions/mod_etcd.html @@ -0,0 +1,381 @@ +<!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: Integration with etcd (Core OS)</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: Integration with etcd (Core OS)</h1> + </div> + + <p><em>2016-12-18</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Optional">Integration with etcd (Extension Module)</h2> +<div class="sectionbody"> +<div class="sect2"> +<h3 id="_overview">Overview</h3> +<div class="paragraph"> +<p>The Tamaya etcd integration module provides different artifacts which allows integration of Apachae Tamaya +configuration with etcd. Basically the module supports read-only integration (as a EtcdPropertySource as well +as a support for MutableConfiguration as defined by the tamaya-mutable-config extension module.</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-etcd</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>ETcd integration comes basically with 2 artifacts:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>The org.apache.tamaya.etcd.EtcdAccessor can be configured with a an url targeting an etcd server’s REST endpoint root. +(org.apache.tamaya.etcd.EtcdAccessor). The accessor basically provides a simple Java API for communicating +with etcd server. The accessor hereby allows reading of single properties, or whole subtrees. Also the basic non +atomic write methods are implemented.</p> +</li> +<li> +<p>The org.apache.tamaya.etcd.EtcdPropertySource is a PropertySource with a default ordinal of 100 and the name +'etcd', which is automatically registered.</p> +</li> +<li> +<p>If the tamaya-mutable-config module is loaded it is possible to write property values back into the etcd cluster, +by accessing a MutableConfiguration using the URI config:etcd.</p> +</li> +</ul> +</div> +</div> +<div class="sect2"> +<h3 id="_the_etcdaccessor">The EtcdAccessor</h3> +<div class="paragraph"> +<p>The accessor mentioned implements the basic read and write API for communicating with an etcd configuration cluster. +Hereby the accessor also provides etcd specific data such as createdIndex, modifiedIndex, ttl in the Map +returned. Hereby the concept of etcd is used where keys starting with an '_' will be hidden from the overall +properties map, being only directly/explicitly accessible:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public class EtcdAccessor { + + /** + * Creates a new instance with the basic access url. + * @param server server url, e.g. {@code http://127.0.0.1:4001}. + * @throws MalformedURLException + */ + public EtcdAccessor(String server) throws MalformedURLException; + + /** + * Get the etcd server version. + * @return the etcd server version, never null. + */ + public String getVersion(); + + /** + * Ask etcd for s aingle key, value pair. Hereby the response returned from etcd: + * <pre> + * key=value + * _key.source=[etcd]http://127.0.0.1:4001 + * _key.createdIndex=12 + * _key.modifiedIndex=34 // optional + * _key.ttl=300 // optional + * _key.expiration=... // optional + * </pre> + * @param key the requested key + * @return the mapped result, including meta-entries. + */ + public Map<String,String> get(String key); + + /** + * Creates/updates an entry in etcd without any ttl set. + * The response is as follows: + * <pre> + * key=value + * _key.source=[etcd]http://127.0.0.1:4001 + * _key.createdIndex=12 + * _key.modifiedIndex=34 // optional + * _key.prevNode.createdIndex=12 // optional + * _key.prevNode.modifiedIndex=34 // optional + * </pre> + * @param key the property key, not null + * @param value the value to be set + * @return the result map as described above. + */ + public Map<String,String> set(String key, String value); + + /** + * Creates/updates an entry in etcd. The response is as follows: + * <pre> + * key=value + * _key.source=[etcd]http://127.0.0.1:4001 + * _key.createdIndex=12 + * _key.modifiedIndex=34 // optional + * _key.ttl=300 // optional + * _key.expiry=... // optional + * _key.prevNode.createdIndex=12 // optional + * _key.prevNode.modifiedIndex=34 // optional + * _key.prevNode.ttl=300 // optional + * _key.prevNode.expiration=... // optional + * </pre> + * @param key the property key, not null + * @param value the value to be set + * @param ttlSeconds the ttl in seconds (optional) + * @return the result map as described above. + */ + public Map<String,String> set(String key, String value, Integer ttlSeconds); + + + /** + * Deletes a given key. The response is as follows: + * <pre> + * _key.source=[etcd]http://127.0.0.1:4001 + * _key.createdIndex=12 + * _key.modifiedIndex=34 + * _key.ttl=300 // optional + * _key.expiry=... // optional + * _key.prevNode.createdIndex=12 // optional + * _key.prevNode.modifiedIndex=34 // optional + * _key.prevNode.ttl=300 // optional + * _key.prevNode.expiration=... // optional + * _key.prevNode.value=... // optional + * </pre> + * @param key the key to be deleted. + * @return the response mpas as described above. + */ + public Map<String,String> delete(String key); + + + /** + * Access regular Tamaya properties map as follows: + * <pre> + * key1=myvalue + * _key1.source=[etcd]http://127.0.0.1:4001 + * _key1.createdIndex=12 + * _key1.modifiedIndex=34 // optional + * _key1.ttl=300 // optional + * _key1.expiration=... // optional + * + * key2=myvaluexxx + * _key2.source=[etcd]http://127.0.0.1:4001 + * _key2.createdIndex=12 + * + * key3=val3 + * _key3.source=[etcd]http://127.0.0.1:4001 + * _key3.createdIndex=12 + * _key3.modifiedIndex=2 + * </pre> + */ + public Map<String,String> getProperties(String directory, boolean recursive); + +}</code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_the_etcdpropertysource">The EtcdPropertySource</h3> +<div class="paragraph"> +<p>The EtcdPropertySource is automatically registered and allows to configure the etcd servers to be used. This +enables to use e.g. in Docker environments the docker environment configuration mechanisms to configure Tamaya running +in microservice containers to connect with the according etcd cluster:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>The property source reads the tamaya.etcd.server.urls system and environment property to evaluate possible etcd servers +(comma separated), which can be connected to. On error the API just performs a Round-Robin through the list of +configured servers. Without any configuration http://127.0.0.1:4001 is used. If no connection to any etcd +server can be established a warning will be logged, but deployment will not fail.</p> +</li> +<li> +<p>Additinoally also the +accessor allows to configure the socket/connection timeouts by setting tamaya.etcd.timeout in seconds either as +system or environment property.</p> +</li> +<li> +<p>The EtcdPropertySource finally also allows the values read from the etcd cluster to be mapped to prefixed +context. This can be activated by setting the -Dtamaya.etcd.prefix=<PREFIX> system property. E.g. when the prefix is +set to cluster-config. a etcd key of host:known/all is mapped to cluster-config.host:known/all.</p> +</li> +</ul> +</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-18</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/4176b5bc/documentation/extensions/mod_events.html ---------------------------------------------------------------------- diff --git a/documentation/extensions/mod_events.html b/documentation/extensions/mod_events.html new file mode 100644 index 0000000..9133ecd --- /dev/null +++ b/documentation/extensions/mod_events.html @@ -0,0 +1,504 @@ +<!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: Events</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: Events</h1> + </div> + + <p><em>2016-12-18</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Core">Tamaya Events (Extension Module)</h2> +<div class="sectionbody"> +<div class="sect2"> +<h3 id="_overview">Overview</h3> +<div class="paragraph"> +<p>Tamaya Events 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 Events provides an abstraction for events like change events, when configuration has been changed.</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>To benefit from configuration event 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-events</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_core_architecture">Core Architecture</h3> +<div class="paragraph"> +<p>The core of the module are the ConfigEventListener interface and the ConfigEvent class, which defines an abstraction +for event handling and observation:</p> +</div> +<div class="listingblock"> +<div class="title">ConfigEvent</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final interface ConfigEvent<T> { + + Class<T> getResourceType(); + T getResource(); + String getVersion(); + long getTimestamp(); +} + +// @FunctionalInterface +public interface ConfigEventListener { + + void onConfigEvent(ConfigEvent<?> event); + +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>This mechanism can now be used to propagate configuration changes to all interested stakeholders. Hereby the payload +can be basically arbitrary as long as it implements the ConfigEvent interface. The next sections +give more details on the the provided event types and their usage.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_modelling_configuration_changes">Modelling Configuration Changes</h3> +<div class="paragraph"> +<p>This module provides a serializable and thread-safe abstraction modlling a configuration change. A change hereby may +be</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>additional configuration entries</p> +</li> +<li> +<p>removed configuration entries</p> +</li> +<li> +<p>changes on entries</p> +</li> +</ul> +</div> +<div class="paragraph"> +<p>The most important event modelled is the ConfigurationChange class, which implements the event sent for a changed +Configuration:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final class ConfigurationChange implements ConfigEvent<Configuration>, Serializable{ + + public static ConfigurationChange emptyChangeSet(Configuration configuration); + + @Override + public Configuration getResource(); + @Override + public Class<Configuration> getResourceType(); + @Override + public String getVersion(); + @Override + public long getTimestamp(); + + // Event specific methods + + public Collection<PropertyChangeEvent> getChanges(); + public int getRemovedSize(); + public int getAddedSize(); + public int getUpdatedSize(); + + public boolean isKeyAffected(String key); + public boolean isRemoved(String key); + public boolean isAdded(String key); + public boolean isUpdated(String key); + public boolean containsKey(String key); + public boolean isEmpty(); +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>New instances of this class hereby can be created using a fluent builder:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">Configuration config = ...; +ConfigurationChange change = ConfigurationChangeBuilder.of(config) + .addChange("MyKey", "newValue") + .removeKeys("myRemovedKey").build();</code></pre> +</div> +</div> +<div class="paragraph"> +<p>Also it is possible to directly compare 2 instances of configurations to create ConfigurationChange that +reflect the differences between the two configurations:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">Comparing 2 configurations +------------------------------------------------------- +Configuration config = ...; +Configuration changedConfig = ...; +ConfigurationChange change = ConfigurationChangeBuilder.of(config) + .addChanges(changedConfig).build(); +-------------------------------------------------------</code></pre> +</div> +</div> +<div class="paragraph"> +<p>So a ConfigurationChange allows you to evaluate the changes on a configuration. This allows you to listen to changes +and react in your client code as useful, once you encounter changes that are relevant to you, e.g. by reconfiguring +your component. For listening to configuration changes you must implement the +ConfigEventListener functional interface:</p> +</div> +<div class="listingblock"> +<div class="title">Implementing a ConfigChangeListener</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final class MyConfigChangeListener implements ConfigChangeListener<ConfigurationChange>{ + + private Configuration config = ConfigurationProvider.getConfiguration(); + + public void onConfigEvent(ConfigEvent<?> event){ + if(event.getResourceTspe()==Configuration.class){ + if(event.getConfiguration()==config){ + // do something + } + } + } + +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>You can <strong>register</strong> your implementation in 2 ways:</p> +</div> +<div class="olist arabic"> +<ol class="arabic"> +<li> +<p>Manually by calling ConfigEventManager.addListener(new MyConfigChangeListener())</p> +</li> +<li> +<p>Automatically by registering your listener using the ServiceLoader under +META-INF/services/org.apache.tamaya.events.ConfigEventListener</p> +</li> +</ol> +</div> +</div> +<div class="sect2"> +<h3 id="_modelling_propertysource_changes">Modelling PropertySource Changes</h3> +<div class="paragraph"> +<p>Beside that a whole configuration changes, also PropertySource instances can change, e.g. by a configuration file +edited on the fly. This is similarly to a ConfigurationChange reflected by the classes PropertySourceChange, +PropertySourceChangeBuilder.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_the_configeventmanager_singleton">The ConfigEventManager Singleton</h3> +<div class="paragraph"> +<p>Main entry point of the events module is the ConfigEventManager singleton class, which provides static accessor +methods to the extension’s functionality:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>Adding/removing of ConfigChangeListener instances, either globally or per event type.</p> +</li> +<li> +<p>Firing configuration events synchronously or asyncronously (mostly called by framework code).</p> +</li> +<li> +<p>Configuring the monitor that periodically checks for changes on the global Configuration provided +by ConfigurationProvider.getConfiguration().</p> +</li> +</ul> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final class ConfigEventManager { + + private ConfigEventManager() {} + + public static void addListener(ConfigEventListener l); + public static <T extends ConfigEvent> void addListener(ConfigEventListener l, Class<T> eventType); + public static void removeListener(ConfigEventListener l); + public static <T extends ConfigEvent> void removeListener(ConfigEventListener l, Class<T> eventType); + public static <T extends ConfigEvent> + Collection<? extends ConfigEventListener> getListeners(); + public static <T extends ConfigEvent> + Collection<? extends ConfigEventListener> getListeners(Class<T> type); + + public static <T> void fireEvent(ConfigEvent<?> event); + public static <T> void fireEventAsynch(ConfigEvent<?> event); + + public static void enableChangeMonitoring(boolean enable); + public static boolean isChangeMonitoring(); + public long getChangeMonitoringPeriod(); + public void setChangeMonitoringPeriod(long millis); + +}</code></pre> +</div> +</div> +<div class="sect3"> +<h4 id="_monitoring_of_configuration_changes">Monitoring of configuration changes</h4> +<div class="paragraph"> +<p>The ConfigEventManager also supports active monitoring of the current configuration to trigger corresponding change +events to listeners registered. This feature is deactivated by default, but can be enabled by calling +ConfigEventManager.enableChangeMonitoring(true);. This feature avoids regularly polling your local Configuration for +any kind of changes. If a change has been encountered Tamaya identifies it and triggers corresponding +ConfigurationChange events automatically.</p> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_freezing_configurations_and_propertysources">Freezing Configurations and PropertySources</h3> +<div class="paragraph"> +<p>Configuration instances as well as PropertySources are explicitly not required to be serializable. To enable easy +serialization of these types a Configuration's <strong>current state can be frozen</strong> (e.g. for later comparison with a newly +loaded version). Freezing hereby means</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>all key/values are read-out by calling the getProperties() method.</p> +</li> +<li> +<p>a meta data entry is added of the form _frozenAt=223273777652325677, whichdefines the UTC timestamp in +milliseconds when this instance was frozen.</p> +</li> +<li> +<p>if not already defined an _id property will be added to the Configuration containing the +identifier of the configuration.</p> +</li> +</ul> +</div> +<div class="paragraph"> +<p>In code freezing is a no-brainer:</p> +</div> +<div class="listingblock"> +<div class="title">Freezing the current Configuration</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">Configuration config = ConfigurationProvider.getConfiguration(); +Configuration frozenConfig = FrozenConfiguration.of(config);</code></pre> +</div> +</div> +<div class="olist lowerroman"> +<ol class="lowerroman" type="i"> +<li> +<p>and similarly for a PropertySource:</p> +</li> +</ol> +</div> +<div class="listingblock"> +<div class="title">Freezing the current Configuration</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">PropertySource propertySource = ...; +PropertySource frozenSource = FrozenPropertySource.of(propertySource);</code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_spis">SPIs</h3> +<div class="paragraph"> +<p>This component also defines an additional SPI, which allows to adapt the implementation of the main ConfigEventManager +singleton. This enables, for example, using external eventing systems, such as CDI, instead of the default provided +simple SE based implementation. As normal, implementation must be registered using the current ServiceContext +active, by default using the Java ServiceLoader mechanism.</p> +</div> +<div class="listingblock"> +<div class="title">SPI: ConfigEventSpi</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public interface ConfigEventManagerSpi { + + <T> void addListener(ConfigEventListener l); + <T extends ConfigEvent> void addListener(ConfigEventListener l, Class<T> eventType); + void removeListener(ConfigEventListener l); + <T extends ConfigEvent> void removeListener(ConfigEventListener l, Class<T> eventType); + Collection<? extends ConfigEventListener> getListeners(); + Collection<? extends ConfigEventListener> getListeners(Class<? extends ConfigEvent> eventType); + + void fireEvent(ConfigEvent<?> event); + void fireEventAsynch(ConfigEvent<?> event); + + long getChangeMonitoringPeriod(); + void setChangeMonitoringPeriod(long millis); + boolean isChangeMonitorActive(); + void enableChangeMonitor(boolean enable); +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>Summarizing with the events module you can easily observe configuration changes, record the +state of any configuration and compare configuration states to create and publish related +change events.</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-18</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/4176b5bc/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..87ad6df --- /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-18</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-18</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/4176b5bc/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..0a269e6 --- /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-18</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-18</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/4176b5bc/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..55204b6 --- /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-18</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-18</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>
