sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r1001429 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/models.html
Date Mon, 21 Nov 2016 15:23:51 GMT
Author: buildbot
Date: Mon Nov 21 15:23:50 2016
New Revision: 1001429

Staging update by buildbot for sling

    websites/staging/sling/trunk/content/   (props changed)

Propchange: websites/staging/sling/trunk/content/
--- cms:source-revision (original)
+++ cms:source-revision Mon Nov 21 15:23:50 2016
@@ -1 +1 @@

Modified: websites/staging/sling/trunk/content/documentation/bundles/models.html
--- websites/staging/sling/trunk/content/documentation/bundles/models.html (original)
+++ websites/staging/sling/trunk/content/documentation/bundles/models.html Mon Nov 21 15:23:50
@@ -147,6 +147,7 @@ h2:hover > .headerlink, h3:hover > .head
 <li><a href="#specifying-an-alternate-adapter-class-since-110">Specifying an
Alternate Adapter Class (since 1.1.0)</a></li>
 <li><a href="#associating-a-model-class-with-a-resource-type-since-130">Associating
a Model Class with a Resource Type (since 1.3.0)</a></li>
 <li><a href="#exporter-framework-since-130">Exporter Framework (since 1.3.0)</a></li>
+<li><a href="#registration-of-sling-models-classes-via-bnd-plugin-since-134">Registration
of Sling Models classes via BND plugin (since 1.3.4)</a></li>
 <p>Many Sling projects want to be able to create model objects - POJOs which are automatically
mapped from Sling objects, typically resources, but also request objects. Sometimes these
POJOs need OSGi services as well.</p>
@@ -212,6 +213,8 @@ can be listed in a comma-separated list
+<p>Alternatively it is possible to list all classes individually that are Sling Models
classes via the <code>Sling-Model-Classes</code> header.</p>
+<p>If you use the Sling Models BND plugin all required bundle headers are generated
automatically at build time (see chapter 'Registration of Sling Models classes via BND plugin'
 <h1 id="client-code">Client Code<a class="headerlink" href="#client-code" title="Permanent
 <h2 id="adaptto">adaptTo()<a class="headerlink" href="#adaptto" title="Permanent
 <p>Client code doesn't need to be aware that Sling Models is being used. It just uses
the Sling Adapter framework:</p>
@@ -735,8 +738,46 @@ currently includes a single exporter, us
 <p>results in the registration of a servlet with the resource type and extension specified
and a selector of 'model' (overridable 
 through the <code>@Exporter</code> annotation's <code>selector</code>
attribute). When this servlet is invoked, the <code>Resource</code> will be adapted
to the 
 model, exported as a <code>java.lang.String</code> (via the named Exporter) and
then returned to the client.</p>
+<h1 id="registration-of-sling-models-classes-via-bnd-plugin-since-134">Registration
of Sling Models classes via BND plugin (since 1.3.4)<a class="headerlink" href="#registration-of-sling-models-classes-via-bnd-plugin-since-134"
title="Permanent link">&para;</a></h1>
+<p>Since Sling Models Implementation 1.3.4 it is possible to automatically generated
the necessary bundle header to register the Sling Models classes contained in the Maven bundle
project by using the Sling Models BND plugin - either with maven-bundle-plugin or with bnd-maven-plugin.
By default the plugin generates a <code>Sling-Model-Classes</code> header.</p>
+<p>Example configuration:</p>
+<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre>
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+17</pre></div></td><td class="code"><div class="codehilite"><pre><span
+    <span class="nt">&lt;groupId&gt;</span>org.apache.felix<span class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>maven-bundle-plugin<span
+    <span class="nt">&lt;extensions&gt;</span>true<span class="nt">&lt;/extensions&gt;</span>
+    <span class="nt">&lt;configuration&gt;</span>
+        <span class="nt">&lt;instructions&gt;</span>
+            <span class="nt">&lt;_plugin&gt;</span><span
+        <span class="nt">&lt;/instructions&gt;</span>
+    <span class="nt">&lt;/configuration&gt;</span>
+    <span class="nt">&lt;dependencies&gt;</span>
+        <span class="nt">&lt;dependency&gt;</span>
+            <span class="nt">&lt;groupId&gt;</span><span
+            <span class="nt">&lt;artifactId&gt;</span><span
+            <span class="nt">&lt;version&gt;</span>1.0.0<span class="nt">&lt;/version&gt;</span>
+        <span class="nt">&lt;/dependency&gt;</span>
+    <span class="nt">&lt;/dependencies&gt;</span>
+<span class="nt">&lt;/plugin&gt;</span>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1770697 by sseifert on Mon, 21 Nov 2016 15:15:30 +0000
+        Rev. 1770699 by sseifert on Mon, 21 Nov 2016 15:23:35 +0000
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project

View raw message