You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bu...@apache.org on 2016/11/19 05:02:34 UTC

svn commit: r1001343 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/context-aware-configuration/

Author: buildbot
Date: Sat Nov 19 05:02:34 2016
New Revision: 1001343

Log:
Staging update by buildbot for sling

Added:
    websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html
Modified:
    websites/staging/sling/trunk/content/   (props changed)
    websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration-spi.html
    websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Nov 19 05:02:34 2016
@@ -1 +1 @@
-1770354
+1770469

Added: websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html (added)
+++ websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html Sat Nov 19 05:02:34 2016
@@ -0,0 +1,187 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>Apache Sling - Apache Sling Context-Aware Configuration - Override</title>
+    <link rel="icon" href="/res/favicon.ico">
+    <link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
+    <link rel="stylesheet" href="/res/codehilite.css" type="text/css" media="all">
+  </head>
+  <body>
+    <div class="title">
+      <div class="logo">
+        <a href="//sling.apache.org/">
+          <img border="0" alt="Apache Sling" src="/res/logo.png">
+        </a>
+      </div>
+      <div class="header">
+        <a href="//www.apache.org/">
+          <img border="0" alt="Apache" src="/res/apache.png">
+        </a>
+      </div>
+    </div>
+    
+    <div class="menu"> 
+      <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<p><strong><a href="/documentation.html">Documentation</a></strong> <br />
+<a href="/documentation/getting-started.html">Getting Started</a> <br />
+<a href="/documentation/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/documentation/development.html">Development</a> <br />
+<a href="/documentation/bundles.html">Bundles</a> <br />
+<a href="/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/documentation/configuration.html">Configuration</a>   </p>
+<p><a href="http://s.apache.org/sling.wiki">Wiki</a> <br />
+<a href="http://s.apache.org/sling.faq">FAQ</a>   </p>
+<p><strong>API Docs</strong>  <br />
+<a href="/apidocs/sling8/index.html">Sling 8</a> <br />
+<a href="/apidocs/sling7/index.html">Sling 7</a> <br />
+<a href="/apidocs/sling6/index.html">Sling 6</a> <br />
+<a href="/apidocs/sling5/index.html">Sling 5</a> <br />
+<a href="/javadoc-io.html">Archive at javadoc.io</a>   </p>
+<p><strong>Project info</strong> <br />
+<a href="/downloads.cgi">Downloads</a> <br />
+<a href="http://www.apache.org/licenses/">License</a> <br />
+<a href="/contributing.html">Contributing</a> <br />
+<a href="/news.html">News</a> <br />
+<a href="/links.html">Links</a> <br />
+<a href="/project-information.html">Project Information</a> <br />
+<a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a> <br />
+<a href="http://ci.apache.org/builders/sling-trunk">Build Server</a> <br />
+<a href="/project-information/security.html">Security</a>   </p>
+<p><strong>Source</strong> <br />
+<a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a> <br />
+<a href="git://git.apache.org/sling.git">Git</a> <br />
+<a href="https://github.com/apache/sling">Github Mirror</a>   </p>
+<p><strong>Sponsorship</strong> <br />
+<a href="http://www.apache.org/foundation/thanks.html">Thanks</a> <br />
+<a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a> <br />
+<a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a>   </p>
+<p><strong><a href="/sitemap.html">Site Map</a></strong></p>
+<!-- no valid ads for now, we'll  reactivate this when needed
+<iframe 
+    src="http://www.apache.org/ads/button.html"
+    style="border-width:0; float: left" frameborder="0" 
+    scrolling="no"
+    width="135" 
+    height="135">
+</iframe>
+-->
+    </div>
+    
+    <div class="main">
+      <div class="breadcrump" style="font-size: 80%;">
+        <a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/documentation.html">Documentation</a>&nbsp;&raquo&nbsp;<a href="/documentation/bundles.html">Bundles</a>
+      </div>
+
+      
+      
+      <h1>Apache Sling Context-Aware Configuration - Override</h1>
+      <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<div class="toc">
+<ul>
+<li><a href="#about">About</a></li>
+<li><a href="#override-syntax">Override syntax</a></li>
+<li><a href="#built-in-override-providers">Built-in override providers</a><ul>
+<li><a href="#override-via-system-properties">Override via system properties</a></li>
+<li><a href="#override-via-osgi-configuration">Override via OSGi configuration</a></li>
+</ul>
+</li>
+</ul>
+</div>
+<h1 id="about">About<a class="headerlink" href="#about" title="Permanent link">&para;</a></h1>
+<p>Using overrides it is possible to override context-aware configuration globally or for specific content paths (and their subtrees) within an instance. This overrides the configuration read and inherited by the default ways.</p>
+<p>An example use case is to overwrite the Site URLs on your staging system which has a copy of the configuration content of the production system installed.</p>
+<p>Via the <a href="http://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-spi.html">SPI</a> you can add your own override providers - but in most cases the built-in ones described in this page are sufficient. All override providers use the same override syntax.</p>
+<h1 id="override-syntax">Override syntax<a class="headerlink" href="#override-syntax" title="Permanent link">&para;</a></h1>
+<p>Generally an override consists of one single line. Syntax examples:</p>
+<div class="codehilite"><pre><span class="p">{</span><span class="n">configName</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">propertyName</span><span class="p">}={</span><span class="n">propertyJsonValue</span><span class="p">}</span>
+<span class="p">{</span><span class="n">configName</span><span class="p">}={</span><span class="n">propertyJsonObject</span><span class="p">}</span>
+<span class="p">[{</span><span class="n">contextPath</span><span class="p">}]{</span><span class="n">configName</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">propertyName</span><span class="p">}={</span><span class="n">propertyJsonValue</span><span class="p">}</span>
+<span class="p">[{</span><span class="n">contextPath</span><span class="p">}]{</span><span class="n">configName</span><span class="p">}={</span><span class="n">propertyJsonObject</span><span class="p">}</span>
+</pre></div>
+
+
+<p>The different parts:</p>
+<ul>
+<li><code>{configName}</code> - Configuration name - can be a relative path with sub-resources</li>
+<li><code>{propertyName}</code> - Property name</li>
+<li><code>{propertyJsonValue}</code> - Property value in JSON value syntax.</li>
+<li><code>{propertyJsonObject}</code> - If the property name is missing a JSON object can be defined containing all properties as key-value pairs.</li>
+<li><code>{contextPath}</code> - If the context path is missing, the override is applied to all context path. If it is defined (enclosed in brackets), the override is applied only to this content path and it's subtree.</li>
+</ul>
+<p>When the syntax <code>{configName}/{propertyName}={propertyJsonValue}</code> is used, only this specific property is overwritten leaving all other properties in the configuration resource untouched. When the syntax <code>{configName}={propertyJsonObject}</code> is used, all configuration properties in the configuration resources are replaced with the set from the JSON object.</p>
+<p>Override string examples with real values:</p>
+<div class="codehilite"><pre><span class="n">my</span><span class="o">-</span><span class="n">config</span><span class="o">/</span><span class="n">property1</span><span class="p">=</span>&quot;<span class="n">value</span> 1&quot;
+<span class="n">my</span><span class="o">-</span><span class="n">config</span><span class="o">/</span><span class="n">sub1</span><span class="o">/</span><span class="n">property1</span><span class="p">=</span><span class="s">&#39;value 1&#39;</span>
+<span class="n">my</span><span class="o">-</span><span class="n">config</span><span class="o">/</span><span class="n">property1</span><span class="p">=[</span><span class="s">&#39;value 1&#39;</span><span class="p">,</span><span class="s">&#39;value 2&#39;</span><span class="p">]</span>
+<span class="n">my</span><span class="o">-</span><span class="n">config</span><span class="o">/</span><span class="n">property1</span><span class="p">=</span>123
+<span class="n">x</span><span class="p">.</span><span class="n">y</span><span class="p">.</span><span class="n">z</span><span class="p">.</span><span class="n">MyConfig</span><span class="p">={</span><span class="n">prop1</span><span class="p">=</span><span class="s">&#39;value1&#39;</span><span class="p">,</span> <span class="n">prop2</span><span class="p">=[</span>1<span class="p">,</span>2<span class="p">,</span>3<span class="p">],</span> <span class="n">prop3</span><span class="p">=</span><span class="n">true</span><span class="p">,</span> <span class="n">prop4</span><span class="p">=</span>1<span class="p">.</span>23<span class="p">}</span>
+<span class="p">[</span><span class="o">/</span><span class="n">content</span><span class="o">/</span><span class="n">region1</span><span class="p">]</span><span class="n">my</span><span class="o">-</span><span class="n">config</span><span class="o">/</span><span class="n">property1</span><span class="p">=</span><span class="s">&#39;value 1&#39;</span>
+<span class="p">[</span><span class="o">/</span><span class="n">content</span><span class="o">/</span><span class="n">region1</span><span class="p">]</span><span class="n">my</span><span class="o">-</span><span class="n">config</span><span class="o">/</span><span class="n">sub1</span><span class="p">={</span><span class="n">prop1</span><span class="p">=</span>&quot;<span class="n">value</span> 1&quot;<span class="p">}</span>
+</pre></div>
+
+
+<p>If multiple statements are defined affecting the same content path, configuration name and property name, they overwrite each other. That means the override string defined last wins.</p>
+<h1 id="built-in-override-providers">Built-in override providers<a class="headerlink" href="#built-in-override-providers" title="Permanent link">&para;</a></h1>
+<h2 id="override-via-system-properties">Override via system properties<a class="headerlink" href="#override-via-system-properties" title="Permanent link">&para;</a></h2>
+<p>Allows to define configuration property overrides from system environment properties.</p>
+<p>The parameters are defined when starting the JVM using the -D command line parameter. Each parameter contains an override string. All parameter names have to be prefixed with the string <code>sling.caconfig.override.</code>.</p>
+<p>Example:</p>
+<div class="codehilite"><pre><span class="o">-</span><span class="n">Dsling</span><span class="p">.</span><span class="n">caconfig</span><span class="p">.</span><span class="n">override</span><span class="p">.</span><span class="n">my</span><span class="o">-</span><span class="n">config</span><span class="o">/</span><span class="n">sub1</span><span class="o">/</span><span class="n">property1</span><span class="p">=</span>123
+<span class="o">-</span><span class="n">D</span>&quot;<span class="n">sling</span><span class="p">.</span><span class="n">caconfig</span><span class="p">.</span><span class="n">override</span><span class="p">.</span><span class="n">my</span><span class="o">-</span><span class="n">config</span><span class="o">/</span><span class="n">property1</span><span class="p">=[</span><span class="s">&#39;value 1&#39;</span><span class="p">,</span><span class="s">&#39;value 2&#39;</span><span class="p">]</span>&quot;
+<span class="o">-</span><span class="n">D</span>&quot;<span class="n">sling</span><span class="p">.</span><span class="n">caconfig</span><span class="p">.</span><span class="n">override</span><span class="p">.[</span><span class="o">/</span><span class="n">content</span><span class="o">/</span><span class="n">region1</span><span class="p">]</span><span class="n">x</span><span class="p">.</span><span class="n">y</span><span class="p">.</span><span class="n">z</span><span class="p">.</span><span class="n">MyConfig</span><span class="p">={</span><span class="n">prop1</span><span class="p">=</span><span class="s">&#39;value1&#39;</span><span class="p">,</span> <span class="n">prop2</span><span class="p">=[</span>1<span class="p">,</span>2<span class="p">,</span>3<span class="p">],</span> <span class="n">prop3</span><span class="p">=</span><span class="n">true</span><span class="p">,</span> <span class="n">prop4</span><span class="p">=</span>1<span class="p">.</span>23<span class="p">}</
 span>&quot;
+</pre></div>
+
+
+<p>This provider is not active by default, it has to be activated via OSGi configuration ("Apache Sling Context-Aware System Property Configuration Override Provider").</p>
+<h2 id="override-via-osgi-configuration">Override via OSGi configuration<a class="headerlink" href="#override-via-osgi-configuration" title="Permanent link">&para;</a></h2>
+<p>Allows to define configuration property overrides from OSGi configuration.</p>
+<p>You can provide multiple providers using a factory configuration ("Apache Sling Context-Aware OSGi Configuration Override Provider"), each of them provides list of override strings.</p>
+      <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+        Rev. 1770469 by sseifert on Sat, 19 Nov 2016 05:02:17 +0000
+      </div>
+      <div class="trademarkFooter"> 
+        Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
+        logo are trademarks of The Apache Software Foundation. All other marks mentioned
+        may be trademarks or registered trademarks of their respective owners.
+      </div>
+    </div>
+  </body>
+</html>

Modified: websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration-spi.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration-spi.html (original)
+++ websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration-spi.html Sat Nov 19 05:02:34 2016
@@ -120,8 +120,10 @@ h2:hover > .headerlink, h3:hover > .head
 <li><a href="#general-principles">General principles</a></li>
 <li><a href="#context-path-strategy">Context Path Strategy</a></li>
 <li><a href="#configuration-resource-resolver-strategy">Configuration Resource Resolver Strategy</a></li>
+<li><a href="#configuration-inheritance-strategy">Configuration Inheritance Strategy</a></li>
 <li><a href="#configuration-persistence-strategy">Configuration Persistence Strategy</a></li>
 <li><a href="#configuration-metadata-provider">Configuration Metadata Provider</a></li>
+<li><a href="#configuration-override-provider">Configuration Override Provider</a></li>
 </ul>
 </div>
 <h1 id="about">About<a class="headerlink" href="#about" title="Permanent link">&para;</a></h1>
@@ -140,13 +142,18 @@ h2:hover > .headerlink, h3:hover > .head
 <p>E.g. you could implement detecting context paths by project-specific conventions.</p>
 <h1 id="configuration-resource-resolver-strategy">Configuration Resource Resolver Strategy<a class="headerlink" href="#configuration-resource-resolver-strategy" title="Permanent link">&para;</a></h1>
 <p>By providing an implementation of <code>org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy</code> you can define where configuration data is looked up, and how resource and property inheritance is handled.</p>
+<h1 id="configuration-inheritance-strategy">Configuration Inheritance Strategy<a class="headerlink" href="#configuration-inheritance-strategy" title="Permanent link">&para;</a></h1>
+<p>By providing an implementation of <code>org.apache.sling.caconfig.spi.ConfigurationInheritanceStrategy</code> you can define if and how resource are inherited across the inheritance chain.</p>
 <h1 id="configuration-persistence-strategy">Configuration Persistence Strategy<a class="headerlink" href="#configuration-persistence-strategy" title="Permanent link">&para;</a></h1>
 <p>By providing an implementation of <code>org.apache.sling.caconfig.spi.ConfigurationPersistenceStrategy</code> you can define the peristence structure of the configuration within the configuration resources.</p>
 <p>E.g. you could use a specific JCR node type or slightly different content structure to store the configuration data.</p>
 <h1 id="configuration-metadata-provider">Configuration Metadata Provider<a class="headerlink" href="#configuration-metadata-provider" title="Permanent link">&para;</a></h1>
 <p>By providing an implementation of <code>org.apache.sling.caconfig.spi.ConfigurationMetadataProvider</code> you can provide information about configuration metadata from other sources than annotation classes.</p>
+<h1 id="configuration-override-provider">Configuration Override Provider<a class="headerlink" href="#configuration-override-provider" title="Permanent link">&para;</a></h1>
+<p>By providing an implementation of <code>org.apache.sling.caconfig.spi.ConfigurationOverrideProvider</code> you can provide your own overrides - if the built-in override provider do not fit your needs.</p>
+<p>See <a href="http://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html">Override</a> for the list of built-in providers and the override syntax.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1764991 by sseifert on Fri, 14 Oct 2016 22:24:50 +0000
+        Rev. 1770469 by sseifert on Sat, 19 Nov 2016 05:02:17 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project

Modified: websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration.html (original)
+++ websites/staging/sling/trunk/content/documentation/bundles/context-aware-configuration/context-aware-configuration.html Sat Nov 19 05:02:34 2016
@@ -281,14 +281,16 @@ the applications/libraries you use, or y
 <h1 id="customizing-the-configuration-lookup">Customizing the configuration lookup<a class="headerlink" href="#customizing-the-configuration-lookup" title="Permanent link">&para;</a></h1>
 <p>The Context-Aware Configuration implementation provides a set of Service Provider Interfaces (SPI) that allows you to overlay, enhance or replace the default implementation and adapt it to your needs.</p>
 <p>See <a href="http://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-spi.html">SPI</a> for details.</p>
+<p>You can also override specific context-aware configuration within an instance - see <a href="http://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html">Override</a> for details.</p>
 <h1 id="references">References<a class="headerlink" href="#references" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="http://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-default-implementation.html">Context-Aware Configuration - Default Implementation</a></li>
 <li><a href="http://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-spi.html">Context-Aware Configuration - SPI</a></li>
+<li><a href="http://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html">Context-Aware Configuration - Override</a></li>
 <li><a href="https://adapt.to/2016/en/schedule/sling-context-aware-configuration.html">Sling Context-Aware Configuration - Talk from adaptTo() 2016</a></li>
 </ul>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1764991 by sseifert on Fri, 14 Oct 2016 22:24:50 +0000
+        Rev. 1770469 by sseifert on Sat, 19 Nov 2016 05:02:17 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project