http://git-wip-us.apache.org/repos/asf/incubator-tamaya-site/blob/4f4912e5/extensions/mod_osgi.html ---------------------------------------------------------------------- diff --cc extensions/mod_osgi.html index c63b31a,de49b46..0000000 deleted file mode 100644,100644 --- a/extensions/mod_osgi.html +++ /dev/null @@@ -1,292 -1,292 +1,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;Extensions: OSGI Integrations</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;Extensions: OSGI Integrations</h1> -- </div> -- - <p><em>2016-11-28</em></p> - <p><em>2016-11-19</em></p> -- -- <p><div id="preamble"> --<div class="sectionbody"> --<!-- toc disabled --> --</div> --</div> --<div class="sect1"> --<h2 id="Optional">Tamaya OSGI Support</h2> --<div class="sectionbody"> --<div class="sect2"> --<h3 id="_overview">Overview</h3> --<div class="paragraph"> --<p>Tamaya provides also support for integration with OSGI. Hereby several options are available how Tamaya can be used in --an OSGI context:</p> --</div> --<div class="olist arabic"> --<ol class="arabic"> --<li> --<p>All Tamaya modules, its API and core library are actually valid OSGI bundles. So adding them into your OSGI modules --and using Tamaya is basically directly supported. Nevertheless OSGI works rather differently from a class- and --resource loading perspective. As long as you rely on Tamaya’s mechanisms for resource loading things should work --out of the box. In the back Tamaya’s core module actually comes with implicit OSGI support, which is automatically --activated, if Tamaya is running in an OSGI context. This support actually</p> --<div class="ulist"> --<ul> --<li> --<p>Listens on deployed bundles and actively reads all resources configured as java.util.ServiceLoader services and --registers them as OSGI services. Hereby integration is complete meaning you can also register Tamaya services --as normal OSGI services, e.g. your own PropertySource instances.</p> --</li> --<li> --<p>Uses the OSGI bundle to resolve for resources, because accessing them from the classloader directly --typically fails in an OSGI context.</p> --</li> --</ul> --</div> --</li> --<li> --<p>Adding Tamaya’s OSGI integration module replaces the existing OSGI ConfigAdmin service with an istance based on --Tamaya. Hereby several aspects can be configured using system properties:</p> --<div class="ulist"> --<ul> --<li> --<p>org.tamaya.integration.osgi.cm.ranking (int) allows to configure the OSGI service ranking used by the Tamaya --BundleActivator to register Tamaya’s ConfigAdmin service. In OSGI higher ranking precede lower rankings. By default --Tamaya’s OSGI extending service registration mechanism is reusing any annotated @Priority priority values as --corresponsing rankings.</p> --</li> --<li> --<p>org.tamaya.integration.osgi.cm.override (boolean) allows to configure if Tamaya is overriding any existing --values from the default ConfigAdmin instance, or only extending them. In other words this setting allows you to --define, which configuration subsystem has precedence for evaluating the final values, either Tamaya based --configuration (default) or the configuration mechanisms provided by default from your OSGI container (when this flag --is set to false).</p> --</li> --<li> --<p>org.tamaya.integration.osgi.cm.inject allows you to deactivate injection of configuration values into your --OSGI services (by default injection is enabled). In all cases accessing the OSGI ConfigAdmin service to --read your configuration is working as usual. But Tamaya adds additional injection functionality, which allows --to inject typed configuration as described by the Tamaya injection api.</p> --</li> --</ul> --</div> --</li> --</ol> --</div> --<div class="paragraph"> --<p>It is also possible to combine things, e.g. when you only define a low ranking for Tamaya’s configuration service and --the same time allow injection to be active, you will have Tamaya’s injection support based on your default --OSGI configuration.</p> --</div> --</div> --<div class="sect2"> --<h3 id="_compatibility">Compatibility</h3> --<div class="paragraph"> --<p>All module described are based on Java 7, so it will run on Java 7 and beyond. --The modules are built against OSGI Compendium version 5.0.</p> --</div> --</div> --<div class="sect2"> --<h3 id="_installation">Installation</h3> --<div class="paragraph"> --<p>To benefit from Tamaya in an OSGI context you must deploy at least the following modules to your OSGI runtime --environment:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-listing" data-lang="listing"># API and core --org.apache.tamaya:tamaya-api:{tamaya_version} --org.apache.tamaya:tamaya-core:{tamaya_version} --org.apache.geronimo.specs:geronimo-annotation_1.2_spec:1.0-alpha-1 --# injection API. SE injection module and dependencies --org.apache.tamaya.ext:tamaya-injection-api:{tamaya_version} --org.apache.tamaya.ext:tamaya-injection:{tamaya_version} --org.apache.geronimo.specs:geronimo-atinject_1.0_spec:1.0 --org.apache.geronimo.specs:geronimo-el_2.2_spec:1.0.4 --org.apache.geronimo.specs:geronimo-interceptor_1.1_spec:1.0 --org.apache.geronimo.specs:geronimo-jcdi_1.1_spec:1.0 --# OSGI integration and dependencies --org.apache.tamaya.ext:tamaya-osgi:{tamaya_version} --org.apache.tamaya.ext:tamaya-functions:{tamaya_version}</code></pre> --</div> --</div> --</div> --<div class="sect2"> --<h3 id="_usage">Usage</h3> --<div class="paragraph"> --<p>As an example, what is possible you can implement an OSGI service as a normal POJO and publish it as an OSGI service. --Given that configuration can be injected very easily:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public class HelloServiceImpl implements HelloService{ -- -- @Config("example.message") -- @ConfigDefault("A Tamaya default.") -- private String message; -- -- @Override -- public String sayHello() { -- System.err.println("HELLO: " + message); -- return message; -- } --}</code></pre> --</div> --</div> --</div> --<div class="sect2"> --<h3 id="_spi">SPI</h3> --<div class="paragraph"> --<p>By default the OSGI pid or factory pid is mapped to a corresponding root section in Tamaya’s configuration. We are --well aware that this might not always be the desired approach. Therefore there as an SPI service provided that allows --to determine this mapping:</p> --</div> --<div class="listingblock"> --<div class="title">OSGIConfigRootMapper</div> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public interface OSGIConfigRootMapper { -- -- String getTamayaConfigRoot(String pid, String factoryPid); --}</code></pre> --</div> --</div> --<div class="paragraph"> --<p>Registering your own implementation as an OSGI service allows you to redefine the key mapping. --By default a configuration mapping for pid/factoryPid==myBundle is mapped to [bundle:myBundle]. --This mapping is used as a prefix when collecting the corresponding entries for the OSGI configuration.</p> --</div> --</div> --</div> --</div></p> -- -- <hr /> -- </div> -- </div> -- <div> -- <div id="push"></div> -- -- <div id="footer"> -- <div class="container"> -- <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> -- | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> - at <span>2016-12-12</span> - at <span>2016-11-27</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/4f4912e5/extensions/mod_remote.html ---------------------------------------------------------------------- diff --cc extensions/mod_remote.html index 064958e,5077e69..0000000 deleted file mode 100644,100644 --- a/extensions/mod_remote.html +++ /dev/null @@@ -1,265 -1,265 +1,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: Remote Configuration</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: Remote Configuration</h1> -- </div> -- - <p><em>2016-11-28</em></p> - <p><em>2016-11-19</em></p> -- -- <p><div id="preamble"> --<div class="sectionbody"> --<!-- toc disabled --> --</div> --</div> --<div class="sect1"> --<h2 id="Remote">Tamaya Remote Configuration (Extension Module)</h2> --<div class="sectionbody"> --<div class="sect2"> --<h3 id="_overview">Overview</h3> --<div class="paragraph"> --<p>The Tamaya remote module provides support for reading configuration from remote resources. It provides --especially out-of-the-box support for reading scoped configuration from a configuration server as --provided with the <em>Tamaya server module</em> .</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-remote</artifactId> -- <version>{tamaya_version}</version> --</dependency></code></pre> --</div> --</div> --</div> --<div class="sect2"> --<h3 id="_reading_remote_configuration_from_a_tamaya_configuration_server">Reading Remote configuration from a Tamaya Configuration Server</h3> --<div class="paragraph"> --<p>The remote module allows reading JSON formatted configuration as provided by the <em>Tamaya server extension</em> . The JSON --format used looks as follows:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-json" data-lang="json">{ -- "java.vendor.url": "http://java.oracle.com/", -- "java.vendor.url.bug": "http://bugreport.sun.com/bugreport/", -- "java.vm.info": "mixed mode", -- "java.vm.name": "Java HotSpot(TM) 64-Bit Server VM", -- "java.vm.specification.name": "Java Virtual Machine Specification", -- "java.vm.specification.vendor": "Oracle Corporation", -- "java.vm.specification.version": "1.8", -- "java.vm.vendor": "Oracle Corporation", -- "java.vm.version": "25.45-b02", -- "sun.arch.data.model": "64", -- "sun.boot.class.path": "C:\apps\jdk18\jre\lib\resources.jar;C:\apps\jdk18\jre\lib\rt.jar;C:\apps\jdk18\jre\lib\sunrsasign.jar;C:\apps\jdk18\jre\lib\jsse.jar;C:\apps\jdk18\jre\lib\jce.jar;C:\apps\jdk18\jre\lib\charsets.jar;C:\apps\jdk18\jre\lib\jfr.jar;C:\apps\jdk18\jre\classes", -- "sun.boot.library.path": "C:\apps\jdk18\jre\bin", -- "sun.cpu.endian": "little", -- "sun.cpu.isalist": "amd64", -- "sun.desktop": "windows", -- "sun.io.unicode.encoding": "UnicodeLittle", -- "sun.java.command": "com.intellij.rt.execution.application.AppMain org.apache.tamaya.examples.remote.server.Start", -- "sun.java.launcher": "SUN_STANDARD", -- "sun.jnu.encoding": "Cp1252", -- "sun.management.compiler": "HotSpot 64-Bit Tiered Compilers", -- "sun.os.patch.level": "", -- "{meta}class": "org.apache.tamaya.functions.FilteredConfiguration", -- "{meta}info.filter": "java.v,sun", -- "{meta}info.format": "application/json", -- "{meta}info.timestamp": "1441463200571", -- "{meta}timestamp": "1441463200571", -- "{meta}type": "Configuration" --}</code></pre> --</div> --</div> --<div class="paragraph"> --<p>Basically there are no constraints about they keys provided. By default Tamaya uses keys prefixed with --{xxx} to identify meta-data entries, but this is not a required precondition.</p> --</div> --<div class="paragraph"> --<p>Finally such a remote configuration can be easily integrated by inheriting from the provided base --class. Hereby a default ordinal must be defined and the protected Collection<URL> getAccessURLs() --method must be implemented to define the URL from where the configuration should be accessible. Hereby --multiple URLs can be provided, which are accesed in order as provided by the collection’s iterator. The --first URL that is successfully accessed determines the configuration read and imported into the --PropertySource.</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public class RemotePropertySource extends BaseRemotePropertySource{ -- /** Current remote property source default ordinal. */ -- private static final int REMOTE_ORDINAL = 15000; -- -- @Override -- public int getDefaultOrdinal(){ -- return REMOTE_ORDINAL; -- } -- -- @Override -- protected Collection<URL> getAccessURLs() { -- try { -- String configServerUrl = System.getenv("CONFIG_SERVER"); -- if(configServerUrl==null){ -- configServerUrl = System.getProperty("configServer"); -- } -- if(configServerUrl==null){ -- configServerUrl = "http://localhost:8888/config?scope=CLIENT&scopeId={clientId}&format=application/json"; -- } -- System.out.println("Reading config from " + configServerUrl.replace("{clientId}", Client.getClientId())); -- return Arrays.asList(new URL[]{new URL(configServerUrl.replace("{clientId}", Client.getClientId()))}); -- } catch (MalformedURLException e) { -- Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to configure remote config location,", e); -- return Collections.emptySet(); -- } -- } -- --}</code></pre> --</div> --</div> --</div> --</div> --</div></p> -- -- <hr /> -- </div> -- </div> -- <div> -- <div id="push"></div> -- -- <div id="footer"> -- <div class="container"> -- <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> -- | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> - at <span>2016-12-12</span> - at <span>2016-11-27</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/4f4912e5/extensions/mod_resolver.html ---------------------------------------------------------------------- diff --cc extensions/mod_resolver.html index 2fcffc1,7d4913f..0000000 deleted file mode 100644,100644 --- a/extensions/mod_resolver.html +++ /dev/null @@@ -1,290 -1,290 +1,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: Resolver</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: Resolver</h1> -- </div> -- - <p><em>2016-11-28</em></p> - <p><em>2016-11-19</em></p> -- -- <p><div class="sect1"> --<h2 id="Core">Tamaya Resolver (Extension Module)</h2> --<div class="sectionbody"> --<div class="sect2"> --<h3 id="_overview">Overview</h3> --<div class="paragraph"> --<p>Tamaya Resolver 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 Resolver provides a dynamic resolution mechanism, which allows to use UNIX-styled (${...} placeholder --expressions in your configuration values. The resolver hereby supports transitive resolution and also prevents --cycles to loop endlessly.</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 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-resolver</artifactId> -- <version>0.3-SNAPSHOT</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="_available_resolvers">Available Resolvers</h3> --<div class="paragraph"> --<p>Currently the module defined the following resolvers:</p> --</div> --<table class="tableblock frame-all grid-all spread"> --<caption class="title">Table 1. Available Resolvers</caption> --<colgroup> --<col style="width: 25%;"> --<col style="width: 50%;"> --<col style="width: 25%;"> --</colgroup> --<tbody> --<tr> --<td class="tableblock halign-left valign-top"><p class="tableblock"><em>Expression</em></p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock"><em>Description</em></p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock"><em>Example</em></p></td> --</tr> --<tr> --<td class="tableblock halign-left valign-top"><p class="tableblock">conf:<configKey></p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock">Reads another configKey and replaces the expression with the value found.</p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock">conf-ref=${conf:anotherConf.entryKey}</p></td> --</tr> --<tr> --<td class="tableblock halign-left valign-top"><p class="tableblock">resource:<resourceRef></p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock">Reads a resource from the current classpath and replaces the expression with the given text content.</p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock">cp-ref=${resource:Testresource.txt}</p></td> --</tr> --<tr> --<td class="tableblock halign-left valign-top"><p class="tableblock">file:<fileRef></p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock">Reads a resource from the current classpath and replaces the expression with the given text content.</p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock">file-ref=${file:c:\myFile.txt}</p></td> --</tr> --<tr> --<td class="tableblock halign-left valign-top"><p class="tableblock">url:<url></p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock">Reads an URL and replaces the expression with the given text content.</p></td> --<td class="tableblock halign-left valign-top"><p class="tableblock">url-ref=${url:http://www.google.com}</p></td> --</tr> --</tbody> --</table> --</div> --<div class="sect2"> --<h3 id="_spi_implementing_your_own_resolvers">SPI: Implementing your own Resolvers</h3> --<div class="paragraph"> --<p>The module also provides an easy but powerful SPI for adding your own resolver implementations. Basically the --first and most important thing to do is implementing the ExpressionResolver interface:</p> --</div> --<div class="listingblock"> --<div class="title">Implementing a Custom Resolver</div> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public class PwdDecrypter implements ExpressionResolver { -- -- @Override -- public String getResolverPrefix() { -- return "decrypt:"; -- } -- -- @Override -- public String evaluate(String expression) { -- return decrypt(expression); -- } -- -- private String decrypt(String s) { -- ... -- } --}</code></pre> --</div> --</div> --<div class="paragraph"> --<p>Basically that is all you must do, after having registered the class with the ServiceLoader it will be found --and loaded by the implementation. With that all expressions that start with the given prefix are passed to the --resolver, so all the following expressions will be sent to the implementation:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-listing" data-lang="listing">blabla ${decrypt:myname} --blabla ${decrypt:myname} foo blabla ${decrypt:myname}</code></pre> --</div> --</div> --<div class="paragraph"> --<p>Hereby evaluation is repeated until no further change of values could be detetced. In case of a endless loop --the evaluation is broken after a (configurable) number of cycles.</p> --</div> --<div class="paragraph"> --<p>Under the hood instances of ExpressionResolver are managed by an implementation of the ExpressionEvaluator --interface:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public interface ExpressionEvaluator { -- /** -- * Evaluates the current expression. -- * @param key the key, not null. -- * @param value the value to be filtered/evaluated. -- * @return the filtered/evaluated value, including null. -- */ -- String evaluateExpression(String key, String value); --}</code></pre> --</div> --</div> --<div class="paragraph"> --<p>Implementing and registering this interface gives you full control, but in most cases yhou should be fine with --the default implementation in place.</p> --</div> --</div> --</div> --</div></p> -- -- <hr /> -- </div> -- </div> -- <div> -- <div id="push"></div> -- -- <div id="footer"> -- <div class="container"> -- <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> -- | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> - at <span>2016-12-12</span> - at <span>2016-11-27</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/4f4912e5/extensions/mod_resources.html ---------------------------------------------------------------------- diff --cc extensions/mod_resources.html index bb4adc6,94dca79..0000000 deleted file mode 100644,100644 --- a/extensions/mod_resources.html +++ /dev/null @@@ -1,314 -1,314 +1,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: Resources</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: Resources</h1> -- </div> -- - <p><em>2016-11-28</em></p> - <p><em>2016-11-19</em></p> -- -- <p><div class="sect1"> --<h2 id="Core">Tamaya Resources (Extension Module)</h2> --<div class="sectionbody"> --<div class="sect2"> --<h3 id="_overview">Overview</h3> --<div class="paragraph"> --<p>Tamaya Resources 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 Resources defines some additional tools to locate resources in your classpath or file system based on descriptive --ant-styled resource patterns. To use this module add the following dependency:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-listing" data-lang="listing"><dependency> -- <grooupId>org.apache.tamaya.ext</groupId> -- <artifactId>tamaya-resources</artifactId> -- <version>0.3-SNAPSHOT</version> --</dependency></code></pre> --</div> --</div> --<div class="paragraph"> --<p>The module’s main entry point is the singleton class org.apache.tamaya.resource.ConfigResources. This class --provides access to a ResourceResolver instance:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">ResourceResolver resolver = ConfigResources.getResourceResolver();</code></pre> --</div> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public interface ResourceResolver { -- Collection<URL> getResources(Collection<String> expressions) {...} -- Collection<URL> getResources(String... expressions) {...} -- Collection<URL> getResources(ClassLoader classLoader, String... expressions){...} -- Collection<URL> getResources(ClassLoader classLoader, Collection<String> expressions); --}</code></pre> --</div> --</div> --<div class="paragraph"> --<p>Hereby the methods allow to resolve expressions to a collection of URLs. In case the expression is also targeting the --current classpath the target ClassLoader to be used can be passed additionally.</p> --</div> --<div class="paragraph"> --<p>The default implementation provides resource resolution mechanism similar to the functionality offered by Spring. --So by default resources can be looked up</p> --</div> --<div class="ulist"> --<ul> --<li> --<p>from files</p> --</li> --<li> --<p>from the classpath</p> --</li> --<li> --<p>optionally ant-styled expressions can be used.</p> --</li> --</ul> --</div> --</div> --<div class="sect2"> --<h3 id="_valid_expression_examples">Valid Expression Examples</h3> --<div class="paragraph"> --<p>There are numerous ways how a resource pattern can be defined. Following the most important variants --are listed:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-listing" data-lang="listing">// explicitly searching the file system --file:myroot/aa?a/*.file --file:myroot/b*/b?/*.file --file:myroot/**/*.file -- --// explicitly searching the classpath --classpath:myroot/**/*.file --classpath:javax/annotation/*.class --classpath:javax/**/sql/*.class --classpath:javax/annotation/**/R*.class --classpath:javax/annotation/R?so*.class --classpath:META-INF/maven/org.apache.geronimo.specs/**/* -- --// search both classpath and files --javax/annotation/*.class --javax/**/sql/*.class --javax/annotation/**/R*.class --javax/annotation/R?so*.class --META-INF/maven/org.apache.geronimo.specs/**/* --myroot/**/*.file --myroot/aa?a/*.file --myroot/b*/b?/*.file</code></pre> --</div> --</div> --<div class="paragraph"> --<p>Summarizing the resources module provides useful functionality that helps to locate resources on the file system and --in the classpath. This can be used to implement PropertySourceProvider implementations that are based on --corresponding resource path patterns instead of concrete files.</p> --</div> --</div> --<div class="sect2"> --<h3 id="_overall_usage_example">Overall Usage Example</h3> --<div class="paragraph"> --<p>Given the functionality we can easily implement a PropertySourceProvider that reads all files from a classpath --location, hereby traversing down all folders:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public class PathBasedPropertySourceProvider implements PropertySourceProvider { -- -- @Override -- public Collection<PropertySource> getPropertySources() { -- List<PropertySource> propertySources = new ArrayList<>(); -- Collection<URL> resources = Resources.getResourceResolver().getResources("META-INF/cfg/**/*.properties"); -- for(URL url:resources){ -- Properties props = new Properties(); -- try(InputStream is = url.openStream()){ -- props.load(is); -- propertySources.add(new PropertiesBasedPropertySource(url.toString(), props)); -- } -- catch(Exception e){ -- e.printStackTrace(); -- } -- } -- -- return propertySources; -- } -- -- private final static class PropertiesBasedPropertySource implements PropertySource { -- private String name; -- private Map<String,String> properties = new HashMap<>(); -- -- public PropertiesBasedPropertySource(String name, Properties props) { -- this.name = name; -- props.forEach((k,v) -> this.properties.put(k.toString(), v.toString())); -- } -- -- @Override -- public String getName() { -- return name; -- } -- -- @Override -- public String get(String key) { -- return properties.get(key); -- } -- -- @Override -- public Map<String, String> getProperties() { -- return properties; -- } -- } --}</code></pre> --</div> --</div> --</div> --<div class="sect2"> --<h3 id="_spi">SPI</h3> --<div class="paragraph"> --<p>The ResourceResolver that is returned by the ConfigResources singleton is determined by the --current ServiceContext, by default you can replace the default implementation by registering an --alternate implementation with an overriding @Priority annotation added using the ServiceLoader.</p> --</div> --<div class="paragraph"> --<p>Additionally a BaseResourceResolver class can be used to reduce the amount of code to be written --on your own.</p> --</div> --</div> --</div> --</div></p> -- -- <hr /> -- </div> -- </div> -- <div> -- <div id="push"></div> -- -- <div id="footer"> -- <div class="container"> -- <p class="muted credit">© 2014-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> -- | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> - at <span>2016-12-12</span> - at <span>2016-11-27</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/4f4912e5/extensions/mod_server.html ---------------------------------------------------------------------- diff --cc extensions/mod_server.html index 425643a,2ed3020..0000000 deleted file mode 100644,100644 --- a/extensions/mod_server.html +++ /dev/null @@@ -1,559 -1,559 +1,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: Configuration Server</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: Configuration Server</h1> -- </div> -- - <p><em>2016-11-28</em></p> - <p><em>2016-11-19</em></p> -- -- <p><div id="preamble"> --<div class="sectionbody"> --<!-- toc disabled --> --</div> --</div> --<div class="sect1"> --<h2 id="Remote">Tamaya Configuration Server (Extension Module)</h2> --<div class="sectionbody"> --<div class="sect2"> --<h3 id="_overview">Overview</h3> --<div class="paragraph"> --<p>The Tamaya server module provides support for providing scoped configuration using a http server serving JSON formatted --configuration properties.</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 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-server</artifactId> -- <version>{tamaya_version}</version> --</dependency></code></pre> --</div> --</div> --</div> --<div class="sect2"> --<h3 id="_providing_configuration_using_the_tamaya_built_in_configuration_server">Providing configuration using the Tamaya Built-in Configuration Server</h3> --<div class="paragraph"> --<p>THe most simple way for providing onfiguration ist to start the internal server:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">Server server = org.apache.tamaya.server.ConfigServer.createServer(); --server.start(port);</code></pre> --</div> --</div> --<div class="paragraph"> --<p>This will start a simple server instance that serves the following URL patterns:</p> --</div> --<div class="ulist"> --<ul> --<li> --<p>GET /config provides access to the full configuration tree.</p> --</li> --<li> --<p>GET /config/filtered/${path} let you filter the configuration returned using regular expression (comma separated). --E.g. /config/filtered/java,sun will return all configuration entries starting with <em>java</em> and <em>sun</em>.</p> --</li> --</ul> --</div> --<div class="paragraph"> --<p>Additionally the server module has the following options implemented, which can be passed as additional, optional --parameters:</p> --</div> --<div class="ulist"> --<ul> --<li> --<p>format allows to define the target format. By default the ACCEPT header of the http request is checked, but this --setting can be explicitly controlled by passing tis parameter explicitly. The value is the expected MIME type to be --returned. By default the service supports the following types (refer to the SPI section later in this document for --options to adapt this):</p> --<div class="ulist"> --<ul> --<li> --<p>text/html</p> --</li> --<li> --<p>text/plain</p> --</li> --<li> --<p>application/xml</p> --</li> --<li> --<p>text/json</p> --</li> --</ul> --</div> --</li> --<li> --<p>scope,scopeId allows to use a server-side preconfigured filter/combination policy to be applied for --evaluating the entries to be returned. Hereby the scopeId paramter allows to address a certain scope. --As an example think of a scope ?scope=CLIENT&scopeId=client1 to be passed as request parameters. This --tells the server module to lookup a configured scope named 'CLIENT' and access a ConfigOperator for the --given scopeId 'client1'. The returned operator then can filter and combine any kind of entries to the --required client configuration (for client1). Refer to the scopes section for more details.</p> --</li> --</ul> --</div> --</div> --<div class="sect2"> --<h3 id="_using_the_configuration_servlets">Using the Configuration Servlets</h3> --<div class="paragraph"> --<p>Additionally to the fully built-in solution, it is also possible to integrate the Tamaya server module with a standard --Java EE servlet container. Tamaya provides 2 servlet implementations:</p> --</div> --<div class="ulist"> --<ul> --<li> --<p>the servlet org.apache.tamaya.server.FilteredConfigServlet can be used to register access to configurations --that also support filtering of the keys. The URL looks like</p> --</li> --</ul> --</div> --<div class="listingblock"> --<div class="content"> --<pre>http(s)://HOST/SERVLET_CONTEXT/PATHS?params -- --where -- HOST = host name incl port, e.g. 127.0.0.2:234 -- SERVLET_CONTEXT = the base context and servlet context, e.g. /client/config/filtered -- PATHS = A comma separated number of key paths to be filtered for being returned, e.g. -- java,sun,client -- params = the optional parameters (scope, scopeId and format)</pre> --</div> --</div> --<div class="ulist"> --<ul> --<li> --<p>the servlet org.apache.tamaya.server.FullConfigServlet can be used to register access to configurations --that alwyas returns all items known. The URL looks like</p> --</li> --</ul> --</div> --<div class="listingblock"> --<div class="content"> --<pre>http(s)://HOST/SERVLET_CONTEXT?params -- --where -- HOST = host name incl port, e.g. 127.0.0.2:234 -- SERVLET_CONTEXT = the base context and servlet context, e.g. /client/config/filtered -- params = the optional parameters (scope, scopeId and format)</pre> --</div> --</div> --<div class="sect3"> --<h4 id="_formatting_used_by_default">Formatting used by Default</h4> --<div class="paragraph"> --<p>The server module formats the configuration returned by default in thw following variants:</p> --</div> --<div class="listingblock"> --<div class="title">Formatting for text/json</div> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-json" data-lang="json">{ -- "java.vendor.url": "http://java.oracle.com/", -- "java.vendor.url.bug": "http://bugreport.sun.com/bugreport/", -- "java.vm.info": "mixed mode", -- "java.vm.name": "Java HotSpot(TM) 64-Bit Server VM", -- "java.vm.specification.name": "Java Virtual Machine Specification", -- "java.vm.specification.vendor": "Oracle Corporation", -- "java.vm.specification.version": "1.8", -- "java.vm.vendor": "Oracle Corporation", -- "java.vm.version": "25.45-b02", -- "sun.arch.data.model": "64", -- "sun.boot.class.path": "C:\apps\jdk18\jre\lib\resources.jar;C:\apps\jdk18\jre\lib\rt.jar;C:\apps\jdk18\jre\lib\sunrsasign.jar;C:\apps\jdk18\jre\lib\jsse.jar;C:\apps\jdk18\jre\lib\jce.jar;C:\apps\jdk18\jre\lib\charsets.jar;C:\apps\jdk18\jre\lib\jfr.jar;C:\apps\jdk18\jre\classes", -- "sun.boot.library.path": "C:\apps\jdk18\jre\bin", -- "sun.cpu.endian": "little", -- "sun.cpu.isalist": "amd64", -- "sun.desktop": "windows", -- "sun.io.unicode.encoding": "UnicodeLittle", -- "sun.java.command": "com.intellij.rt.execution.application.AppMain org.apache.tamaya.examples.remote.server.Start", -- "sun.java.launcher": "SUN_STANDARD", -- "sun.jnu.encoding": "Cp1252", -- "sun.management.compiler": "HotSpot 64-Bit Tiered Compilers", -- "sun.os.patch.level": "", -- "{meta}class": "org.apache.tamaya.functions.FilteredConfiguration", -- "{meta}info.filter": "java.v,sun", -- "{meta}info.format": "application/json", -- "{meta}info.timestamp": "1441463200571", -- "{meta}timestamp": "1441463200571", -- "{meta}type": "Configuration" --}</code></pre> --</div> --</div> --<div class="listingblock"> --<div class="title">Formatting for application/xml</div> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-xml" data-lang="xml"><configuration> -- <entry key="java.vendor.url">http://java.oracle.com/</entry> -- <entry key="java.vendor.url.bug">http://bugreport.sun.com/bugreport/</entry> -- <entry key="java.vm.info">mixed mode</entry> -- <entry key="java.vm.name">Java HotSpot(TM) 64-Bit Server VM</entry> -- <entry key="java.vm.specification.name">Java Virtual Machine Specification</entry> -- <entry key="java.vm.specification.vendor">Oracle Corporation</entry> -- <entry key="java.vm.specification.version">1.8</entry> -- <entry key="java.vm.vendor">Oracle Corporation</entry> -- <entry key="java.vm.version">25.45-b02</entry> -- <entry key="sun.arch.data.model">64</entry> -- <entry key="sun.boot.class.path">C:\apps\jdk18\jre\lib\resources.jar;C:\apps\jdk18\jre\lib\rt.jar;C:\apps\jdk18\jre\lib\sunrsasign.jar;C:\apps\jdk18\jre\lib\jsse.jar;C:\apps\jdk18\jre\lib\jce.jar;C:\apps\jdk18\jre\lib\charsets.jar;C:\apps\jdk18\jre\lib\jfr.jar;C:\apps\jdk18\jre\classes</entry> -- <entry key="sun.boot.library.path">C:\apps\jdk18\jre\bin</entry> -- <entry key="sun.cpu.endian">little</entry> -- <entry key="sun.cpu.isalist">amd64</entry> -- <entry key="sun.desktop">windows</entry> -- <entry key="sun.io.unicode.encoding">UnicodeLittle</entry> -- <entry key="sun.java.command">com.intellij.rt.execution.application.AppMain org.apache.tamaya.examples.remote.server.Start</entry> -- <entry key="sun.java.launcher">SUN_STANDARD</entry> -- <entry key="sun.jnu.encoding">Cp1252</entry> -- <entry key="sun.management.compiler">HotSpot 64-Bit Tiered Compilers</entry> -- <entry key="sun.os.patch.level"></entry> -- <entry key="{meta}class">org.apache.tamaya.functions.FilteredConfiguration</entry> -- <entry key="{meta}info.filter">java.v,sun</entry> -- <entry key="{meta}info.format">application/xml</entry> -- <entry key="{meta}info.timestamp">1441463383687</entry> -- <entry key="{meta}timestamp">1441463383687</entry> -- <entry key="{meta}type">Configuration</entry> --</configuration></code></pre> --</div> --</div> --<div class="listingblock"> --<div class="title">Formatting for text/plain</div> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-text" data-lang="text">Configuration: -- java.vendor.url: http://java.oracle.com/, -- java.vendor.url.bug: http://bugreport.sun.com/bugreport/, -- java.vm.info: mixed mode, -- java.vm.name: Java HotSpot(TM) 64-Bit Server VM, -- java.vm.specification.name: Java Virtual Machine Specification, -- java.vm.specification.vendor: Oracle Corporation, -- java.vm.specification.version: 1.8, -- java.vm.vendor: Oracle Corporation, -- java.vm.version: 25.45-b02, -- sun.arch.data.model: 64, -- sun.boot.class.path: C:\apps\jdk18\jre\lib\resources.jar;C:\apps\jdk18\jre\lib\rt.jar;C:\apps\jdk18\jre\lib\sunrsasign.jar;C:\apps\jdk18\jre\lib\jsse.jar;C:\apps\jdk18\jre\lib\jce.jar;C:\apps\jdk18\jre\lib\charsets.jar;C:\apps\jdk18\jre\lib\jfr.jar;C:\apps\jdk18\jre\classes, -- sun.boot.library.path: C:\apps\jdk18\jre\bin, -- sun.cpu.endian: little, -- sun.cpu.isalist: amd64, -- sun.desktop: windows, -- sun.io.unicode.encoding: UnicodeLittle, -- sun.java.command: com.intellij.rt.execution.application.AppMain org.apache.tamaya.examples.remote.server.Start, -- sun.java.launcher: SUN_STANDARD, -- sun.jnu.encoding: Cp1252, -- sun.management.compiler: HotSpot 64-Bit Tiered Compilers, -- sun.os.patch.level: , -- {meta}class: org.apache.tamaya.functions.FilteredConfiguration, -- {meta}info.filter: java.v,sun, -- {meta}info.format: text/plain, -- {meta}info.timestamp: 1441463082020, -- {meta}timestamp: 1441463082021, -- {meta}type: Configuration</code></pre> --</div> --</div> --<div class="listingblock"> --<div class="title">Formatting for application/html</div> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-html" data-lang="html"><html> --<head><title>System Configuration</title></head> --<body> --<h1>Sysem Configuration</h1> --<p>This view shows the system configuration of devbox-win at Sat Sep 05 16:30:59 CEST 2015.</p><pre> --Configuration: -- java.vendor.url: http://java.oracle.com/, -- java.vendor.url.bug: http://bugreport.sun.com/bugreport/, -- java.vm.info: mixed mode, -- java.vm.name: Java HotSpot(TM) 64-Bit Server VM, -- java.vm.specification.name: Java Virtual Machine Specification, -- java.vm.specification.vendor: Oracle Corporation, -- java.vm.specification.version: 1.8, -- java.vm.vendor: Oracle Corporation, -- java.vm.version: 25.45-b02, -- sun.arch.data.model: 64, -- sun.boot.class.path: C:\apps\jdk18\jre\lib\resources.jar;C:\apps\jdk18\jre\lib\rt.jar;C:\apps\jdk18\jre\lib\sunrsasign.jar;C:\apps\jdk18\jre\lib\jsse.jar;C:\apps\jdk18\jre\lib\jce.jar;C:\apps\jdk18\jre\lib\charsets.jar;C:\apps\jdk18\jre\lib\jfr.jar;C:\apps\jdk18\jre\classes, -- sun.boot.library.path: C:\apps\jdk18\jre\bin, -- sun.cpu.endian: little, -- sun.cpu.isalist: amd64, -- sun.desktop: windows, -- sun.io.unicode.encoding: UnicodeLittle, -- sun.java.command: com.intellij.rt.execution.application.AppMain org.apache.tamaya.examples.remote.server.Start, -- sun.java.launcher: SUN_STANDARD, -- sun.jnu.encoding: Cp1252, -- sun.management.compiler: HotSpot 64-Bit Tiered Compilers, -- sun.os.patch.level: , -- {meta}class: org.apache.tamaya.functions.FilteredConfiguration, -- {meta}info.filter: java.v,sun, -- {meta}info.format: text/html, -- {meta}info.timestamp: 1441463459653, -- {meta}timestamp: 1441463459654, -- {meta}type: Configuration -- --</pre> --</body> --</html></code></pre> --</div> --</div> --</div> --</div> --<div class="sect2"> --<h3 id="_spi">SPI</h3> --<div class="sect3"> --<h4 id="_scopes">Scopes</h4> --<div class="paragraph"> --<p>As mentioned earlier in this document scopes can be used to define the exact configuration tree to be returned, e.g. --as a result of combining multiple sub trees. Following an example of the code to be written to return a configuration --that combines common client default entries with client specific entries:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public class ClientScopeProvider implements ScopeProvider{ -- -- /** -- * Access the unique scope name. -- * @return the unique scope name. -- */ -- public String getScopeType(){ -- return "CLIENT"; -- } -- -- @Override -- public ConfigOperator getScope(String scopeId) { -- return c -> -- ConfigurationFunctions.combine("Scoped Config CLIENT="+scopeId, -- c.with(ConfigurationFunctions.sectionRecursive(true, "client.default")), -- c.with(ConfigurationFunctions.sectionRecursive(true, "client." + scopeId)) -- ); -- } --}</code></pre> --</div> --</div> --<div class="paragraph"> --<p>This class can be registered using the ServiceContext in place. By default the ServiceLoader is used, so you will --have to add the following to META-INF/services/org.apache.tamaya.server.spi.ScopeProvider:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-listing" data-lang="listing">my.full.packagename.ClientScopeProvider</code></pre> --</div> --</div> --</div> --<div class="sect3"> --<h4 id="_adapting_the_way_configuration_is_derived">Adapting the Way Configuration is Derived</h4> --<div class="paragraph"> --<p>Finally the effective readong and configuration handling logic can also be replaced or improved. This can be --done by registering your own implementation of the interface ConfigProviderService:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public interface ConfigProviderService { -- String getConfigurationWithPath(String path, String format, String scope, String scopeId, HttpServletRequest request); -- String getConfiguration(String format, String scope, String scopeId, HttpServletRequest request); -- void updateConfiguration(String payload, HttpServletRequest request); -- void deleteConfiguration(String paths, HttpServletRequest request); --}</code></pre> --</div> --</div> --<div class="paragraph"> --<p>By default the ServiceContextManager uses the java.util.ServiceLoader for component loading, so to replace the --default server code you must register a higher @Priority implementation.</p> --</div> --</div> --<div class="sect3"> --<h4 id="_replacing_the_built_in_server">Replacing the Built-In Server</h4> --<div class="paragraph"> --<p>We have seen earlier that starting a configuration server is pretty easy:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">Server server = org.apache.tamaya.server.ConfigServer.createServer(); --server.start(port);</code></pre> --</div> --</div> --<div class="paragraph"> --<p>Nevertheless one may want to replace the used implementation of Server. This can be done easily by simply --registering an overriding implementation if the corresponding interface:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public interface Server { -- void start(int port); -- boolean isStarted(); -- void stop(); -- void destroy(); --}</code></pre> --</div> --</div> --</div> --<div class="sect3"> --<h4 id="_the_scopemanager_singleton">The ScopeManager Singleton</h4> --<div class="paragraph"> --<p>Finally whe implementing your own server, you might also benefit from the ScopeManager singleton. Basically this --class loads all registered ScopeProvider and manages the configured scope instances:</p> --</div> --<div class="listingblock"> --<div class="content"> --<pre class="prettyprint highlight"><code class="language-java" data-lang="java">public final class ScopeManager { -- ... -- -- private ScopeManager(){} -- -- /** -- * Get the scope given its name. -- * @param scopeId the scope name -- * @return the scope matching -- * @throws ConfigException, if nos such scope is defined. -- */ -- public static ConfigOperator getScope(String scopeId, String target); -- -- /** -- * Get the defined scope names. -- * @return the defined scope names, never null. -- */ -- public static Set<String> getScopes(); -- --}</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-2016 Apache Software Foundation | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> -- | Baked with <a href="http://jbake.org">JBake <span>v2.5.0</span></a> - at <span>2016-12-12</span> - at <span>2016-11-27</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>
