blob: f6a8b9f798f719bab30339d3a3f20002c281bce4 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>ConfigSource</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ConfigSource";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":18,"i2":6,"i3":18,"i4":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigProviderResolver.html" title="class in org.eclipse.microprofile.config.spi"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSourceProvider.html" title="interface in org.eclipse.microprofile.config.spi"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/eclipse/microprofile/config/spi/ConfigSource.html" target="_top">Frames</a></li>
<li><a href="ConfigSource.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.eclipse.microprofile.config.spi</div>
<h2 title="Interface ConfigSource" class="title">Interface ConfigSource</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">ConfigSource</span></pre>
<div class="block"><p>Implement this interfaces to provide a ConfigSource.
A ConfigSource provides configuration values from a specific place, like JNDI configuration, a properties file, etc.
A ConfigSource is always read-only, any potential updates of the configured values must be handled directly inside each ConfigSource.
<p>
The default config sources always available by default are:
<ol>
<li>System properties (ordinal=400)</li>
<li>Environment properties (ordinal=300)</li>
<li>/META-INF/microprofile-config.properties (ordinal=100)</li>
</ol>
<p>Custom ConfigSource will get picked up via the <code>ServiceLoader</code> mechanism and and can be registered by
providing a file
<pre>
META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource
</pre>
which contains the fully qualified <code>ConfigSource</code> implementation class name as content.
<p>Adding a dynamic amount of custom config sources can be done programmatically via
<a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSourceProvider.html" title="interface in org.eclipse.microprofile.config.spi"><code>ConfigSourceProvider</code></a>.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSource.html#CONFIG_ORDINAL">CONFIG_ORDINAL</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSource.html#DEFAULT_ORDINAL">DEFAULT_ORDINAL</a></span></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSource.html#getName--">getName</a></span>()</code>
<div class="block">The name of the config might be used for logging or analysis of configured values.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>default int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSource.html#getOrdinal--">getOrdinal</a></span>()</code>
<div class="block">Return the ordinal for this config source.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.util.Map&lt;java.lang.String,java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSource.html#getProperties--">getProperties</a></span>()</code>
<div class="block">Return the properties in this config source</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>default java.util.Set&lt;java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSource.html#getPropertyNames--">getPropertyNames</a></span>()</code>
<div class="block">Gets all property names known to this config source, without evaluating the values.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSource.html#getValue-java.lang.String-">getValue</a></span>(java.lang.String&nbsp;propertyName)</code>
<div class="block">Return the value for the specified property in this config source.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="CONFIG_ORDINAL">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CONFIG_ORDINAL</h4>
<pre>static final&nbsp;java.lang.String CONFIG_ORDINAL</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.eclipse.microprofile.config.spi.ConfigSource.CONFIG_ORDINAL">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="DEFAULT_ORDINAL">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DEFAULT_ORDINAL</h4>
<pre>static final&nbsp;int DEFAULT_ORDINAL</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.eclipse.microprofile.config.spi.ConfigSource.DEFAULT_ORDINAL">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getProperties--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProperties</h4>
<pre>java.util.Map&lt;java.lang.String,java.lang.String&gt;&nbsp;getProperties()</pre>
<div class="block">Return the properties in this config source</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the map containing the properties in this config source</dd>
</dl>
</li>
</ul>
<a name="getPropertyNames--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPropertyNames</h4>
<pre>default&nbsp;java.util.Set&lt;java.lang.String&gt;&nbsp;getPropertyNames()</pre>
<div class="block">Gets all property names known to this config source, without evaluating the values.
For backwards compatibility, there is a default implementation that just returns the keys of <code>getProperties()</code>
slower ConfigSource implementations should replace this with a more performant implementation</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the set of property keys that are known to this ConfigSource</dd>
</dl>
</li>
</ul>
<a name="getOrdinal--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getOrdinal</h4>
<pre>default&nbsp;int&nbsp;getOrdinal()</pre>
<div class="block">Return the ordinal for this config source. If a property is specified in multiple config sources, the value
in the config source with the highest ordinal takes precedence.
For the config sources with the same ordinal value, the config source names will
be used for sorting according to string sorting criteria.
Note that this property only gets evaluated during ConfigSource discovery.
The default ordinals for the default config sources:
<ol>
<li>System properties (ordinal=400)</li>
<li>Environment properties (ordinal=300)
<p>Some operating systems allow only alphabetic characters or an underscore(_), in environment variables.
Other characters such as ., /, etc may be disallowed.
In order to set a value for a config property that has a name containing such disallowed characters from an environment variable,
the following rules are used.
This ConfigSource searches for potentially 3 environment variables with a given property name (e.g. <code>"com.ACME.size"</code>):</p>
<ol>
<li>Exact match (i.e. <code>"com.ACME.size"</code>)</li>
<li>Replace the character that is neither alphanumeric nor '_' with '_' (i.e. <code>"com_ACME_size"</code>)</li>
<li>Replace the character that is neither alphanumeric nor '_' with '_' and convert to upper case
(i.e. <code>"COM_ACME_SIZE"</code>)</li>
</ol>
<p>The first environment variable that is found is returned by this ConfigSource.</p>
</li>
<li>/META-INF/microprofile-config.properties (default ordinal=100)</li>
</ol>
Any ConfigSource part of an application will typically use an ordinal between 0 and 200.
ConfigSource provided by the container or 'environment' typically use an ordinal higher than 200.
A framework which intends have values overwritten by the application will use ordinals between 0 and 100.
The property "config_ordinal" can be specified to override the default value.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the ordinal value</dd>
</dl>
</li>
</ul>
<a name="getValue-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValue</h4>
<pre>java.lang.String&nbsp;getValue(java.lang.String&nbsp;propertyName)</pre>
<div class="block">Return the value for the specified property in this config source.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>propertyName</code> - the property name</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the property value</dd>
</dl>
</li>
</ul>
<a name="getName--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getName</h4>
<pre>java.lang.String&nbsp;getName()</pre>
<div class="block">The name of the config might be used for logging or analysis of configured values.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the 'name' of the configuration source, e.g. 'property-file mylocation/myproperty.properties'</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigProviderResolver.html" title="class in org.eclipse.microprofile.config.spi"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/eclipse/microprofile/config/spi/ConfigSourceProvider.html" title="interface in org.eclipse.microprofile.config.spi"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/eclipse/microprofile/config/spi/ConfigSource.html" target="_top">Frames</a></li>
<li><a href="ConfigSource.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>