You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2016/11/21 15:23:35 UTC

svn commit: r1770699 - /sling/site/trunk/content/documentation/bundles/models.mdtext

Author: sseifert
Date: Mon Nov 21 15:23:35 2016
New Revision: 1770699

URL: http://svn.apache.org/viewvc?rev=1770699&view=rev
Log:
SLING-6048/SLING-6308 add docs for Sling-Model-Classes header and BND plugin

Modified:
    sling/site/trunk/content/documentation/bundles/models.mdtext

Modified: sling/site/trunk/content/documentation/bundles/models.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/models.mdtext?rev=1770699&r1=1770698&r2=1770699&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/models.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/models.mdtext Mon Nov 21 15:23:35 2016
@@ -66,6 +66,10 @@ can be listed in a comma-separated list
       org.apache.sling.other.models
     </Sling-Model-Packages>
 
+Alternatively it is possible to list all classes individually that are Sling Models classes via the `Sling-Model-Classes` header.
+
+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' below).
+
 # Client Code
 ## adaptTo()
 
@@ -472,4 +476,30 @@ In addition, model objects can have serv
 
 results in the registration of a servlet with the resource type and extension specified and a selector of 'model' (overridable 
 through the `@Exporter` annotation's `selector` attribute). When this servlet is invoked, the `Resource` will be adapted to the 
-model, exported as a `java.lang.String` (via the named Exporter) and then returned to the client.
\ No newline at end of file
+model, exported as a `java.lang.String` (via the named Exporter) and then returned to the client.
+
+
+# Registration of Sling Models classes via BND plugin (since 1.3.4)
+
+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 `Sling-Model-Classes` header.
+
+Example configuration:
+
+    #!xml
+    <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+            <instructions>
+                <_plugin>org.apache.sling.bnd.models.ModelsScannerPlugin</_plugin>
+            </instructions>
+        </configuration>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>org.apache.sling.bnd.models</artifactId>
+                <version>1.0.0</version>
+            </dependency>
+        </dependencies>
+    </plugin>