http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/97bc8884/extensions/mod_events.html ---------------------------------------------------------------------- diff --git a/extensions/mod_events.html b/extensions/mod_events.html deleted file mode 100644 index 1466d27..0000000 --- a/extensions/mod_events.html +++ /dev/null @@ -1,593 +0,0 @@ -<!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="../quickstart.html">Quickstart</a></li> - <li><a href="../index.html">Documentation</a></li> - <li><a href="..//apidocs/index.html">API</a></li> - <li><a href="../index.html">Development</a></li> - <li><a href="../index.html">Releases</a></li> - <li><a href="../about.html">About</a></li> - <li><a href="../sitemap.xml">Sitemap</a></li> - <li><a href="../feed.xml">Subscribe</a></li> -<!-- - <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> ---> - </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-10-31</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 bee 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>{tamayaVersion}</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 payloed -can be basically arbitrary as long as it implements the ConfigEvent interface. The next sections -give more details on the the provided event implementations and abstractions that are used to implement such -features.</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>This is also reflected in the ChangeType enum</p> -</div> -<div class="listingblock"> -<div class="content"> -<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public enum ChangeType { - NEW, - DELETED, - UPDATED, -}</code></pre> -</div> -</div> -<div class="paragraph"> -<p>This enum type is used within 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(); - @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 are 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 a matching ConfigurationChange -instance:</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. Of course, your code has to register itself to listen for appropriate changes by implementing -a ConfigEventListener:</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 instance 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="_modelling_configuration_context_changes">Modelling Configuration Context Changes</h3> -<div class="paragraph"> -<p>The ConfigurationContext models the container that manages all subcomponents that are used to define and -evalaute a Configuration. In the case where configuration is dynamically loaded, e.g. by observing changes on a -file folder, the ConfigurationContext may change, so a corresponding ConfigurationContextChange event is -defined:</p> -</div> -<div class="listingblock"> -<div class="content"> -<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final class ConfigurationContextChange implements ConfigEvent<ConfigurationContext>, Serializable{ - - public static ConfigurationContextChange emptyChangeSet(); - - @Override - public ConfigurationContext getResource(); - @Override - public Class<ConfigurationContext> getResourceType(); - @Override - public String getVersion(); - @Override - public long getTimestamp(); - - // specific methods - public Collection<PropertySourceChange> getPropertySourceChanges(); - public Collection<PropertySourceChange> getPropertySourceUpdates(); - public Collection<PropertySource> getRemovedPropertySources(); - public Collection<PropertySource> getAddedPropertySources(); - public Collection<PropertySource> getUpdatedPropertySources(); - public boolean isAffected(PropertySource propertySource); - public boolean isEmpty(); -}</code></pre> -</div> -</div> -<div class="paragraph"> -<p>Similar to the ConfigurationChange class you also must use a ConfigurationContextChangeBuilder to create instances -of ConfigurationContextChange.</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="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="paragraph"> -<p>Looking at the methods listed above you see that there is more functionality worth to be mentioned:</p> -</div> -<div class="ulist"> -<ul> -<li> -<p>ConfigCHangeListeners can be registered either <em>globally</em> or for a certain <em>event type</em> only.</p> -</li> -<li> -<p>ConfigEvents can be published within the same thread, or asynchronously.</p> -</li> -</ul> -</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 activated by default, but can be deactivated optionally. Nevertheless -this feature is quite handy, since regularly polling your local Configuration for any kind of changes is much -more simpler than implementing change management on the PropertySource level. With this feature you can easily -implement also remote property source, which can deliver different configuration based on any changes done remotedly -on another node in your system. If such a change happened Tamaya identifies it and triggers corresponding -+ConfigurationChange" events automatically. Similarly changes in a configuration tree, can actively identified and -broadcasted to the targeting nodes 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 as well as to fix a current state (e.g. for later comparison with a newly loaded instance) -Tamaya allows to <strong>freeze</strong> instances of these types. 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 [meta]frozenAt=223273777652325677, whichdefines the UTC timestamp in -milliseconds when this instance was frozen.</p> -</li> -</ul> -</div> -<div class="paragraph"> -<p>In code this is done easily as follows:</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 frozenConfig = FrozenConfiguration.of(ConfigurationProvider.getConfiguration());</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 frozenSource = FrozenPropertySource.of(ConfigurationProvider.getConfiguration());</code></pre> -</div> -</div> -</div> -<div class="sect2"> -<h3 id="_modelling_of_an_observing_propertysourceprovider">Modelling of an observing PropertySourceProvider.</h3> -<div class="paragraph"> -<p>In Tamaya configuration data is provided by instances of PropertySource, which in case of a configuration directory -may be provided by an implementation of PropertySourceProvider, which produces one PropertySource (at least) per -file detected. The events module provides a base provider implementation that</p> -</div> -<div class="ulist"> -<ul> -<li> -<p>observes all changes in a Path</p> -</li> -<li> -<p>tries to reevaluate corresponding resources based on the ConfigurationFormats supported.</p> -</li> -<li> -<p>it creates an instance of ConfigurationContextChange reflecting the changed ConfigurationContext and triggers -this event by calling ConfigEventManager.fireEvent(contextChange);.</p> -</li> -</ul> -</div> -<div class="paragraph"> -<p>Additionally this module registers an instance of ConfigEventListener<ConfigurationContextChange>+, which listenes to -these events. If such an event is triggered the listener tries to apply the changes by</p> -</div> -<div class="olist arabic"> -<ol class="arabic"> -<li> -<p>accessing the current Configuration and its ConfigurationContext</p> -</li> -<li> -<p>checking if the event is affecting the current ConfigurationContext.</p> -</li> -<li> -<p>in the case the current context is affected, based on the current ConfigurationContext a new context is created, -whereas</p> -<div class="olist loweralpha"> -<ol class="loweralpha" type="a"> -<li> -<p>all PropertySources provided by this provider implementation type are removed.</p> -</li> -<li> -<p>the new PropertySources loaded are added.</p> -</li> -</ol> -</div> -</li> -<li> -<p>Finally the listener tries to apply the new ConfigurationContext by calling the corresponding API methods of the -ConfigurationProvider:</p> -</li> -</ol> -</div> -<div class="listingblock"> -<div class="content"> -<pre class="prettyprint highlight"><code class="language-java" data-lang="java">try { - ConfigurationProvider.setConfigurationContext(newContext); -} catch (Exception e) { - LOG.log(Level.INFO, "Failed to update the current ConfigurationContext due to config model changes", e); -}</code></pre> -</div> -</div> -<div class="paragraph"> -<p>So if the current ConfigurationProvider supports reloading of the current ConfigurationContext this will apply the -changes to the current Configuration. Otherwise the change is logged, but no further actions are taken.</p> -</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 mus 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> -</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-11-02</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/97bc8884/extensions/mod_filter.html ---------------------------------------------------------------------- diff --git a/extensions/mod_filter.html b/extensions/mod_filter.html deleted file mode 100644 index 5df5d0b..0000000 --- a/extensions/mod_filter.html +++ /dev/null @@ -1,278 +0,0 @@ -<!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="../quickstart.html">Quickstart</a></li> - <li><a href="../index.html">Documentation</a></li> - <li><a href="..//apidocs/index.html">API</a></li> - <li><a href="../index.html">Development</a></li> - <li><a href="../index.html">Releases</a></li> - <li><a href="../about.html">About</a></li> - <li><a href="../sitemap.xml">Sitemap</a></li> - <li><a href="../feed.xml">Subscribe</a></li> -<!-- - <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> ---> - </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-10-31</em></p> - - <p><div id="preamble"> -<div class="sectionbody"> -<!-- toc disabled --> -</div> -</div> -<div class="sect1"> -<h2 id="Optional">COnfiguration 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 -explcitily 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>{tamayaVersion}</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 1 artifact:</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 1PropertyFilters+ 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 setMetadataFilter(boolean active); - - /** - * Access the filtering configuration that is used for filtering single property values accessed. - * @return the filtering config, never null. - */ - public static ProgrammableFilter getSingleFilters(); - - /** - * Access the filtering configuration that is used for filtering configuration properties accessed as full - * map. - * @return the filtering config, never null. - */ - public static ProgrammableFilter 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 RegexPropertyFilter("\\_.*")); - - // do your code with filtering active -} -finally{ - // cleanup - ConfigurationFilter.clearFilters(); -}</code></pre> -</div> -</div> -<div class="paragraph"> -<p>The ProgrammableFilter 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 ProgrammableFilter implements PropertyFilter{ - - public void addFilter(PropertyFilter filter); - public void addFilter(int pos, PropertyFilter filter); - public PropertyFilter removeFilter(int pos); - public void clearFilters(); - public void setFilters(PropertyFilter... filters); - public void setFilters(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-11-02</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/97bc8884/extensions/mod_formats.html ---------------------------------------------------------------------- diff --git a/extensions/mod_formats.html b/extensions/mod_formats.html deleted file mode 100644 index f49510f..0000000 --- a/extensions/mod_formats.html +++ /dev/null @@ -1,476 +0,0 @@ -<!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="../quickstart.html">Quickstart</a></li> - <li><a href="../index.html">Documentation</a></li> - <li><a href="..//apidocs/index.html">API</a></li> - <li><a href="../index.html">Development</a></li> - <li><a href="../index.html">Releases</a></li> - <li><a href="../about.html">About</a></li> - <li><a href="../sitemap.xml">Sitemap</a></li> - <li><a href="../feed.xml">Subscribe</a></li> -<!-- - <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> ---> - </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-10-31</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>{tamayaVersion}</version> -</dependency></code></pre> -</div> -</div> -<div class="paragraph"> -<p>The module automatically registers an according PropertyFilter that is automatically called, whenever a value -is accessed.</p> -</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 simpley 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 Map<String,Map<String,String>> getSections(); - - public boolean hasDefaultProperties(); - public Map<String,String> getDefaultProperties(); - - public Map<String,String> getCombinedProperties(); - public boolean hasCombinedProperties(); - - 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.</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 dot 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 class="paragraph"> -<p>Now for the conversion of ConfigurationData into a PropertySource different default approaches are used:</p> -</div> -<div class="olist arabic"> -<ol class="arabic"> -<li> -<p>The ConfigurationFormat that read the data can provide the (combined) properties accessible from -getProperties() explcitly, which can be used to initialize a single PropertySource containing the data read.</p> -</li> -<li> -<p>If the format did not set the final properties, but only a default section is present this default section -can be directly returned as combined properties.</p> -</li> -<li> -<p>In all other cases a properties can be uniquely mapped into one single properties Map, by prefixing all keys of each -section present with the (unique) section name and a '.' separator.</p> -</li> -</ol> -</div> -<div class="paragraph"> -<p>Nevertheless, depending on the context, where a configuration source was read (classloader, time, source etc.) the -resulting PropertySource can have different semnatics, especially for the PropertySources ordinal. 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 useful default mapping -can be defined. In such cases this functionality must be implemented in a <em>mapData</em> method, which converts -the normalized ConfigData read to the appropriate collection of PropertySource instances:</p> -</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 { - - public String getName(); - boolean accepts(URL url); - ConfigurationData readConfiguration(String resource, InputStream inputStream); -}</code></pre> -</div> -</div> -<div class="paragraph"> -<p>Normally you need to map the resulting ConfigurationData to one or multiple PropertySources. In case, where the -properties provided match exactly the extected properties a FlattenedDefaultPropertySource is provided out-of-the-box. -If the exact mapping must be overridden, you can simply override the property source’s initialize method to adapt the -mapping:</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> -</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>The Tamaya main building block for configuration properties is the PropertySource interface. You have several -options to implement this tranformation:</p> -</div> -<div class="olist arabic"> -<ol class="arabic"> -<li> -<p>You can simply map the properties returned by getCombinedProperties() and use them as properties returned by a -wrapping property source. Since this use case is common for all kind of non hierarchic configuration formats it -is directly supported by the FlattenedDefaultPropertySource class.</p> -</li> -<li> -<p>When the ConfigurationFormat is more complex, multiple 'sections' are common. What a section exactly is depends on -the concrete format only. The ConfigurationFormat should provide detailed information how the data read is -mapped to default properties and sections and how it is assembled into the combinedProperties map. Also here -the FlattenedDefaultPropertySource class can help you with its default mapping. Nevertheless in some cases it is -necessary to write an explicit mapping, e.g. when</p> -</li> -<li> -<p>different sections must be mapped to multiple PropertySources, with optionally fixed ordinals.</p> -</li> -<li> -<p>sections must be cross-checked and combined into new properties, or into several PropertySources.</p> -</li> -<li> -<p>other complex mapping requirements apply.</p> -</li> -</ol> -</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-11-02</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/97bc8884/extensions/mod_functions.html ---------------------------------------------------------------------- diff --git a/extensions/mod_functions.html b/extensions/mod_functions.html deleted file mode 100644 index ced3acb..0000000 --- a/extensions/mod_functions.html +++ /dev/null @@ -1,315 +0,0 @@ -<!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="../quickstart.html">Quickstart</a></li> - <li><a href="../index.html">Documentation</a></li> - <li><a href="..//apidocs/index.html">API</a></li> - <li><a href="../index.html">Development</a></li> - <li><a href="../index.html">Releases</a></li> - <li><a href="../about.html">About</a></li> - <li><a href="../sitemap.xml">Sitemap</a></li> - <li><a href="../feed.xml">Subscribe</a></li> -<!-- - <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> ---> - </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-10-31</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>{tamayaVersion}</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-11-02</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>
