You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2017/06/19 12:41:54 UTC
[48/53] sling-site git commit: asf-site branch created for published
content
http://git-wip-us.apache.org/repos/asf/sling-site/blob/a6129baf/documentation/bundles/mime-type-support-commons-mime.html
----------------------------------------------------------------------
diff --git a/documentation/bundles/mime-type-support-commons-mime.html b/documentation/bundles/mime-type-support-commons-mime.html
new file mode 100644
index 0000000..e893e0c
--- /dev/null
+++ b/documentation/bundles/mime-type-support-commons-mime.html
@@ -0,0 +1,95 @@
+<!DOCTYPE html><html lang="en">
+ <head>
+<meta charset="utf-8"/>
+ <title>Apache Sling on JBake</title>
+ <link rel="stylesheet" href="/res/css/site.css"/>
+ <link rel="stylesheet" href="/res/css/codehilite.css"/>
+ <div class="title">
+ <div class="logo">
+ <a href="http://sling.apache.org">
+ <img border="0" alt="Apache Sling" src="/res/logos/sling.svg"/>
+ </a>
+ </div><div class="header">
+ <a href="http://www.apache.org">
+ <img border="0" alt="Apache" src="/res/logos/apache.png"/>
+ </a>
+ </div>
+ </div>
+ </head><body>
+<div class="menu">
+ <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 & 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><br/><p></p><strong>API Docs</strong><br/><a href="/apidocs/sling9/index.html">Sling 9</a><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><br/><p></p><strong>Project info</strong><br/><a h
ref="/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><br/><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><br/><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="https://donate.apache.org/">Donate!</a><br/><a href="http://www.apache.org/foun
dation/buy_stuff.html">Buy Stuff</a><br/><p></p><strong><a href="/sitemap.html">Site Map</a></strong>
+ </div> <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>MIME Type Support (commons.mime and commons.contentdetection)</h1></header><p>Support for MIME type mappings is generally a problematic issue. On the one hand applications have to take care to stay up to date with their mappings on the other hands in web applications it is tedious to maintain the mappings. Apache Sling takes a very user and deployment friendly approadch to this problem which is described in detail on this page.</p>
+<p>[TOC]</p>
+<h2>Servlet API Support</h2>
+<p>The Servlet API specification provides a limited support for MIME type mappings :</p>
+<ul>
+ <li>Mappings may be defined in the <code>mime-mapping</code> elements of the the web application descriptor <code>web.xml</code>. Managing these mappings is presumably tedious. So servlet containers may provide reasonable defaults (or not).</li>
+ <li>The <code>ServletContext.getMimeType(String)</code> returns a MIME type for a given file name based on the extension of the filename. The mapping returned is based on the servlet container configuration as well as the web application descriptor's <code>mime-mapping</code> elements.</li>
+</ul>
+<h2>The Sling MimeTypeService</h2>
+<p>Already at the start of the Sling project we realized, that just basing the MIME type mapping decisions on the servlet container will not yield acceptable results. For this reason the Apache Sling projects provides a spezialized and configurable service supporting such mappings: The <a href="/apidocs/sling6/org/apache/sling/commons/mime/MimeTypeService.html"><code>MimeTypeService</code></a> provided by the <code>org.apache.sling.commons.mime</code> bundle.</p>
+<p>This service provides access to registered MIME types and their mappings with two methods:</p>
+<ul>
+ <li><code>getExtension(String)</code> -- given a MIME type this methods returns a primary extension. For example for the type <code>text/plain</code> this method will return <code>txt</code></li>
+ <li><code>getMimeType(String)</code> -- given a file name or just the extension) returns the mapped MIME type. For example for the filename <code>sample.html</code> (or just the extension <code>html</code>) this method will return <code>text/html</code></li>
+</ul>
+<p>Two more methods allow to programmatically add MIME type mappings:</p>
+<ul>
+ <li><code>registerMimeType(InputStream)</code> registers additional mappings from the given input stream which is expected to be formated in traditional <code>mime.types</code> file format (see below).</li>
+ <li><code>registerMimeType(String, String...)</code> registers a single mapping for the give MIME type and the respective extensions.</li>
+</ul>
+<h2>The Sling ContentAwareMimeTypeService</h2>
+<p>For content-based mime type detection (as opposed to filename-based detection), the <code>org.apache.sling.commons.contentdetection</code> bundle provides the <code>ContentAwareMimeTypeService</code>, which takes an <code>InputStream</code> that's analyzed to detect its mime type, using Apache Tika by default:</p>
+<ul>
+ <li><code>getMimeType(String filename, InputStream content)</code> -- given a filename and an <code>InputStream</code> that points to the file contents, this method first tries content-based detection using the stream, and falls back to filename-based detection if needed.</li>
+</ul>
+<h2>And More...</h2>
+<p>Besides the <code>MimeTypeService</code> provided by Apache Sling, there is actually more:</p>
+<ul>
+ <li>The <a href="/apidocs/sling6/org/apache/sling/api/SlingHttpServletRequest.html"><code>SlingHttpServletRequest</code></a> provides the <code>getResponseContentType()</code> method, which returns the preferred <em>Content-Type</em> for the response based on the requests extension. This method is implemented by Apache Sling using the <code>MimeTypeService</code>. So servlets and scripts may just call this method to set the content type of the response to the desired value.</li>
+ <li>Each Servlet (and JSP scripts) is initialized by Apache Sling with a <code>ServletContext</code> instance whose implementation of the <code>getMimeType(String)</code> effectively calls the <code>MimeTypeService.getMimeType(String)</code> method.</li>
+ <li>The Scripting support infrastructure of Sling sets the response content type on behalf of the script to the default value as returned by the <code>SlingHttpServletRequest.getResponseContentType()</code> method. At the same time the response character set is also set to <code>UTF-8</code> for <em>text</em> content types.</li>
+</ul>
+<h2>Configuring MIME Type Mappings</h2>
+<p>The implementation of the <code>MimeTypeService</code> in the Apache Sling MIME type mapping support (<code>org.apache.sling.commons.mime</code>) bundle supports a numnber of ways to configure and extend the set of MIME type mappings:</p>
+<ul>
+ <li>Default configuration. The default configuration is based on the <a href="http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types"><code>mime.types</code></a> file maintained by Roy Fielding for the Apache httpd project and some extensions by Apache Sling.</li>
+ <li>Bundle provided mappings. Bundles registered in the OSGi framework may contain MIME type mappings files <code>META-INF/mime.types</code> which are loaded automatically by the Apache Sling MIME type mapping support bundle.</li>
+ <li>Configuration. Mappings may be supplied by configuration of the <code>MimeTypeService</code> implementation as the multi-value string property <code>mime.types</code>. Each value of the property corresponds to a line in a MIME type configuration file (see below for the format).</li>
+ <li>Registered Mappings. Mappings may be registered with the <code>MimeTypeService.registerMapping</code> methods.</li>
+ <li><a href="/apidocs/sling6/org/apache/sling/commons/mime/MimeTypeProvider.html"><code>MimeTypeProvider</code></a>. Additional mappings may be provided by service implementing the <code>MimeTypeProvider</code> interface. The <code>MimeTypeService</code> implementation will call these services in turn until a service returns a mapping provided there is no static configuration to responde to the mapping request.</li>
+</ul>
+<p>Please note, that existing mappings cannot be overwritten later. Thus mappings have an inherent priority:</p>
+<ol>
+ <li>Mappings provided by the Apache httpd project's <code>mime.types</code> file</li>
+ <li>Extensions by the Apache Sling MIME type mapping support bundle</li>
+ <li>Bundles providing a <code>META-INF/mime.types</code> file in the order of their bundle-id (or startup order if started after the MIME type mapping support bundle)</li>
+ <li>OSGi Configuration. Note that bundles started <em>after</em> the MIME type mapping support bundle may not overwrite mappings provided by the OSGi configuration. This may sounds like a problem, but in reality this should genrally not matter</li>
+ <li>Mappings registered calling the <code>MimeTypeService.registerMimeType</code> method</li>
+ <li>Mappings provided by <code>MimeTypeProvider</code> services</li>
+</ol>
+<h2>MIME Type Mapping File Format</h2>
+<p>The file format for MIME type mapping files is rather simple:</p>
+<ul>
+ <li>The files are assumed to be encoded with the <em>ISO-8859-1</em> (aka Latin 1) character encoding</li>
+ <li>The files consist of lines defining mappings where each line is terminated with either or both of a carriage return (CR, 0x0c) and line feed character (LF, 0x0a). There is no line continuation support *-la shell scripts or Java properties files.
+</li>
+ <li>Empty lines and lines starting with a hash sign (<code>#</code>) are ignored</li>
+ <li>Data lines consist of space (any whitespace matching the <code>s</code> regular expression) separated values. The first value is the MIME type name and the remaining values defining mappings to file name extensions. The first listed file name extension is considered the <em>default mapping</em> and is returned by the <code>MimeTypeService.getExtension(String)</code> method. Entry lines consisting of just a mime type but no extensions are also (currently) ignored.</li>
+</ul>
+<p>THe data line format described here also applies to configuration provided by the values of the <code>mime.types</code> property of the MIME type service configuration. The file format description applies to all <code>META-INF/mime.types</code> files provided by the bundles as well as input streams supplied to the <code>MimeTypeService.registerMimeType(InputStream)</code> method.</p>
+<h2>Web Console Plugin</h2>
+<p>The Apache Sling MIME type mapping support bundle implements a plugin for the Apache Felix Web Console which may be consulted to investigate the current contents of the MIME type mapping tables.</p>
+<p><img src="/documentation/bundles/mimetypes.png" alt="Mime Types Web Console Plugin" /></p></section></div></div>
+<div class="footer">
+ <div class="timestamp">
+ TODO display revision number here
+ </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>
+
+ </div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/sling-site/blob/a6129baf/documentation/bundles/models.html
----------------------------------------------------------------------
diff --git a/documentation/bundles/models.html b/documentation/bundles/models.html
new file mode 100644
index 0000000..9245ecd
--- /dev/null
+++ b/documentation/bundles/models.html
@@ -0,0 +1,411 @@
+<!DOCTYPE html><html lang="en">
+ <head>
+<meta charset="utf-8"/>
+ <title>Apache Sling on JBake</title>
+ <link rel="stylesheet" href="/res/css/site.css"/>
+ <link rel="stylesheet" href="/res/css/codehilite.css"/>
+ <div class="title">
+ <div class="logo">
+ <a href="http://sling.apache.org">
+ <img border="0" alt="Apache Sling" src="/res/logos/sling.svg"/>
+ </a>
+ </div><div class="header">
+ <a href="http://www.apache.org">
+ <img border="0" alt="Apache" src="/res/logos/apache.png"/>
+ </a>
+ </div>
+ </div>
+ </head><body>
+<div class="menu">
+ <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 & 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><br/><p></p><strong>API Docs</strong><br/><a href="/apidocs/sling9/index.html">Sling 9</a><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><br/><p></p><strong>Project info</strong><br/><a h
ref="/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><br/><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><br/><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="https://donate.apache.org/">Donate!</a><br/><a href="http://www.apache.org/foun
dation/buy_stuff.html">Buy Stuff</a><br/><p></p><strong><a href="/sitemap.html">Site Map</a></strong>
+ </div> <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>Sling Models</h1></header><p>[TOC]</p>
+<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>
+<h1>Design Goals</h1>
+<ul>
+ <li>Entirely annotation driven. "Pure" POJOs.</li>
+ <li>Use standard annotations where possible.</li>
+ <li>Pluggable</li>
+ <li>OOTB, support resource properties (via ValueMap), SlingBindings, OSGi services, request attributes</li>
+ <li>Adapt multiple objects - minimal required Resource and SlingHttpServletRequest</li>
+ <li>Client doesn't know/care that these objects are different than any other adapter factory</li>
+ <li>Support both classes and interfaces.</li>
+ <li>Work with existing Sling infrastructure (i.e. not require changes to other bundles).</li>
+</ul>
+<h1>Basic Usage</h1>
+<p>In the simplest case, the class is annotated with <code>@Model</code> and the adaptable class. Fields which need to be injected are annotated with <code>@Inject</code>:</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>@Inject private String propertyName; }</p>
+<p>In this case, a property named "propertyName" will be looked up from the Resource (after first adapting it to a <code>ValueMap</code>) and it is injected.</p>
+<p>For an interface, it is similar:</p>
+<p>::java @Model(adaptables=Resource.class) public interface MyModel {</p>
+<p>@Inject String getPropertyName(); }</p>
+<p>Constructor injection is also supported (as of Sling Models 1.1.0):</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel { @Inject public MyModel(@Named("propertyName") String propertyName) { // constructor code } }</p>
+<p>Because the name of a constructor argument parameter cannot be detected via the Java Reflection API a <code>@Named</code> annotation is mandatory for injectors that require a name for resolving the injection.</p>
+<p>In order for these classes to be picked up, there is a header which must be added to the bundle's manifest:</p>
+<p><Sling-Model-Packages> org.apache.sling.models.it.models </Sling-Model-Packages></p>
+<p>This header must contain all packages which contain model classes or interfaces. However, subpackages need not be listed individually, e.g. the header above will also pick up model classes in <code>org.apache.sling.models.it.models.sub</code>. Multiple packages can be listed in a comma-separated list (any whitespace will be removed):</p>
+<p><Sling-Model-Packages> org.apache.sling.models.it.models, org.apache.sling.other.models </Sling-Model-Packages></p>
+<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' below).</p>
+<h1>Client Code</h1>
+<h2>adaptTo()</h2>
+<p>Client code doesn't need to be aware that Sling Models is being used. It just uses the Sling Adapter framework:</p>
+<p>::java MyModel model = resource.adaptTo(MyModel.class)</p>
+<p>Or</p>
+<p>::jsp <sling:adaptTo adaptable="${resource}" adaptTo="org.apache.sling.models.it.models.MyModel" var="model"/></p>
+<p>Or</p>
+<p>::jsp ${sling:adaptTo(resource, 'org.apache.sling.models.it.models.MyModel')}</p>
+<p>As with other AdapterFactories, if the adaptation can't be made for any reason, <code>adaptTo()</code> returns null.</p>
+<h2>ModelFactory (since 1.2.0)</h2>
+<p><em>See also <a href="https://issues.apache.org/jira/browse/SLING-3709">SLING-3709</a></em></p>
+<p>Since Sling Models 1.2.0 there is another way of instantiating models. The OSGi service <code>ModelFactory</code> provides a method for instantiating a model that throws exceptions. This is not allowed by the Javadoc contract of the adaptTo method. That way <code>null</code> checks are not necessary and it is easier to see why instantiation of the model failed.</p>
+<p>::java try { MyModel model = modelFactory.createModel(object, MyModel.class); } catch (Exception e) { // give out error message that the model could not be instantiated. // The exception contains further information. // See the javadoc of the ModelFactory for which Exception can be expected here }</p>
+<p>In addition <code>ModelFactory</code> provides methods for checking whether a given class is a model at all (having the model annotation) or whether a class can be adapted from a given adaptable.</p>
+<h1>Other Options</h1>
+<h2>Names</h2>
+<p>If the field or method name doesn't exactly match the property name, <code>@Named</code> can be used:</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>@Inject @Named("secondPropertyName") private String otherName; }</p>
+<h2>Optional and Required</h2>
+<p><code>@Inject</code>ed fields/methods are assumed to be required. To mark them as optional, use <code>@Optional</code>:</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>@Inject @Optional private String otherName; }</p>
+<p>If a majority of <code>@Inject</code>ed fields/methods are optional, it is possible (since Sling Models API 1.0.2/Impl 1.0.6) to change the default injection strategy by using adding <code>defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL</code> to the <code>@Model</code> annotation:</p>
+<p>::java @Model(adaptables=Resource.class, defaultInjectionStrategy=DefaultInjectionStrategy.OPTIONAL) public class MyModel {</p>
+<p>@Inject private String otherName; }</p>
+<p>To still mark some fields/methods as being mandatory while relying on <code>defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL</code> for all other fields, the annotation <code>@Required</code> can be used.</p>
+<p><code>@Optional</code> annotations are only evaluated when using the <code>defaultInjectionStrategy = DefaultInjectionStrategy.REQUIRED</code> (which is the default), <code>@Required</code> annotations only if using <code>defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL</code>.</p>
+<h2>Defaults</h2>
+<p>A default value can be provided (for Strings & primitives):</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>@Inject @Default(values="defaultValue") private String name; }</p>
+<p>Defaults can also be arrays:</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>@Inject @Default(intValues={1,2,3,4}) private int[] integers; }</p>
+<p>OSGi services can be injected:</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>@Inject private ResourceResolverFactory resourceResolverFactory; }</p>
+<p>In this case, the name is not used -- only the class name.</p>
+<h2>Collections</h2>
+<p>Lists and arrays are supported by some injectors. For the details look at the table given in <a href="#available-injectors">Available Injectors</a>:</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>@Inject private List<Servlet> servlets; }</p>
+<p>List injection for <em>child resources</em> works by injecting grand child resources (since Sling Models Impl 1.0.6). For example, the class</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>@Inject private List<Resource> addresses; }</p>
+<p>Is suitable for a resource structure such as:</p>
+<p>+- resource (being adapted) | +- addresses | +- address1 | +- address2</p>
+<p>In this case, the <code>addresses</code> <code>List</code> will contain <code>address1</code> and <code>address2</code>.</p>
+<h2>OSGi Service Filters</h2>
+<p>OSGi injection can be filtered:</p>
+<p>::java @Model(adaptables=SlingHttpServletRequest.class) public class MyModel {</p>
+<p>@Inject private PrintWriter out;</p>
+<p>@Inject @Named("log") private Logger logger;</p>
+<p>@Inject @Filter("(paths=/bin/something)") private List<Servlet> servlets; }</p>
+<h2>PostConstruct Methods</h2>
+<p>The <code>@PostConstruct</code> annotation can be used to add methods which are invoked upon completion of all injections:</p>
+<p>::java @Model(adaptables=SlingHttpServletRequest.class) public class MyModel {</p>
+<p>@Inject private PrintWriter out;</p>
+<p>@Inject @Named("log") private Logger logger;</p>
+<p>@PostConstruct protected void sayHello() { logger.info("hello"); } }</p>
+<p><code>@PostConstruct</code> methods in a super class will be invoked first.</p>
+<h2>Via</h2>
+<p>If the injection should be based on a JavaBean property of the adaptable, you can indicate this using the <code>@Via</code> annotation:</p>
+<p>::java @Model(adaptables=SlingHttpServletRequest.class) public interface MyModel {</p>
+<p>// will return request.getResource().adaptTo(ValueMap.class).get("propertyName", String.class) @Inject @Via("resource") String getPropertyName(); }</p>
+<h2>Source</h2>
+<p>If there is ambiguity where a given injection could be handled by more than one injector, the <code>@Source</code> annotation can be used to define which injector is responsible:</p>
+<p>::java @Model(adaptables=SlingHttpServletRequest.class) public interface MyModel {</p>
+<p>// Ensure that "resource" is retrived from the bindings, not a request attribute @Inject @Source("script-bindings") Resource getResource(); }</p>
+<h2>Adaptations</h2>
+<p>If the injected object does not match the desired type and the object implements the <code>Adaptable</code> interface, Sling Models will try to adapt it. This provides the ability to create rich object graphs. For example:</p>
+<p>::java @Model(adaptables=Resource.class) public interface MyModel {</p>
+<p>@Inject ImageModel getImage(); }</p>
+<p>@Model(adaptables=Resource.class) public interface ImageModel {</p>
+<p>@Inject String getPath(); }</p>
+<p>When a resource is adapted to <code>MyModel</code>, a child resource named <code>image</code> is automatically adapted to an instance of <code>ImageModel</code>.</p>
+<p>Constructor injection is supported for the adaptable itself. For example:</p>
+<p>::java @Model(adaptables=Resource.class) public class MyModel {</p>
+<p>public MyModel(Resource resource) { this.resource = resource; }</p>
+<p>private final Resource resource;</p>
+<p>@Inject private String propertyName; }</p>
+<h2>Sling Validation (since 1.2.0)</h2>
+<a name="validation">*See also [SLING-4161](https://issues.apache.org/jira/browse/SLING-4161)*</a>
+<p>You can use the attribute <code>validation</code> on the Model annotation to call a validation service on the resource being used by the Sling model. That attribute supports three different values:</p>
+<table>
+ <thead>
+ <tr>
+ <th>Value </th>
+ <th>Description </th>
+ <th>Invalid validation model </th>
+ <th>No validation model found </th>
+ <th>Resource invalid according to model</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>DISABLED</code> (default) </td>
+ <td>don't validate the resource bound to the Model </td>
+ <td>Model instantiated </td>
+ <td>Model instantiated </td>
+ <td>Model instantiated</td>
+ </tr>
+ <tr>
+ <td><code>REQUIRED</code> </td>
+ <td>enforce validation of the resource bound to the Model </td>
+ <td>Model not instantiated </td>
+ <td>Model not instantiated </td>
+ <td>Model not instantiated</td>
+ </tr>
+ <tr>
+ <td><code>OPTIONAL</code> </td>
+ <td>validate the resource bound to the Model (if a validation model is found) </td>
+ <td>Model not instantiated </td>
+ <td>Model instantiated </td>
+ <td>Model not instantiated</td>
+ </tr>
+ </tbody>
+</table>
+<p>In case the model is not instantiated an appropriate error message is logged (if <code>adaptTo()</code> is used) or an appropriate exception is thrown (if <code>ModelFactory.createModel()</code> is used).</p>
+<p>The only implementation for this Sling Models validation service is leveraging <a href="/documentation/bundles/validation.html">Sling Validation</a> and is located in the bundle <a href="https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/validation-impl/">org.apache.sling.models.validation-impl</a>. Validation is only working on models which are adapted from either <code>Resource</code> or <code>SlingHttpServletRequest</code> and if the Sling Validation Bundle is deployed.</p>
+<h1>Custom Injectors</h1>
+<p>To create a custom injector, simply implement the <code>org.apache.sling.models.spi.Injector</code> interface and register your implementation with the OSGi service registry. Please refer to the standard injectors in <a href="http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/">Subversion</a> for examples.</p>
+<p>Injectors are invoked in order of their service ranking, from lowest to highest. See the table below for the rankings of the standard injectors.</p>
+<h1>Annotation Reference</h1>
+<p><code>@Model</code> : declares a model class or interface</p>
+<p><code>@Inject</code> : marks a field or method as injectable</p>
+<p><code>@Named</code> : declare a name for the injection (otherwise, defaults based on field or method name).</p>
+<p><code>@Optional</code> : marks a field or method injection as optional</p>
+<p><code>@Source</code> : explictly tie an injected field or method to a particular injector (by name). Can also be on other annotations.</p>
+<p><code>@Filter</code> : an OSGi service filter</p>
+<p><code>@PostConstruct</code> : methods to call upon model option creation (only for model classes)</p>
+<p><code>@Via</code> : use a JavaBean property of the adaptable as the source of the injection</p>
+<p><code>@Default</code> : set default values for a field or method</p>
+<p><code>@Path</code> : only used together with the resource-path injector to specify the path of a resource</p>
+<p><code>@Exporters</code>/<code>@Exporter</code>/<code>@ExporterOptions</code>/<code>@ExporterOption</code> : See Exporter Framework section below</p>
+<p>In addition all <a href="#injector-specific-annotations">injector-specific annotations</a>.</p>
+<h1>Available Injectors</h1>
+<table>
+ <thead>
+ <tr>
+ <th>Title </th>
+ <th>Name (for <code>@Source</code>) </th>
+ <th>Service Ranking </th>
+ <th>Available Since (Implementation Version) </th>
+ <th>Description </th>
+ <th>Applicable To (including using <code>@Via</code>) </th>
+ <th>Accepts Null Name? </th>
+ <th>Array Support </th>
+ <th>Parameterized Type Support</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Script Bindings </td>
+ <td><code>script-bindings</code> </td>
+ <td>1000 </td>
+ <td>1.0.0 </td>
+ <td>Lookup objects in the script bindings object by name. </td>
+ <td>A ServletRequest object which has the <code>Sling Bindings</code> attribute defined </td>
+ <td>no </td>
+ <td>no conversion is done </td>
+ <td>If a parameterized type is passed, the bindings value must be of a compatible type of the parameterized type.</td>
+ </tr>
+ <tr>
+ <td>Value Map </td>
+ <td><code>valuemap</code> </td>
+ <td>2000 </td>
+ <td>1.0.0 </td>
+ <td>Gets a property from a <code>ValueMap</code> by name. </td>
+ <td>Any object which is or can be adapted to a <code>ValueMap</code></td>
+ <td>no </td>
+ <td>Primitive arrays wrapped/unwrapped as necessary. Wrapper object arrays are unwrapped/wrapped as necessary. </td>
+ <td>Parameterized <code>List</code> and <code>Collection</code> injection points are injected by getting an array of the component type and creating an unmodifiable <code>List</code> from the array.</td>
+ </tr>
+ <tr>
+ <td>Child Resources </td>
+ <td><code>child-resources</code> </td>
+ <td>3000 </td>
+ <td>1.0.0 </td>
+ <td>Gets a child resource by name. </td>
+ <td><code>Resource</code> objects </td>
+ <td>no </td>
+ <td>none </td>
+ <td>if a parameterized type <code>List</code> or <code>Collection</code> is passed, a <code>List<Resource></code> is returned (the contents of which may be adapted to the target type) filled with all child resources of the resource looked up by the given name.</td>
+ </tr>
+ <tr>
+ <td>Request Attributes </td>
+ <td><code>request-attributes</code> </td>
+ <td>4000 </td>
+ <td>1.0.0 </td>
+ <td>Get a request attribute by name. </td>
+ <td><code>ServletRequest</code> objects </td>
+ <td>no </td>
+ <td>no conversion is done </td>
+ <td>If a parameterized type is passed, the request attribute must be of a compatible type of the parameterized type.</td>
+ </tr>
+ <tr>
+ <td>OSGi Services </td>
+ <td><code>osgi-services</code> </td>
+ <td>5000 </td>
+ <td>1.0.0 </td>
+ <td>Lookup services based on class name. Since Sling Models Impl 1.2.8 (<a href="https://issues.apache.org/jira/browse/SLING-5664">SLING-5664</a>) the service with the highest service ranking is returned. In case multiple services are returned, they are ordered descending by their service ranking (i.e. the one with the highest ranking first). </td>
+ <td>Any object </td>
+ <td>yes </td>
+ <td>yes </td>
+ <td>Parameterized <code>List</code> and <code>Collection</code> injection points are injected by getting an array of the services and creating an unmodifiable <code>List</code> from the array.</td>
+ </tr>
+ <tr>
+ <td>Resource Path </td>
+ <td><code>resource-path</code> </td>
+ <td>2500 </td>
+ <td>1.1.0 </td>
+ <td>Injects one or multiple resources. The resource paths are either given by <code>@Path</code> annotations, the element <code>path</code> or <code>paths</code> of the annotation <code>@ResourcePath</code> or by paths given through a resource property being referenced by either <code>@Named</code> or element <code>name</code> of the annotation <code>@ResourcePath</code>. </td>
+ <td><code>Resource</code> or <code>SlingHttpServletRequest</code> objects </td>
+ <td>yes </td>
+ <td>yes </td>
+ <td>none</td>
+ </tr>
+ <tr>
+ <td>Self </td>
+ <td><code>self</code> </td>
+ <td><code>Integer.MAX_VALUE</code> </td>
+ <td>1.1.0 </td>
+ <td>Injects the adaptable object itself (if the class of the field matches or is a supertype). If the @Self annotation is present it is tried to adapt the adaptable to the field type. </td>
+ <td>Any object </td>
+ <td>yes </td>
+ <td>none </td>
+ <td>none</td>
+ </tr>
+ <tr>
+ <td>Sling Object </td>
+ <td><code>sling-object</code> </td>
+ <td><code>Integer.MAX_VALUE</code> </td>
+ <td>1.1.0 </td>
+ <td>Injects commonly used sling objects if the field matches with the class: request, response, resource resolver, current resource, SlingScriptHelper. This works only if the adaptable can get the according information, i.e. all objects are available via <code>SlingHttpServletRequest</code> while <code>ResourceResolver</code> can only resolve the <code>ResourceResolver</code> object and nothing else. A discussion around this limitation can be found at <a href="https://issues.apache.org/jira/browse/SLING-4083">SLING-4083</a>. Also <code>Resource</code>s can only be injected if the according injector-specific annotation is used (<code>@SlingObject</code>). </td>
+ <td><code>Resource</code>, <code>ResourceResolver</code> or <code>SlingHttpServletRequest</code> objects (not all objects can be resolved by all adaptables). </td>
+ <td>yes </td>
+ <td>none </td>
+ <td>none</td>
+ </tr>
+ </tbody>
+</table>
+<h1>Injector-specific Annotations</h1>
+<p><em>Introduced with <a href="https://issues.apache.org/jira/browse/SLING-3499">SLING-3499</a> in Sling Models Impl 1.0.6</em></p>
+<p>Sometimes it is desirable to use customized annotations which aggregate the standard annotations described above. This will generally have the following advantages over using the standard annotations:</p>
+<ul>
+ <li>Less code to write (only one annotation is necessary in most of the cases)</li>
+ <li>More robust (in case of name collisions among the different injectors, you make sure that the right injector is used)</li>
+ <li>Better IDE support (because the annotations provide elements for each configuration which is available for that specific injector, i.e. <code>filter</code> only for OSGi services)</li>
+</ul>
+<p>The follow annotations are provided which are tied to specific injectors:</p>
+<table>
+ <thead>
+ <tr>
+ <th>Annotation </th>
+ <th>Supported Optional Elements </th>
+ <th>Injector </th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>@ScriptVariable</code> </td>
+ <td><code>injectionStrategy</code> and <code>name</code> </td>
+ <td><code>script-bindings</code> </td>
+ <td>Injects the script variable defined via <a href="https://cwiki.apache.org/confluence/display/SLING/Scripting+variables">Sling Bindings</a>. If <code>name</code> is not set the name is derived from the method/field name.</td>
+ </tr>
+ <tr>
+ <td><code>@ValueMapValue</code> </td>
+ <td><code>injectionStrategy</code>, <code>name</code> and <code>via</code> </td>
+ <td><code>valuemap</code> </td>
+ <td>Injects a <code>ValueMap</code> value. If <code>via</code> is not set, it will automatically take <code>resource</code> if the adaptable is the <code>SlingHttpServletRequest</code>. If <code>name</code> is not set the name is derived from the method/field name.</td>
+ </tr>
+ <tr>
+ <td><code>@ChildResource</code> </td>
+ <td><code>injectionStrategy</code>, <code>name</code> and <code>via</code> </td>
+ <td><code>child-resources</code> </td>
+ <td>Injects a child resource by name. If <code>via</code> is not set, it will automatically take <code>resource</code> if the adaptable is the <code>SlingHttpServletRequest</code>. If <code>name</code> is not set the name is derived from the method/field name.</td>
+ </tr>
+ <tr>
+ <td><code>@RequestAttribute</code> </td>
+ <td><code>injectionStrategy</code>, <code>name</code> and <code>via</code> </td>
+ <td><code>request-attributes</code> </td>
+ <td>Injects a request attribute by name. If <code>name</code> is not set the name is derived from the method/field name.</td>
+ </tr>
+ <tr>
+ <td><code>@ResourcePath</code> </td>
+ <td><code>injectionStrategy</code>, <code>path</code>, and <code>name</code> </td>
+ <td><code>resource-path</code> </td>
+ <td>Injects a resource either by path or by reading a property with the given name.</td>
+ </tr>
+ <tr>
+ <td><code>@OSGiService</code> </td>
+ <td><code>injectionStrategy</code>, <code>filter</code> </td>
+ <td><code>osgi-services</code> </td>
+ <td>Injects an OSGi service by type. The <code>filter</code> can be used give an OSGi service filter.</td>
+ </tr>
+ <tr>
+ <td><code>@Self</code> </td>
+ <td><code>injectionStrategy</code> </td>
+ <td><code>self</code> </td>
+ <td>Injects the adaptable itself. If the field type does not match with the adaptable it is tried to adapt the adaptable to the requested type.</td>
+ </tr>
+ <tr>
+ <td><code>@SlingObject</code> </td>
+ <td><code>injectionStrategy</code> </td>
+ <td><code>sling-object</code> </td>
+ <td>Injects commonly used sling objects if the field matches with the class: request, response, resource resolver, current resource, SlingScriptHelper</td>
+ </tr>
+ </tbody>
+</table>
+<h2>Hints</h2>
+<p>Those annotations replace <code>@Via</code>, <code>@Filter</code>, <code>@Named</code>, <code>@Optional</code>, <code>@Required</code>, <code>@Source</code> and <code>@Inject</code>. Instead of using the deprecated annotation element <code>optional</code> you should rather use <code>injectionStrategy</code> with the values <code>DEFAULT</code>, <code>OPTIONAL</code> or <code>REQUIRED</code> (see also <a href="https://issues.apache.org/jira/browse/SLING-4155">SLING-4155</a>). <code>@Default</code> may still be used in addition to the injector-specific annotation to set default values. All elements given above are optional.</p>
+<h2>Custom Annotations</h2>
+<p>To create a custom annotation, implement the <code>org.apache.sling.models.spi.injectorspecific.StaticInjectAnnotationProcessorFactory</code> interface. This interface may be implemented by the same class as implements an injector, but this is not strictly necessary. Please refer to the injectors in <a href="http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/">Subversion</a> for examples.</p>
+<h1>Specifying an Alternate Adapter Class (since 1.1.0)</h1>
+<p>By default, each model class is registered using its own implementation class as adapter. If the class has additional interfaces this is not relevant.</p>
+<p>The <code>@Model</code> annotations provides an optional <code>adapters</code> attribute which allows specifying under which type(s) the model implementation should be registered in the Models Adapter Factory. Prior to <em>Sling Models Impl 1.3.10</em> only the given class names are used as adapter classes, since 1.3.10 the implementation class is always being registered implicitly as adapter as well (see <a href="https://issues.apache.org/jira/browse/SLING-6658">SLING-6658</a>). With this attribute it is possible to register the model to one (or multiple) interfaces, or a superclass. This allows separating the model interface from the implementation, which makes it easier to provide mock implementations for unit tests as well.</p>
+<p>Example:</p>
+<p>::java @Model(adaptables = Resource.class, adapters = MyService.class) public class MyModel implements MyService { // injects fields and implements the MyService methods }</p>
+<p>In this example a <code>Resource</code> can be adapted to a <code>MyService</code> interface, and the Sling Models implementation instantiates a <code>MyModel</code> class for this.</p>
+<p>It is possible to have multiple models implementing the same interface. By default Sling Models will just take the first one ordered alphabetically by the class name. Applications can provide an OSGi service implementing the <code>ImplementationPicker</code> SPI interface which could use context to determine which implementation can be chosen, e.g. depending an a tenant or content path context. If multiple implementations of the <code>ImplementationPicker</code> interface are present, they are queried one after another in order of their service ranking property, the first one that picks an implementation wins.</p>
+<h1>Associating a Model Class with a Resource Type (since 1.3.0)</h1>
+<p>The <code>@Model</code> annotation provides an optional <code>resourceType</code> attribute which allows for model classes to be associated with one or more resource types. This is used in three different ways.</p>
+<p>In the case of multiple model classes implementing the same interface, the class with the "closest" resource type will be used when adapting to the interface.</p>
+<p>The <code>ModelFactory</code> service interface has methods <code>Object getModelFromResource(Resource)</code> and <code>Object getModelFromRequest(SlingHttpServletRequest)</code> which will dynamically determine the adapter class based on the <code>Resource</code> using its type. In the case of the <code>SlingHttpServletRequest</code> method, it uses the request's <code>Resource</code> object (i.e. by calling <code>request.getResource()</code>)</p>
+<p>The resource type is also used as part of the Exporter framework (see next section).</p>
+<h1>Exporter Framework (since 1.3.0)</h1>
+<p>Sling Models objects can be exported to arbitrary Java objects through the Sling Models Exporter framework. Model objects can be programatically exported by calling the <code>ModelFactory</code> method <code>exportModel()</code>. This method takes as its arguments:</p>
+<ul>
+ <li>the model object</li>
+ <li>an exporter name</li>
+ <li>a target class</li>
+ <li>a map of options</li>
+</ul>
+<p>The exact semantics of the exporting will be determined by an implementation of the <code>ModelExporter</code> service interface. Sling Models currently includes a single exporter, using the Jackson framework, which is capable of serializing models as JSON or transforming them to <code>java.util.Map</code> objects.</p>
+<p>In addition, model objects can have servlets automatically registered for their resource type (if it is set) using the <code>@Exporter</code> annotation. For example, a model class with the annotation</p>
+<p>::java @Model(adaptable = Resource.class, resourceType = "myco/components/foo") @Exporter(name = "jackson", extensions = "json")</p>
+<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>Registration of Sling Models classes via bnd plugin</h1>
+<p>With the Sling Models bnd plugin it is possible to automatically generated the necessary bundle header to register the Sling Models classes contained in the Maven bundle project - either with maven-bundle-plugin or with bnd-maven-plugin. By default the plugin generates a <code>Sling-Model-Classes</code> header (only compatible with Sling Models Impl since version 1.3.4, see <a href="https://issues.apache.org/jira/browse/SLING-6308">SLING-6308</a>).</p>
+<p>Example configuration:</p>
+<h1>!xml</h1>
+<p><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></p>
+<p>If a <code>Sling-Model-Packages</code> or <code>Sling-Model-Classes</code> was already manually defined for the bundle the bnd plugin does nothing. So if you want to migrate an existing project to use this plugin remove the existing header definitions.</p>
+<p>If you want to generate a bundle header compliant with Sling Models < 1.3.4 (i.e. <code>Sling-Model-Packages</code>) you need to specify the attribute <code>generatePackagesHeader=true</code>. An example configuration looks like this</p>
+<h1>!xml</h1>
+<p><configuration> <instructions> <_plugin>org.apache.sling.bnd.models.ModelsScannerPlugin;generatePackagesHeader=true</_plugin> </instructions> </configuration></p></section></div></div>
+<div class="footer">
+ <div class="timestamp">
+ TODO display revision number here
+ </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>
+
+ </div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/sling-site/blob/a6129baf/documentation/bundles/nosql-resource-providers.html
----------------------------------------------------------------------
diff --git a/documentation/bundles/nosql-resource-providers.html b/documentation/bundles/nosql-resource-providers.html
new file mode 100644
index 0000000..7b151c2
--- /dev/null
+++ b/documentation/bundles/nosql-resource-providers.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html><html lang="en">
+ <head>
+<meta charset="utf-8"/>
+ <title>Apache Sling on JBake</title>
+ <link rel="stylesheet" href="/res/css/site.css"/>
+ <link rel="stylesheet" href="/res/css/codehilite.css"/>
+ <div class="title">
+ <div class="logo">
+ <a href="http://sling.apache.org">
+ <img border="0" alt="Apache Sling" src="/res/logos/sling.svg"/>
+ </a>
+ </div><div class="header">
+ <a href="http://www.apache.org">
+ <img border="0" alt="Apache" src="/res/logos/apache.png"/>
+ </a>
+ </div>
+ </div>
+ </head><body>
+<div class="menu">
+ <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 & 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><br/><p></p><strong>API Docs</strong><br/><a href="/apidocs/sling9/index.html">Sling 9</a><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><br/><p></p><strong>Project info</strong><br/><a h
ref="/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><br/><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><br/><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="https://donate.apache.org/">Donate!</a><br/><a href="http://www.apache.org/foun
dation/buy_stuff.html">Buy Stuff</a><br/><p></p><strong><a href="/sitemap.html">Site Map</a></strong>
+ </div> <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>NoSQL Resource Providers (org.apache.sling.nosql)</h1></header><p>[TOC]</p>
+<h2>Introduction</h2>
+<p>Apache Sling provides resource-based access to NoSQL document stores like MongoDB and Couchbase via its Resource API using the NoSQL resource providers. This is possible in combination with a JCR-based repository (e.g. only on a special path in the resource tree), or a only persistence for the whole resource tree depending on the resource provider configuration.</p>
+<p>The general concept of retrieving from and storing resource data in NoSQL document stores is the same independently from the NoSQL product used:</p>
+<ul>
+ <li>For each resource a structured document is stored (usually in JSON format)</li>
+ <li>The path of the resource is the key of the document</li>
+ <li>The properties of the resource are stored in a map-like form in the document</li>
+ <li>Special mapping applies to convert special data types like numbers, dates and binary data to a format that can safely stored in the document event if the format is not natively supported (e.g. converting dates to strings and binary to base64)</li>
+ <li>The Sling CRUD support defines a simple transaction model with buffering all changes in memory until a call to "commit()" persists them to the NoSQL database</li>
+ <li>Iterating over child resources and deleting a resource including all descendants requires some basic query capabilities in the NoSQL store</li>
+</ul>
+<p>All these general features are implemented in an abstraction layer called <a href="https://github.com/apache/sling/tree/trunk/contrib/nosql/generic">"Apache Sling NoSQL Generic Resource Provider"</a>, which is used by the resource provider implementations per NoSQL product. Those implementation than only implement a thin "adapter" which maps the resource data to the NoSQL product-specific storage formats and query capabilities, without having to care about all the complex resource provider handling.</p>
+<p>This generic resource provider also contains a set of integration tests covering the most relevant resource read- and write usecases which can be used to test a NoSQL product-specific resource provider implementation and the underlying NoSQL database.</p>
+<h2>MongoDB NoSQL Resource Provider</h2>
+<p>Resource provider for <a href="https://www.mongodb.org/">MongoDB</a> NoSQL database.</p>
+<p>Tested with MongoDB Server 3.0.6 and MongoDB Java Driver 3.1.1.</p>
+<p>Configuration example:</p>
+<p>org.apache.sling.nosql.mongodb.resourceprovider.MongoDBNoSqlResourceProviderFactory.factory.config-default provider.roots=["/"] connectionString="localhost:27017" database="sling" collection="resources"</p>
+<p>See Apache Felix OSGi console for detailed documentation of the parameters. All resource data is stored in one Collection of one MongoDB database. Each resource is stored as a document with the path stored in an "_id" property.</p>
+<p>Source code: <a href="https://github.com/apache/sling/tree/trunk/contrib/nosql/mongodb-resourceprovider">Apache Sling NoSQL MongoDB Resource Provider</a></p>
+<p>Please note: there is an <a href="https://github.com/apache/sling/tree/trunk/contrib/extensions/mongodb">alternative MongoDB resource provider implementation</a> from 2012 which has less features, a slightly different concept for storing resource data (in multiple collections), and it does not use the "Generic Resource Provider".</p>
+<h2>Couchbase NoSQL Resource Provider</h2>
+<p>Resource provider for <a href="http://www.couchbase.com/">Couchbase</a> NoSQL database.</p>
+<p>Tested with Couchbase Server 4.0.0 and Couchbase Java SDK 2.2.4. Please note: Couchbase 4 or higher is mandatory because N1QL support is required.</p>
+<p>Configuration example:</p>
+<p>org.apache.sling.nosql.couchbase.resourceprovider.CouchbaseNoSqlResourceProviderFactory.factory.config-default provider.roots=["/"]</p>
+<p>org.apache.sling.nosql.couchbase.client.CouchbaseClient.factory.config-default clientId="sling-resourceprovider-couchbase" couchbaseHosts="localhost:8091" bucketName="sling" enabled=B"true"</p>
+<p>See Apache Felix OSGi console for detailed documentation of the parameters. All resource data is stored in one Couchbase bucket. Each resource is stored as a document with the path as key.</p>
+<p>Source code: <a href="https://github.com/apache/sling/tree/trunk/contrib/nosql/couchbase-resourceprovider">Apache Sling NoSQL Couchbase Resource Provider</a></p>
+<p>The resource provider requires and additional bundle <a href="https://github.com/apache/sling/tree/trunk/contrib/nosql/couchbase-client">Apache Sling NoSQL Couchbase Client</a> which wraps the Couchbase Java SDK (which itself is not an OSGi bundle), and ensures that the Couchbase Environment instance is used as a singleton in the VM.</p>
+<h2>Example Launchpad</h2>
+<p>An example launchpad is provided that contains the NoSQL resource providers configured as main resource provider at <code>/</code>.</p>
+<p>Source code: <a href="https://github.com/apache/sling/tree/trunk/contrib/nosql/launchpad">Apache Sling NoSQL Launchpad</a></p>
+<p>See README for details how to start the launchpad.</p></section></div></div>
+<div class="footer">
+ <div class="timestamp">
+ TODO display revision number here
+ </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>
+
+ </div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/sling-site/blob/a6129baf/documentation/bundles/org-apache-sling-junit-bundles.html
----------------------------------------------------------------------
diff --git a/documentation/bundles/org-apache-sling-junit-bundles.html b/documentation/bundles/org-apache-sling-junit-bundles.html
new file mode 100644
index 0000000..fd937ad
--- /dev/null
+++ b/documentation/bundles/org-apache-sling-junit-bundles.html
@@ -0,0 +1,127 @@
+<!DOCTYPE html><html lang="en">
+ <head>
+<meta charset="utf-8"/>
+ <title>Apache Sling on JBake</title>
+ <link rel="stylesheet" href="/res/css/site.css"/>
+ <link rel="stylesheet" href="/res/css/codehilite.css"/>
+ <div class="title">
+ <div class="logo">
+ <a href="http://sling.apache.org">
+ <img border="0" alt="Apache Sling" src="/res/logos/sling.svg"/>
+ </a>
+ </div><div class="header">
+ <a href="http://www.apache.org">
+ <img border="0" alt="Apache" src="/res/logos/apache.png"/>
+ </a>
+ </div>
+ </div>
+ </head><body>
+<div class="menu">
+ <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 & 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><br/><p></p><strong>API Docs</strong><br/><a href="/apidocs/sling9/index.html">Sling 9</a><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><br/><p></p><strong>Project info</strong><br/><a h
ref="/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><br/><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><br/><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="https://donate.apache.org/">Donate!</a><br/><a href="http://www.apache.org/foun
dation/buy_stuff.html">Buy Stuff</a><br/><p></p><strong><a href="/sitemap.html">Site Map</a></strong>
+ </div> <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>JUnit server-side testing support bundles</h1></header><p>This is an overview of the Sling bundles that provide support for server-side JUnit tests.</p>
+<p>The Maven modules below <a href="https://svn.apache.org/repos/asf/sling/trunk/testing/samples"><code>testing/samples</code></a> provide different examples including HTTP-based and server-side teleported tests in a bundle module, running against a full Sling instance setup in the same Maven module.</p>
+<h2>org.apache.sling.junit.core: server-side JUnit tests support</h2>
+<p>This bundle provides a <code>JUnitServlet</code> that runs JUnit tests found in bundles.</p>
+<div class="warning">
+Note that the JUnitServlet does not require authentication, so it would allow any client to run tests. The servlet can be disabled by configuration if needed, but in general the `/system` path should not be accessible to website visitors anyway.
+</div>
+<div class="note">
+For tighter integration with Sling, the alternate `SlingJUnitServlet` is registered with the `sling/junit/testing` resource type and `.junit` selector, if the bundle is running in a Sling system. Using this servlet instead of the plain JUnitServlet also allows Sling authentication to be used for running the tests, and the standard Sling request processing is used, including servlet filters for example.
+</div>
+<p>To make tests available to that servlet, the bundle that contains them must point to them with a <code>Sling-Test-Regexp</code> bundle header that defines a regular expression that matches the test class names, like for example:</p>
+<p>Sling-Test-Regexp=com.example.*ServerSideTest</p>
+<h3>The TeleporterRule</h3>
+<p>The <code>TeleporterRule</code> supplied by this bundle (since V1.0.12) makes it easy to write such tests, as it takes care of all the mechanics of</p>
+<ol>
+ <li>creating the test bundle including all necessary classes for execution</li>
+ <li>adding the <code>Sling-Test-Regexp</code> header to the bundles manifest</li>
+ <li>deploy the bundle on an Sling server (with the help of the customizer)</li>
+ <li>calling the <code>JUnitServlet</code> from the client-side and report back the results</li>
+ <li>uninstalling the test bundle</li>
+</ol>
+<p>Most of these steps are done on the client-side by the org.apache.sling.junit.teleporter module (see below).</p>
+<p>Using this rule the server-side tests can be mixed with other tests in the source code if that's convenient, it just requires the <code>junit.core</code> and <code>junit.teleporter</code> modules described on this page to create such tests.</p>
+<p>Here's a basic example of a server-side test that accesses OSGi services:</p>
+<p>public class BasicTeleporterTest {</p>
+<p>@Rule public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "Launchpad");</p>
+<p>@Test public void testConfigAdmin() throws IOException { final String pid = "TEST_" + getClass().getName() + UUID.randomUUID();</p>
+<p>final ConfigurationAdmin ca = teleporter.getService(ConfigurationAdmin.class); assertNotNull("Teleporter should provide a ConfigurationAdmin", ca);</p>
+<p>final Configuration cfg = ca.getConfiguration(pid); assertNotNull("Expecting to get a Configuration", cfg); assertEquals("Expecting the correct pid", pid, cfg.getPid()); } }</p>
+<p>That's all there is to it, the <code>TeleporterRule</code> takes care of the rest.</p>
+<p>The test bundle being build and deployed through this rule usually happens quickly as the temporary bundle is very small. Both the client-side and server-side parts of the test can be debugged easily with the appropriate IDE settings.</p>
+<p>The <code>Teleporter.getService</code> method takes an optional OSGi LDAP filter for service selection, like for example:</p>
+<p>final StringTransformer t = teleporter.getService(StringTransformer.class, "(mode=uppercase)");</p>
+<p>The method waits for the service to be available or until the timeout elapsed (<a href="https://issues.apache.org/jira/browse/SLING-6031">SLING-6031</a>).</p>
+<p>And starting with version 1.0.4 of the <code>org.apache.sling.junit.teleporter</code> bundle, you can specify resources to embed in the test bundle, as in this example:</p>
+<p>@Rule public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "Launchpad") .withResources("/foo/", "/some/other/resource.txt");</p>
+<p>which will embed all resources found under <code>/foo</code> as well as the <code>resource.txt</code> in the test bundle, making them available to the server-side tests.</p>
+<p>This teleporter mechanism is used in our integration tests, search for <code>TeleporterRule</code> in there for examples or look at the <a href="https://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/teleporter"><code>integrationtest.teleporter</code></a> package.</p>
+<p>As I write this the teleporter mechanism is quite new, I suspect there might be some weird interactions between things like <code>@AfterClass</code>, custom test runners and this mechanism but it works well to a growing number of tests in our <code>launchpad/integration-tests</code> module. Moving to JUnit <code>Rules</code> as much as possible, and combining them using JUnit's <code>RuleChain</code>, should help work around such limitations if they arise.</p>
+<h3>More details on the JUnitServlet</h3>
+<p>To try the JUnitServlet interactively, you can install a bundle that contains tests and a <code>Sling-Test-Regexp</code> bundle header that points to them, as described above. Or use the <code>TeleporterRule</code> and set a breakpoint in the tests execution, when the test bundle in installed and listed by the test servlet.</p>
+<p>To list the available tests, open <code>/system/sling/junit/</code> in your browser. The servlet shows available tests and allows you to execute them via a POST request.</p>
+<p>Adding a path allows you to select a specific subset of tests, as in <code>/system/sling/junit/org.apache.sling.junit.remote.html</code></p>
+<p>The JUnitServlet provides various output formats, including in particular JSON, see <code>/system/sling/junit/.json</code> for example.</p>
+<h2>org.apache.sling.junit.teleporter: client-side TeleporterRule support</h2>
+<p>This module provides the <code>ClientSideTeleporter</code> which the <code>TeleporterRule</code> uses to package the server-side tests in bundles that's installed temporarily on the test server. Almost all steps described above in <a href="#the-teleporterrule">The TeleporterRule</a> are being performed by this module.</p>
+<p>This module is not a bundle, as it's used on the client only, as a dependency when running the tests.</p>
+<h3>TeleporterRule.Customizer</h3>
+<p>A <code>TeleporterRule.Customizer</code> is used to setup the <code>ClientSideTeleporter</code>. That customizer is instantiated dynamically based on a String passed to the <code>TeleporterRule.forClass</code> method as 2nd parameter. As an example from our <code>launchpad/integration-tests</code> module, this call</p>
+<p>TeleporterRule.forClass(getClass(), "Launchpad:author");</p>
+<p>causes the <code>TeleporterRule</code> to use the <code>org.apache.sling.junit.teleporter.customizers.LaunchpadCustomizer</code> class to setup the <code>ClientSideTeleporter</code>, and passes the "author" string to it as an option. Although our current <code>LaunchpadCustomizer</code> does not use this options string, it is meant to select a specific server (of family of servers) to run the tests on.</p>
+<p>The options string can also use a full class name instead of the <code>Launchpad</code> short form used here, if needed. The part of that string that follows the first colon is passed to the customizer as is.</p>
+<p>Using Strings for customization reduces the coupling with the <code>junit.core</code> bundle, as it does not need to know those classes which are used only on the client side when running tests.</p>
+<p>If <code>TeleporterRule.forClass(getClass())</code> is used (the method without an additional 2nd parameter) the default customizer is used (<a href="https://issues.apache.org/jira/browse/SLING-5677">SLING-5677</a>, since version 1.0.8).</p>
+<p>The following customizers are currently used in Sling</p>
+<h3>Default Customizer</h3>
+<p><em><a href="https://svn.apache.org/repos/asf/sling/trunk/testing/junit/teleporter/src/main/java/org/apache/sling/testing/teleporter/client/DefaultPropertyBasedCustomizer.java">DefaultPropertyBasedCustomizer.java</a></em> is used by default when no other customizer is referenced in <code>TeleporterRule.forClass(getClass())</code>. It relies on the following system properties:</p>
+<table>
+ <thead>
+ <tr>
+ <th>Property Name </th>
+ <th>Description </th>
+ <th>Mandatory to set </th>
+ <th>Default value </th>
+ <th>Since version </th>
+ <th>Related JIRA </th>
+ </tr>
+ </thead>
+</table>
+<p>| <code>ClientSideTeleporter.baseUrl</code> | base url of the Sling Server to which to deploy. | yes | - | 1.0.8 | <a href="https://issues.apache.org/jira/browse/SLING-5677">SLING-5677</a> | | <code>ClientSideTeleporter.includeDependencyPrefixes</code> | comma-separated list of package prefixes for classes referenced from the IT. Only the classes having one of the given package prefix are included in the bundle being deployed to the given Sling instance together with the IT class itself. They are only included though in case they are referenced! If this is not set, no referenced classes will be included. | no | - | 1.0.8 | <a href="https://issues.apache.org/jira/browse/SLING-5677">SLING-5677</a> | | <code>ClientSideTeleporter.excludeDependencyPrefixes</code> | comma-separated list of package prefixes for classes referenced from the IT. Classes having one of the given package prefix will not be included in the bundle being deployed to the given Sling instance together with the IT
class itself. This takes precedence over the <code>ClientSideTeleporter.includeDependencyPrefixes</code>. | no | - | 1.0.8 | <a href="https://issues.apache.org/jira/browse/SLING-5677">SLING-5677</a> | | <code>ClientSideTeleporter.embedClasses</code> | comma-separated list of fully qualified class names which should be embedded in the test bundle. Use this only for classes which are not detected automatically by the Maven Dependency Analyzer but still should be embedded in the test bundle | no | - | 1.0.8 | <a href="https://issues.apache.org/jira/browse/SLING-5677">SLING-5677</a> | | <code>ClientSideTeleporter.embedClassesDirectories</code> | comma-separated list directories containing class files which should be embedded in the test bundle. Use this only for classes which are not detected automatically by the Maven Dependency Analyzer but still should be embedded in the test bundle | no | - | 1.0.12 | <a href="https://issues.apache.org/jira/browse/SLING-6551">SLING-6551</a> | | <cod
e>ClientSideTeleporter.additionalBundleHeaders</code> | comma-separated list of entries in the format <code><name>:<value></code> which should be added to the test bundle as additional headers | no | - | 1.0.12 | <a href="https://issues.apache.org/jira/browse/SLING-6558">SLING-6558</a> | | <code>ClientSideTeleporter.testReadyTimeoutSeconds</code> | how long to wait for our test to be ready on the server-side in seconds, after installing the test bundle. | no | <code>12</code> | 1.0.8 | <a href="https://issues.apache.org/jira/browse/SLING-5677">SLING-5677</a> | | <code>ClientSideTeleporter.serverUsername</code> | the username with which to send requests to the Sling server. | no | <code>admin</code> | 1.0.8 | <a href="https://issues.apache.org/jira/browse/SLING-5677">SLING-5677</a> | | <code>ClientSideTeleporter.serverPassword</code> | the password with which to send requests to the Sling server. | no | <code>admin</code> | 1.0.8 | <a href="https://issues.apache.org/jira/
browse/SLING-5677">SLING-5677</a> | | <code>ClientSideTeleporter.enableLogging</code> | set to <code>true</code> to log the tasks being performed by the teleporter. Useful for debugging. | no | <code>false</code> | 1.0.12 | <a href="https://issues.apache.org/jira/browse/SLING-6546">SLING-6546</a> | | <code>ClientSideTeleporter.preventToUninstallBundle</code> | set to <code>true</code> to not automatically uninstall the test bundle after test execution. Useful for debugging. | no | <code>false</code> | 1.0.12 | <a href="https://issues.apache.org/jira/browse/SLING-6546">SLING-6546</a> | | <code>ClientSideTeleporter.testBundleDirectory</code> | if set the test bundles are being persisted (before being installed) within the given directory name. If the directory does not exist, it will be automatically created. Useful for debugging. Recommended value <code>${project.build.directory}/test-bundles</code>. | no | - | 1.0.12 | <a href="https://issues.apache.org/jira/browse/SLING-6546">SLING
-6546</a> |</p>
+<p>The provisioning of an appropriate instance can be done with the <a href="/documentation/development/slingstart.html">slingstart-maven-plugin</a>. An example for that is given at <a href="https://svn.apache.org/viewvc/sling/trunk/testing/samples/module-with-it"><code>testing/samples/module-with-it</code></a>. Since <code>slingstart-maven-plugin</code> 1.5.0 it is possible to bootstrap a Sling Server from a <code>model.txt</code> below <code>src/test/provisioning</code> independent of the packaging (see <a href="https://issues.apache.org/jira/browse/SLING-6068">SLING-6068</a>).</p>
+<h4>LaunchpadCustomizer</h4>
+<p>The <em><a href="https://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/junit/teleporter/customizers/LaunchpadCustomizer.java"><code>LaunchpadCustomizer.java</code></a></em> only verifies that a Sling instance is ready at a given port and configures the <code>ClientSideTeleporter</code> to deploy to <code>http://localhost:8888</code> with the credentials <code>admin</code>:<code>admin</code>. <code>LaunchpadCustomizer</code> uses the <code>HttpTestBase</code> therefore some parameters are customizable through system properties. There is no bootstrapping of an instance done here, so this must be done separately!</p>
+<h4>BWIT_TeleporterCustomizer</h4>
+<p>The <em><a href="http://svn.apache.org/viewvc/sling/trunk/testing/samples/bundle-with-it/src/test/java/org/apache/sling/junit/teleporter/customizers/BWIT_TeleporterCustomizer.java"><code>BWIT_TeleporterCustomizer.java</code></a></em> relies on <code>SlingTestBase</code> to set the server's base url and credentials. Additionally the test bundle is adjusted so that the API is not included in it (but rather referenced from another bundle). The bootstrapping of the Sling instance is tweaked through system properties which are desribed <a href="http://labs.6dglobal.com/blog/2013-06-05/creating-integration-tests-apache-sling/">here</a> and implicitly done by the customizer itself.</p>
+<p>Those should give you an overview on what can be done with a customizer and decide whether you need to write your own one or using the default customizer is just enough.</p>
+<h2>org.apache.sling.junit.healthcheck: run JUnit tests as Sling Health Checks</h2>
+<p>This bundle allows JUnit tests to run as <a href="/documentation/bundles/sling-health-check-tool.html">Sling Health Checks</a>, which can be useful when defining smoke tests for example, allowing them to be used both at build time and run time.</p>
+<p>See the <code>JUnitHealthCheck</code> class for details.</p>
+<h2>org.apache.sling.junit.scriptable: scriptable server-side tests</h2>
+<p>This bundle allows Sling scripts to be executed from the <code>JUnitServlet</code> as JUnit tests, as follows:</p>
+<ul>
+ <li>A node that has the <code>sling:Test</code> mixin is a scriptable test node.</li>
+ <li>For security reasons, scriptable test nodes are only executed as tests if they are found under <code>/libs</code> or <code>/apps</code>, or more precisely under a path that's part of Sling's <code>ResourceResolver</code> search path.</li>
+ <li>To execute a test, the scriptable tests provider makes an HTTP request to the test node's path, with a <code>.test.txt</code> selector and extension, and expects the output to contain only the string <code>TEST_PASSED</code>. Empty lines and comment lines starting with a hash sign (#) are ignored in the output, and other lines are reported as failures.</li>
+</ul>
+<p>Here's a minimal example that sets up and executes a scriptable test:</p>
+<p>$ curl -u admin:admin -Fjcr:primaryNodeType=sling:Folder -Fsling:resourceType=foo -Fjcr:mixinTypes=sling:Test http://localhost:8080/apps/foo ... $ echo TEST_PASSED > /tmp/test.txt.esp ; curl -u admin:admin -T/tmp/test.txt.esp http://localhost:8080/apps/foo/test.txt.esp</p>
+<p>At this point, foo.test.txt is what the scriptable test framework will request, and that outputs just TEST_PASSED:</p>
+<p>$ curl -u admin:admin http://localhost:8080/apps/foo.test.txt TEST_PASSED</p>
+<p>And a POST to the JUnit servlet returns information on the test's execution:</p>
+<p>curl -u admin:admin -XPOST http://localhost:8080/system/sling/junit/org.apache.sling.junit.scriptable.ScriptableTestsProvider.json [{ "INFO_TYPE": "test", "description": "verifyContent<a href="org.apache.sling.junit.scriptable.TestAllPaths">0</a>", "test_metadata": { "test_execution_time_msec": 2 } } ]</p>
+<p>Test failures would be included in this JSON representation - you can test that by modifying the script to fail and making the same request again.</p>
+<h2>org.apache.sling.junit.remote: obsolete</h2>
+<p>The <code>org.apache.sling.junit.remote</code> bundle provides utilities to run server-side JUnit tests, but using the newer <code>TeleporterRule</code> described above is much simpler. As a result, this bundle should only be needed for existing tests that were written using its mechanisms.</p></section></div></div>
+<div class="footer">
+ <div class="timestamp">
+ TODO display revision number here
+ </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>
+
+ </div>
+ </body>
+</html>