http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/8e3904a8/documentation-new/extensions/mod_cdi.html ---------------------------------------------------------------------- diff --git a/documentation-new/extensions/mod_cdi.html b/documentation-new/extensions/mod_cdi.html new file mode 100644 index 0000000..cb1ebb3 --- /dev/null +++ b/documentation-new/extensions/mod_cdi.html @@ -0,0 +1,469 @@ +<!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 - Extension: CDI Support</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="../../index.html">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../start.html">Tamaya in 5 minutes</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/stable/index.html">Javadoc 0.3-incubating (release/stable)</a></li> + <li><a href="../../apidocs/development/index.html">Javadoc 0.4-incubating-SNAPSHOT (development)</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="../../development/team.html">Project Team</a></li> + <li><a target="_blank" href="https://builds.apache.org/view/S-Z/view/Tamaya/">CI / ASF Jenkins</a></li> + <li><a target="_blank" href="https://issues.apache.org/jira/browse/TAMAYA">Issues / ASF Jira</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + <li class="divider"></li> + <li><a href="../../development/possible-contributions.html">Possible Contributions</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 - Extension: CDI Support</h1> + </div> + + <p><em>2018-04-26</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="CDI">Tamaya CDI Integration (Extension Modules)</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>Tamaya <em>CDI</em> is an extension module. Refer to the <a href="../extensions.html">extensions documentation</a> for further details.</p> +</div> +<div class="sect2"> +<h3 id="_what_functionality_this_module_provides">What functionality this module provides ?</h3> +<div class="paragraph"> +<p>Apache <em>CDI</em> provides integration with CDI:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>Loading of CDI managed SPI components as configuration extensions such as ConfigSources, ConfigSourceProviders, +Converters, Filters, etc. This also includes SPI defined by any Tamaya submodules. +This is useful when Tamaya is used as an application module managed by the CDI implementation.</p> +</li> +<li> +<p>Implement and enable Tamaya’s configuration injection services (either using CDI injection or +Tamaya’s standalone injection module.</p> +</li> +</ul> +</div> +<div class="paragraph"> +<p>Hereby there are two implementations provided:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>tamaya-injection-cdi implements injection by using CDI’s injection mechanism to inject configuration values into the +beans managed by the CDI systems.</p> +</li> +<li> +<p>tamaya-injection-standalone implements injection by integrating the tamaya-injection SE based injection module (also used +for Spring and OSGI injection) with CDI. Injection hereby is performed by the Tamaya SE module, whereas +beans and injection control overall are still managed by CDI.</p> +</li> +<li> +<p>One difference, of course, is that tamaya-injection-standalone also provides an SE compatible API (ConfigurationInjection, +ConfigurationInjector), which is not available, when using the purely CDI based variant.</p> +</li> +</ul> +</div> +<div class="paragraph"> +<p>Most annotations used are defined as part of the Config JSR API, whereas Tamaya adds additional features not available +in the JSR as separate modules. This allows you to code against the injection API without dependency on the concrete +injection implementation. As a consequence your components will be compatible regardless if deployed in a pure SE or as +Java EE (CDI) or Spring environment:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre><dependency> + <groupId>javax.config</groupId> + <artifactId>config-api</artifactId> + <version>{config_api_version}</version> +</dependency> +<dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-injection-api</artifactId> + <version>{tamaya_version}</version> +</dependency></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>All modules are based on Java 8, so they will not run on Java 8 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>To benefit from Tamaya CDI integration you only must one of the following dependencies to your module. Ensure that +you never have installed both CDI extensions at the same time because this may be lead to unforseen side-effects.</p> +</div> +<div class="listingblock"> +<div class="title">CDI Java EE Application Configuration</div> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-cdi</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +<div class="paragraph"> +<div class="title">To use Tamaya’s <em>standalone injection support</em>, you additionally should add the</div> +<p>following dependency. If this dependency is missing injection is purely based on +CDI injection features.</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-injection-standalone</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +<div class="paragraph"> +<p>Both components will auto-register its components and override the default ServicceContext in use. Additionally they +register CDI extensions that implement Configuration injection as described before.</p> +</div> +<div class="paragraph"> +<p>For working with a pure non Java EE environment have a look at the <a href="mod_injection-standalone.html">tamaya-injection-standalone module</a>.</p> +</div> +<div class="paragraph"> +<p>Additionally you have to register Tamaya’s CDI extension modules into your <code>beans-xml</code>:</p> +</div> +<div class="paragraph"> +<p>Contents of <code>META-INF/services/javax.enterprise.inject.spi.Extension</code>:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># Register Tamaya to perform injection +# org.apache.tamaya.cdi.TamayaCDIInjectionExtension +# org.apache.tamaya.cdi.TamayaSEInjectionExtension +org.apache.tamaya.cdi.TamayaCDIAccessor</code></pre> +</div> +</div> +<div class="paragraph"> +<p>If you want to use CDI standard injection (using @Inject @Config), activate +org.apache.tamaya.cdi.TamayaCDIInjectionExtension as a CDI extension.</p> +</div> +<div class="paragraph"> +<p>If you want to use SE based injection (using @Config <strong>without</strong> @Inject), +activate org.apache.tamaya.cdi.TamayaSEInjectionExtension instead of.</p> +</div> +<div class="paragraph"> +<p>Though not recommended, it is possible to activate both extension at the same time.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_annotating_your_classes">Annotating your Classes</h3> +<div class="paragraph"> +<p>Basically annotating your classes is stright forward. Depending +on the module deployed, your annotations are handled by a CDI producer (tamaya-cdi-ee) or the +Tamaya SE injection mechanism (tamaya-cdi-se). All types injected by this module are injected +using <em>dependent scope</em>.</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">@RequestScoped +public class ConfiguredClass{ + + @Config + private String testProperty; + + @Config(key="a.b.c.key1", + defaultValue="The current \\${JAVA_HOME} env property is ${env:JAVA_HOME}.") + String value1; + + @Config(key="foo") + private String value2; + + @Config(defaultValue="N/A") + private String runtimeVersion; + + @Config(defdaultValue="${sys:java.version}") + private String javaVersion2; + + @Config(defaultValue="5") + private Integer int1; + + ... + +}</code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_registering_cdi_managed_components_into_the_application_s_configurationcontext">Registering CDI managed components into the Application’s ConfigurationContext</h3> +<div class="paragraph"> +<p>As mentioned both modules allow to provide Tamaya SPI extensions modules as ordinary CDI managed beans. By default +extensions should be registered using @Singleton or @ApplicationScoped scope annotations. So you can define/deploy +additional application specific PropertySources and other artifacts simply by defining a CDI managed bean implementing +the required SPI interface:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">@Singleton +public class TestConfigSource implements ConfigSource{ + + final Map<String,String> config = new HashMap<>(); + + public TestConfigSource(){ + config.put("a.b.c.key1", "keys current a.b.c.key1"); + config.put("a.b.c.key2", "keys current a.b.c.key2"); + config.put("{"+getName()+"}source", getClass().getName()); + } + + @Override + public int getOrdinal() { + return 10; + } + + @Override + public String getName() { + return getClass().getName(); + } + + @Override + public String get(String key) { + return config.get(key); + } + + @Override + public Map<String, String> getProperties() { + return config; + } + +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>To enable this (optional) feature you must replace Tamaya’s ServiceContext with the +CDI aware implementation:</p> +</div> +<div class="paragraph"> +<p>Contents of <code>META-INF/services/org.apache.tamaya.spi.ServiceContext</code>:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># Registering a CDI aware service context +org.apache.tamaya.cdi.CDIAwareServiceContext</code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_advanced_use_cases">Advanced Use Cases</h3> +<div class="paragraph"> +<p>Beside basic configuration Tamaya also covers additional requirements:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>_Reading multiple keys, where the first successful one is determining the value of the configuration, is +simply possible, by defining additional keys with @ConfigFallbackKeys annotation. +E.g. for trying first a.b and then new.b you would configure it as follows:</p> +</li> +</ul> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">@Config(key="a.b") +@ConfigFallbackKeys({"new.b"}) +private String value;</code></pre> +</div> +</div> +<div class="ulist"> +<ul> +<li> +<p>When you must apply a some special conversion, or you use a type that is not registered +for conversion, you can configure a custom converter to be applied as follows:</p> +</li> +</ul> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">@Config(key="a.b") +@WithConverter(MyConverter.class) +private MySpecialFooType value;</code></pre> +</div> +</div> +<div class="ulist"> +<ul> +<li> +<p>Often multiple keys in a class belong to the same root section. So instead of copying this to +every entry you can define the most common root sections in the type’s header:</p> +</li> +</ul> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">@ConfigDefaultSections({"aaaa", "new"}); +public class MyType{ + +@Config(key="b"} +@ConfigFallbackKeys({"[legacy.bKey]"}) // lookups: "aaaa.b", "new.b", legacy.bKey +private String value;</code></pre> +</div> +</div> +<div class="paragraph"> +<p>In the example above legacy.bKey defines an absolute key, which is not combined with any defined +default section parts.</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-<span>2018</span> 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.1</span></a> + at <span>2018-04-26</span> | + <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/tamayaconf">Follow @tamayaconf</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> + </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. + Apache, Apache Tamaya, and the Apache Tamaya logo are registered trademarks or trademarks of The Apache Software Foundation in the U.S. and/or other countries.<br /> + <a href="https://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"> + <img class="incubator-logo" src="../../logos/apache-incubator.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/8e3904a8/documentation-new/extensions/mod_classloader_support.html ---------------------------------------------------------------------- diff --git a/documentation-new/extensions/mod_classloader_support.html b/documentation-new/extensions/mod_classloader_support.html new file mode 100644 index 0000000..63fa3a9 --- /dev/null +++ b/documentation-new/extensions/mod_classloader_support.html @@ -0,0 +1,290 @@ +<!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 - Extension: Classloader Isolation Support</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="../../index.html">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../start.html">Tamaya in 5 minutes</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/stable/index.html">Javadoc 0.3-incubating (release/stable)</a></li> + <li><a href="../../apidocs/development/index.html">Javadoc 0.4-incubating-SNAPSHOT (development)</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="../../development/team.html">Project Team</a></li> + <li><a target="_blank" href="https://builds.apache.org/view/S-Z/view/Tamaya/">CI / ASF Jenkins</a></li> + <li><a target="_blank" href="https://issues.apache.org/jira/browse/TAMAYA">Issues / ASF Jira</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + <li class="divider"></li> + <li><a href="../../development/possible-contributions.html">Possible Contributions</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 - Extension: Classloader Isolation Support</h1> + </div> + + <p><em>2018-04-26</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Classloader">Tamaya Classloader Aware ServiceContext (Extension Module)</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>Tamaya <em>Classloader</em> is an extension module. Refer to the <a href="../extensions.html">extensions documentation</a> for further details.</p> +</div> +<div class="sect2"> +<h3 id="_what_functionality_this_module_provides">What functionality this module provides ?</h3> +<div class="paragraph"> +<p>The Tamaya <em>Classloader</em> support provides an alternative implementation of java.util.ServiceLoader, which is aware +of classloaders, hereby preventing multiple loading of components within a classloader hierarchy.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>The module is based on Java 8, so it will not run on Java 8 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>To benefit from configuration server 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-classloader-support</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +<div class="paragraph"> +<p>The component will auto.register its components and override the default ServiceContext in use by default +with an instance of type org.apache.tamaya.clsupport.internal.CLAwareServiceContext with a precendence value +(component priority) of 10.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_how_it_works">How it works</h3> +<div class="paragraph"> +<p>Basically the component manages a Map of all classloaders encountered. When services are accessed, the component +will evaluate the services as follows:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>the component walks up the class loader hierarchy.</p> +</li> +<li> +<p>in a next step the hierarchy is traversed down from the parent to the current classloader. Hereby it is checked +if the service list for the required type has been loaded already. If not the service configuration files are +evaluated.</p> +</li> +<li> +<p>This configuration file evaluation will ignore all resources already loaded by any of the already traversed parent +classloaders.</p> +</li> +<li> +<p>For each configuration file newly visible to the classloader currently traversed, the corresponding services are +loaded unleyy, the same service class already has been loaded by one its parent classloaders or another file +loaded with this classloader.</p> +</li> +<li> +<p>Finally all services found are returned as the full collection of services valid for the given context (classloader).</p> +</li> +</ul> +</div> +<div class="paragraph"> +<p>This ensures no service is loaded multiple times, even when it is referenced multiple times in several service +configurations. Additionally every service is loaded on the classloader where it is also declared the first time.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_control_logging">Control Logging</h3> +<div class="paragraph"> +<p>The service component by default only logs errors. But it is possible to change this by reconfiguring the logging +levels on the following logging names/path: org.apache.tamaya.clsupport.internal.CLAwareServiceContext</p> +</div> +<div class="ulist"> +<ul> +<li> +<p><em>INFO</em> logs additional info on the services accessed.</p> +</li> +<li> +<p><em>FINEST</em> logs additional info on the services scanned and selected.</p> +</li> +</ul> +</div> +</div> +<div class="sect2"> +<h3 id="_classloader_aware_configuration">Classloader Aware Configuration</h3> +<div class="paragraph"> +<p>The mechanism above is used to provide a classloader aware implementation of ConfigurationContext +(org.apache.tamaya.clsupport.internal.CLAwareConfigurationContext). Similarly to the service variants +this class provides a context implementation that manages the core configuration aspects considering classloading +hierarchies:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>PropertySource, PropertySourceProviders</p> +</li> +<li> +<p>PropertyFilters, PropertyCombinationPolicy</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-<span>2018</span> 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.1</span></a> + at <span>2018-04-26</span> | + <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/tamayaconf">Follow @tamayaconf</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> + </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. + Apache, Apache Tamaya, and the Apache Tamaya logo are registered trademarks or trademarks of The Apache Software Foundation in the U.S. and/or other countries.<br /> + <a href="https://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"> + <img class="incubator-logo" src="../../logos/apache-incubator.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/8e3904a8/documentation-new/extensions/mod_collections.html ---------------------------------------------------------------------- diff --git a/documentation-new/extensions/mod_collections.html b/documentation-new/extensions/mod_collections.html new file mode 100644 index 0000000..1e0560e --- /dev/null +++ b/documentation-new/extensions/mod_collections.html @@ -0,0 +1,492 @@ +<!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 - Extension: Collection Support</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="../../index.html">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../start.html">Tamaya in 5 minutes</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/stable/index.html">Javadoc 0.3-incubating (release/stable)</a></li> + <li><a href="../../apidocs/development/index.html">Javadoc 0.4-incubating-SNAPSHOT (development)</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="../../development/team.html">Project Team</a></li> + <li><a target="_blank" href="https://builds.apache.org/view/S-Z/view/Tamaya/">CI / ASF Jenkins</a></li> + <li><a target="_blank" href="https://issues.apache.org/jira/browse/TAMAYA">Issues / ASF Jira</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + <li class="divider"></li> + <li><a href="../../development/possible-contributions.html">Possible Contributions</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 - Extension: Collection Support</h1> + </div> + + <p><em>2018-04-26</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Collections">Tamaya Collections Support (Extension Module)</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>Tamaya <em>Collections</em> is an extension module. Refer to the <a href="../extensions.html">extensions documentation</a> for further details.</p> +</div> +<div class="sect2"> +<h3 id="_what_functionality_this_module_provides">What functionality this module provides ?</h3> +<div class="paragraph"> +<p>All configuration in Tamaya is expressed as simple key, value pairs. Nevertheless this concept allows similarly +the modelling of collection typed values such as lists, sets, maps or simple collections of things. The Tamaya +Collections extension adds this functionality to the Tamaya eco-system.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>The module is based on Java 8, so it will not run on Java 8 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>To use Tamaya collection 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-collections</artifactId> + <version>{tamaya_version}</version> +</dependency></code></pre> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_overview">Overview</h3> +<div class="paragraph"> +<p>Tamaya Collections adds PropertyConverter implementations that are able to access configuration data +as <em>lists, maps</em> or <em>sets</em>. By default this works out of the box as easy as accessing any other type of +configuration data, e.g.</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-java" data-lang="java">Configuration config = ConfigurationProvider.getConfiguration(); + +// Without any content specification, a list of String is returned. +List<String> simpleList = config.get("my.list.config.entry", List.class); + +// Using a TypeLiteral allows to use every convertible sub type supported by the system. +List<Integer> intList = config.get("my.list.config.entry", new TypeLiteral<List<Integer>>(){});</code></pre> +</div> +</div> +<div class="paragraph"> +<p>Configuration in that case, by default, is a simple comma-separated list of entries, e.g.</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties">my.list.config.entry=1,34454,23,344545,3445</code></pre> +</div> +</div> +<div class="paragraph"> +<p>Additionally the module allows adding additional meta-entries, which allows to tweak some of the +inner-workings, e.g.</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>using your own PropertyConverter implementation for parsing entries.</p> +</li> +<li> +<p>specifying a custom separator to split the items (default is {{','}}.</p> +</li> +<li> +<p>specifying a custom separator to split key/value pairs when parsing map entries.</p> +</li> +<li> +<p>specifying the implementation type of the collection item to be returned.</p> +</li> +<li> +<p>specifying the implementation type of the collection to be returned.</p> +</li> +</ul> +</div> +</div> +<div class="sect2"> +<h3 id="_supported_types">Supported Types</h3> +<div class="paragraph"> +<p>This module currently supports the following types:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>java.util.Collection</p> +</li> +<li> +<p>java.util.List</p> +</li> +<li> +<p>java.util.ArrayList</p> +</li> +<li> +<p>java.util.LinkedList</p> +</li> +<li> +<p>java.util.Set</p> +</li> +<li> +<p>java.util.SortedSet</p> +</li> +<li> +<p>java.util.TreeSet</p> +</li> +<li> +<p>java.util.HashSet</p> +</li> +<li> +<p>java.util.Map</p> +</li> +<li> +<p>java.util.SortedMap</p> +</li> +<li> +<p>java.util.HashMap</p> +</li> +<li> +<p>java.util.TreeMap</p> +</li> +</ul> +</div> +<div class="paragraph"> +<p>Hereby the collection type is determined by the parameter type accessed, e.g. +config.get("mylist", ArrayList.class) will always return an ArrayList +as result.</p> +</div> +<div class="admonitionblock note"> +<table> +<tr> +<td class="icon"> +<div class="title">Note</div> +</td> +<td class="content"> +This means that depending on your use case you can access different +collection types based on the same configuration values, as long as their is +a PropertyConverter that can convert the <em>raw configuration value</em> to the +required target type. +</td> +</tr> +</table> +</div> +<div class="sect3"> +<h4 id="_configuring_the_target_implementation_type">Configuring the target implementation type</h4> +<div class="paragraph"> +<p>Tamaya Collections allows you to configure the <em>default</em> target collection type by adding the +following meta-configuration entry (shown for the mylist entry). Hereby the package part +java.util. can be ommitted:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties">mylist=a,b,c +_mylist.collection-type=LinkedList</code></pre> +</div> +</div> +<div class="paragraph"> +<p>When calling config.get("mylist", ArrayList.class) this parameter does not have any effect, +so you will still get an ArrayList as a result. However when you call config.get("mylist", +List.class) you will get a LinkedList as implementation type.</p> +</div> +<div class="paragraph"> +<p>This mechanism similarly applies to all kind of collections, so you can use it similarly to define the implementation +type returned when accessing List, Map or Collection.</p> +</div> +</div> +</div> +<div class="sect2"> +<h3 id="_collecting_configuration_entries_instead_of_overriding">Collecting Configuration Entries instead of Overriding</h3> +<div class="paragraph"> +<p>By default Tamaya applies always an overriding CombinationPolicy, where only the configuration entry for +the most significant configuration entry is used. In case of collections (and maybe also other use cases), +overriding is not always the mechanism of choice. E.g. when you want to have all entries added to your +configuration to be <strong>combined</strong> to a new entry containing all values provided by any property sources.</p> +</div> +<div class="paragraph"> +<p>Therefore <em>Tamaya Collections</em> also provides a more sophistiated CombinationPolicy (automatically configured) +that allows to adapt the way how configuration entries are combined. All you must do is declaring +the mechanism to be applied by an according <em>meta-configuration</em> parameter, e.g. for my.list your config may +look as follows:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># from PropertSource 1 +my.list=1,2,3 + +# from PropertSource 2, with higher precedence +my.list=4,5,6 + +# without any additional meta-info these entries would be combined to +my.list=4,5,6</code></pre> +</div> +</div> +<div class="paragraph"> +<p>With Tamaya Collections you can now configure the combination policy as follows:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># use one of the default policies: override / collect +_my.list.combination-policy=collect + +# or use your own custom CombinationPolicy to combine the values +_my.list.combination-policy=com.mycomp.app.MyCombincationPolicy</code></pre> +</div> +</div> +<div class="paragraph"> +<p>So declaring the collect policy the resulting raw output of the entry looks as follows:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># result when applying the collect policy: +my.list=1,2,3,4,5,6</code></pre> +</div> +</div> +<div class="paragraph"> +<p>The customizable policy mechanism of Tamaya Collections also honors the item-separator meta-configuration +parameter explained later in this document.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_format_of_collection_configuration">Format of Collection Configuration</h3> +<div class="paragraph"> +<p>By default collections are modelled as simple String values, that are tokenized into individual parts using a +defined item-separator (by default ','). So a given configuration entry of 1,2,3 is mapped to "1","2","3". +If the target context type is something different than String the smae conversion logic is used as when mapping +configuration parameters directly to non-String target types (implemented as +PropertyConverter classes, manahed +within the current ConfigurationContext. The procedure is identical for all collection types, including Map types, +with the difference that each token in the list is parsed once more for separating it into a key and a value. +The default separator for map entries hereby is "::". Map keys, as of now, are always of type String, whereas +for values the same logic is applied as for non-map collection types.</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># a list, using the default format +list=1,2,3,4,5,6 + +# a map, using the default format +map=a::b, c::d</code></pre> +</div> +</div> +<div class="sect3"> +<h4 id="_trimming_of_entries">Trimming of entries</h4> +<div class="paragraph"> +<p>By default all tokens parsed are trimmed <em>before</em> adding them to the final collection. In case of map entries this is +also the case for key/value entries. So the following configuration results in the identical values for +list1,list2 and map1,map2:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># a list, using the default format +list1=1,2,3,4,5,6 +list2=1, 2, 3, 4, 5, 6 + +# a map, using the default format +map1=a::b, c::d +map2=a :: b, c :: d</code></pre> +</div> +</div> +<div class="paragraph"> +<p>Nevertheless truncation can be controlled by the usage of brackets, e.g. the last list or map entry will have a single +space character as value:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># a list, with a ' ' value at the end +list3=1, 2, 3, 4, 5, [ ] + +# a map, with a ' ' value for key '0' +map3=1 :: a, 2 :: b, 0::[ ]</code></pre> +</div> +</div> +<div class="paragraph"> +<p>Hereby \[ escapes the sequence.</p> +</div> +</div> +<div class="sect3"> +<h4 id="_customizing_the_format">Customizing the format</h4> +<div class="paragraph"> +<p>The item and entry separators (by default ',' and "::") can be customized by setting corresponding meta-data +entries as follows, resulting in the same values as in the prevoius listing:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># a list, with a ' ' value at the end +list3=1__2__3__ 4__ 5__[ ] +_list3.item-separator=__ + +# a map, with a ' ' value for key '0' +map3=1->a, 2->b, 0->[ ] +_map3.map-entry-separator=-></code></pre> +</div> +</div> +<div class="paragraph"> +<p>Of course these settings also can be combined:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="prettyprint highlight"><code class="language-properties" data-lang="properties"># a reformatted map +redefined-map=0==none | 1==single | 2==any +_redefined-map.map-entry-separator=== +_redefined-map.item-separator=|</code></pre> +</div> +</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-<span>2018</span> 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.1</span></a> + at <span>2018-04-26</span> | + <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/tamayaconf">Follow @tamayaconf</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> + </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. + Apache, Apache Tamaya, and the Apache Tamaya logo are registered trademarks or trademarks of The Apache Software Foundation in the U.S. and/or other countries.<br /> + <a href="https://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"> + <img class="incubator-logo" src="../../logos/apache-incubator.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/8e3904a8/documentation-new/extensions/mod_consul.html ---------------------------------------------------------------------- diff --git a/documentation-new/extensions/mod_consul.html b/documentation-new/extensions/mod_consul.html new file mode 100644 index 0000000..6e8be2b --- /dev/null +++ b/documentation-new/extensions/mod_consul.html @@ -0,0 +1,261 @@ +<!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 - Extension: Integration with consul (Hashicorp)</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="../../index.html">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../start.html">Tamaya in 5 minutes</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/stable/index.html">Javadoc 0.3-incubating (release/stable)</a></li> + <li><a href="../../apidocs/development/index.html">Javadoc 0.4-incubating-SNAPSHOT (development)</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="../../development/team.html">Project Team</a></li> + <li><a target="_blank" href="https://builds.apache.org/view/S-Z/view/Tamaya/">CI / ASF Jenkins</a></li> + <li><a target="_blank" href="https://issues.apache.org/jira/browse/TAMAYA">Issues / ASF Jira</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + <li class="divider"></li> + <li><a href="../../development/possible-contributions.html">Possible Contributions</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 - Extension: Integration with consul (Hashicorp)</h1> + </div> + + <p><em>2018-04-26</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Consul">Integration with consul (Extension Module)</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>Tamaya <em>Consul</em> is an extension module. Refer to the <a href="../extensions.html">extensions documentation</a> for further details.</p> +</div> +<div class="sect2"> +<h3 id="_what_functionality_this_module_provides">What functionality this module provides ?</h3> +<div class="paragraph"> +<p>Tamaya <em>Consul</em> provides different artifacts which allows use of +<a href="http://www.consul.io">Consul from Hashicorp</a> as configuration backend. Basically the +module supports read-only integration (as a ConsulonfigSource as well +as a writing configuration changes back (based on Tamaya’s MutableConfiguration API +defined by the <a href="mod_mutable_config.html">tamaya-mutable-config</a> extension module.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>The module is based on Java 8, so it will not run on Java 8 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>To use <em>tamaya-consul</em> 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-consul</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>Consul integration comes basically with 2 artifacts:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>The org.apache.tamaya.etcd.ConsulConfigSource is a ConfigSource with a default +ordinal of 100 and the name 'consul', 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 consul cluster, +by accessing a MutableConfiguration using the URI config:consul.</p> +</li> +</ul> +</div> +<div class="paragraph"> +<p>Access of consul key/value pairs is through the normal Tamaya API.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_the_consulconfigsource">The ConsulConfigSource</h3> +<div class="paragraph"> +<p>The ConsulConfigSource is automatically registered and allows the consul servers to be used to be configured. 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 consul cluster:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p>The config source reads the tamaya.consul.urls system and environment property to evaluate possible consul servers +(comma separated), which can be connected to. On failure the API just performs a Round-Robin through the list of +configured servers. Without any configuration http://127.0.0.1:2400 is used. If no connection to any consul +server can be established a warning will be logged, but deployment will not fail.</p> +</li> +<li> +<p>The ConsulConfigSource finally also allows the values read from the consul cluster to be mapped to prefixed +context. This can be activated by setting the <code>-Dtamaya.consul.prefix=<PREFIX></code> system property. E.g. when the prefix is +set to <code>cluster-config.</code> a consul key of <code>host:known/all</code> is mapped to <code>cluster-config.host:known/all</code>.</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-<span>2018</span> 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.1</span></a> + at <span>2018-04-26</span> | + <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/tamayaconf">Follow @tamayaconf</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> + </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. + Apache, Apache Tamaya, and the Apache Tamaya logo are registered trademarks or trademarks of The Apache Software Foundation in the U.S. and/or other countries.<br /> + <a href="https://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"> + <img class="incubator-logo" src="../../logos/apache-incubator.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/8e3904a8/documentation-new/extensions/mod_etcd.html ---------------------------------------------------------------------- diff --git a/documentation-new/extensions/mod_etcd.html b/documentation-new/extensions/mod_etcd.html new file mode 100644 index 0000000..876e700 --- /dev/null +++ b/documentation-new/extensions/mod_etcd.html @@ -0,0 +1,393 @@ +<!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 - 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="../../index.html">Apache Tamaya (incubating)</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="../../start.html">Tamaya in 5 minutes</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/stable/index.html">Javadoc 0.3-incubating (release/stable)</a></li> + <li><a href="../../apidocs/development/index.html">Javadoc 0.4-incubating-SNAPSHOT (development)</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="../../development/team.html">Project Team</a></li> + <li><a target="_blank" href="https://builds.apache.org/view/S-Z/view/Tamaya/">CI / ASF Jenkins</a></li> + <li><a target="_blank" href="https://issues.apache.org/jira/browse/TAMAYA">Issues / ASF Jira</a></li> + <li><a href="../../devguide.html">Development Guide</a></li> + <li><a href="../../release-guide.html">Release Guide</a></li> + <li class="divider"></li> + <li><a href="../../development/possible-contributions.html">Possible Contributions</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 - Extension: Integration with etcd (Core OS)</h1> + </div> + + <p><em>2018-04-26</em></p> + + <p><div id="preamble"> +<div class="sectionbody"> +<!-- toc disabled --> +</div> +</div> +<div class="sect1"> +<h2 id="Etcd">Integration with etcd (Extension Module)</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>Tamaya <em>Etcd</em> is an extension module. Refer to the <a href="../extensions.html">extensions documentation</a> for further details.</p> +</div> +<div class="sect2"> +<h3 id="_what_functionality_this_module_provides">What functionality this module provides ?</h3> +<div class="paragraph"> +<p>Tamaya <em>Etcd</em> provides different artifacts which allows using <a href="https://github.com/coreos/etcd">etcd</a> as a +configuration backend. Basically the module adds a read-only property source (EtcdConfigSource). If +the <em>tamaya-mutable-config</em> extension is loaded it is alos possible to write configuration +changes to <em>etcd</em> using MutableConfiguration.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_compatibility">Compatibility</h3> +<div class="paragraph"> +<p>The module is based on Java 8, so it will not run on Java 8 and beyond.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_installation">Installation</h3> +<div class="paragraph"> +<p>To use <em>etcd</em> as a configuration backend 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>Tamaya’s <em>etcd</em> integration provides basically the following 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. The accessor basically provides a simple Java API for communicating with the <em>etcd</em> 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.EtcdConfigSource is a ConfigSource 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 implements the basic read and write API for communicating with an <em>etcd</em> server. +Hereby the accessor also provides <em>etcd</em> specific data such as createdIndex, modifiedIndex, ttl in the Map +returned. Hereby the concept of <em>etcd</em> is used where keys starting with an '_' represent meta-configuration +that 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_etcdconfigsource">The EtcdConfigSource</h3> +<div class="paragraph"> +<p>The EtcdConfigSource is automatically registered and allows to configure the <em>etcd</em> 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>Additionally 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 EtcdConfigSource finally also allows the values read from the <em>etcd</em> 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 <code>cluster-config.</code> a etcd key of <code>host:known/all</code> is mapped to <code>cluster-config.host:known/all</code>.</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-<span>2018</span> 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.1</span></a> + at <span>2018-04-26</span> | + <a class="twitter-follow-button" data-show-count="false" href="https://twitter.com/tamayaconf">Follow @tamayaconf</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> + </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. + Apache, Apache Tamaya, and the Apache Tamaya logo are registered trademarks or trademarks of The Apache Software Foundation in the U.S. and/or other countries.<br /> + <a href="https://incubator.apache.org/guides/website.html" style="border:0px;" target="_target"> + <img class="incubator-logo" src="../../logos/apache-incubator.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>
