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 2017/05/03 16:50:49 UTC

svn commit: r1011578 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/content-loading-jcr-contentloader.html

Author: buildbot
Date: Wed May  3 16:50:48 2017
New Revision: 1011578

Log:
Staging update by buildbot for sling

Modified:
    websites/staging/sling/trunk/content/   (props changed)
    websites/staging/sling/trunk/content/documentation/bundles/content-loading-jcr-contentloader.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed May  3 16:50:48 2017
@@ -1 +1 @@
-1793496
+1793675

Modified: websites/staging/sling/trunk/content/documentation/bundles/content-loading-jcr-contentloader.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/content-loading-jcr-contentloader.html (original)
+++ websites/staging/sling/trunk/content/documentation/bundles/content-loading-jcr-contentloader.html Wed May  3 16:50:48 2017
@@ -151,11 +151,11 @@ h2:hover > .headerlink, h3:hover > .head
 <tbody>
 <tr>
 <td>Directory</td>
-<td>Created as a node of type <code>nt:folder</code> unless a content definition file of the same name exists in the same directory as the directory to be installed. Example: A directory <code>SLING-INF/content/dir</code> is installed as node <code>/dir</code> of type <code>nt:folder</code> unless a <code>SLING-INF/content/dir.xml</code> or <code>SLING-INF/content/dir.json</code> file exists which defines the content for the <code>/dir</code> node.</td>
+<td>Created as a node of type <code>sling:Folder</code> unless a content definition file of the same name exists in the same directory as the directory to be installed. Example: A directory <code>SLING-INF/content/dir</code> is installed as node <code>/dir</code> of type <code>nt:folder</code> unless a <code>SLING-INF/content/dir.xml</code> or <code>SLING-INF/content/dir.json</code> file exists which defines the content for the <code>/dir</code> node.</td>
 </tr>
 <tr>
 <td>File</td>
-<td>Unless the file is a content definition file (see below) an <code>nt:file</code> node is created for the file and an <code>nt:resource</code> node is created as its <code>jcr:content</code> child node to take the contents of the bundle file. The properties of the <code>nt:resource</code> node are set from file information as available. If the file is a content definition file, the content is created as defined in the file. See below for the content definition file specification.</td>
+<td>Unless the file is a content definition file (see below) an <code>nt:file</code> node is created for the file and an <code>nt:resource</code> node is created as its <code>jcr:content</code> child node to take the contents of the bundle file. The properties of the <code>nt:resource</code> node are set from file information as available. If a content definition file exists with the same name as the file plus <code>.json</code> or <code>.xml</code> these properties are set additionally on the imported file. See below for the content definition file specification.</td>
 </tr>
 </tbody>
 </table>
@@ -395,6 +395,37 @@ primary node type "nt:file". Underneath
 <p>By default, the <code>sling-jcr-contentloader</code> bundle tries to extract certain file types during content loading. These include <code>json</code>, <code>xml</code>, <code>zip</code>, and <code>jar</code> files. Therefore all available extractors are used for content processing. However if some files should be put into the repository unextracted, the <code>ignoreImportProviders</code> directive can be used with a comma separated list of extensions that should not be extracted, like <code>ignoreImportProviders:="jar,zip"</code>. Please note that the value needs to be put into quotation marks if more than one value is used like in the example.</p>
 <h3 id="workspace-targetting">Workspace Targetting<a class="headerlink" href="#workspace-targetting" title="Permanent link">&para;</a></h3>
 <p>By default, initial content will be loaded into the default workspace. To override this, add a <code>Sling-Initial-Content-Workspace</code> bundle manifest header to specify the workspace. Note that <em>all</em> content from a bundle will be loaded into the same workspace. </p>
+<h3 id="example-load-i18n-json-files">Example: Load i18n JSON files<a class="headerlink" href="#example-load-i18n-json-files" title="Permanent link">&para;</a></h3>
+<p>The Sling Internationalization Support (i18n) supports providing JSON-filed based i18n files (see <a href="https://sling.apache.org/documentation/bundles/internationalization-support-i18n.html#json-file-based">i18n documentation</a>).
+In this case the JSON file is not interpreted as content definition file, but is stored as binary file in the repository.
+Additionally a mixin <code>mix:language</code> and a property <code>jcr:language</code> with the language code has to be set on the file node.</p>
+<p>This is an example how such an i18n file can be loaded from an OSGi bundle with the Sling Content Loader.</p>
+<p>Within your bundle header you have to define a separate path for the i18n files where you have to explicitly disable the JSON provider:</p>
+<div class="codehilite"><pre><span class="nt">&lt;Sling-Initial-Content&gt;</span>
+    SLING-INF/i18n;overwrite:=true;ignoreImportProviders:=json;path:=/apps/myapp/i18n
+<span class="nt">&lt;/Sling-Initial-Content&gt;</span>
+</pre></div>
+
+
+<p>The folder <code>SLING-INF/i18n</code> from your bundles contains a pair of files for each language, e.g.:</p>
+<ul>
+<li><code>en.json</code> - The JSON file containing the i18n keys</li>
+<li><code>en.json.xml</code> - Additional content descriptor file setting the mixing and language property</li>
+</ul>
+<p>Example for the content descriptor:</p>
+<div class="codehilite"><pre><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
+<span class="nt">&lt;node&gt;</span>
+    <span class="nt">&lt;name&gt;</span>en.json<span class="nt">&lt;/name&gt;</span>
+    <span class="nt">&lt;mixinNodeType&gt;</span>mix:language<span class="nt">&lt;/mixinNodeType&gt;</span>
+    <span class="nt">&lt;property&gt;</span>
+        <span class="nt">&lt;name&gt;</span>jcr:language<span class="nt">&lt;/name&gt;</span>
+        <span class="nt">&lt;value&gt;</span>en<span class="nt">&lt;/value&gt;</span>
+        <span class="nt">&lt;type&gt;</span>String<span class="nt">&lt;/type&gt;</span>
+    <span class="nt">&lt;/property&gt;</span>
+<span class="nt">&lt;/node&gt;</span>
+</pre></div>
+
+
 <h2 id="declared-node-type-registration">Declared Node Type Registration<a class="headerlink" href="#declared-node-type-registration" title="Permanent link">&para;</a></h2>
 <p>The <code>sling-jcr-base</code> bundle provides low-level repository operations which are at the heart of the functionality of Sling:
 <em> </em>Node Type Definitions* - The class <code>org.apache.sling.content.jcr.base.NodeTypeLoader</code> provides methods to register custom node types with a repository given a repository session and a node type definition file in CND format. This class is also used by this bundle to register node types on behalf of other bundles.</p>
@@ -410,7 +441,7 @@ Support for re-registration of node type
 <p>The initial content found in the <a href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/content/src/main/resources/content/sling-test">sling-test folder of the launchpad initial content</a> is verified by the <a href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/InitialContentTest.java">InitialContentTest</a> when running the <em>launchpad/testing</em> integration tests.</p>
 <p>Those tests can be used as verified examples of initial content loading. Contributions are welcome to improve the coverage of those tests.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1788421 by kwin on Fri, 24 Mar 2017 12:06:38 +0000
+        Rev. 1793675 by sseifert on Wed, 3 May 2017 16:50:30 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project