You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2019/05/20 11:23:20 UTC

svn commit: r1859550 [2/26] - in /jackrabbit/site/live/archive: ./ wiki/ wiki/JCR/ wiki/JCR/attachments/ wiki/JCR/attachments/115513387/ wiki/JCR/attachments/115513390/ wiki/JCR/attachments/115513408/ wiki/JCR/attachments/115513413/ wiki/JCR/attachment...

Added: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-ComponentAPI_115513332.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/archive/wiki/JCR/ApacheSling-ComponentAPI_115513332.html?rev=1859550&view=auto
==============================================================================
--- jackrabbit/site/live/archive/wiki/JCR/ApacheSling-ComponentAPI_115513332.html (added)
+++ jackrabbit/site/live/archive/wiki/JCR/ApacheSling-ComponentAPI_115513332.html Mon May 20 11:23:18 2019
@@ -0,0 +1,450 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Apache Jackrabbit : ApacheSling ComponentAPI</title>
+        <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    </head>
+
+    <body class="theme-default aui-theme-default">
+        <div id="page">
+            <div id="main" class="aui-page-panel">
+                <div id="main-header">
+                    <div id="breadcrumb-section">
+                        <ol id="breadcrumbs">
+                            <li class="first">
+                                <span><a href="index.html">Apache Jackrabbit</a></span>
+                            </li>
+                                                    <li>
+                                <span><a href="Home_70731.html">Home</a></span>
+                            </li>
+                                                    <li>
+                                <span><a href="ApacheSling_115513331.html">ApacheSling</a></span>
+                            </li>
+                                                </ol>
+                    </div>
+                    <h1 id="title-heading" class="pagetitle">
+                                                <span id="title-text">
+                            Apache Jackrabbit : ApacheSling ComponentAPI
+                        </span>
+                    </h1>
+                </div>
+
+                <div id="content" class="view">
+                    <div class="page-metadata">
+                        
+        
+    
+        
+    
+        
+        
+            Created by <span class='author'> ASF Infrabot</span> on May 20, 2019
+                        </div>
+                    <div id="main-content" class="wiki-content group">
+                    <h1 id="ApacheSlingComponentAPI-TheComponentAPI">The Component API</h1>
+
+
+<h2 id="ApacheSlingComponentAPI-Introduction">Introduction</h2>
+
+<p>The Component API defines a presentation framework to build Web Applications. As such the Component API builds upon the Servlet API but extends the latter with new functionality:</p>
+
+<ul>
+	<li>A web page may be built from many different pieces. This aggregation of different pieces is comparable to the functionality provided by the Portlet API. In contrast to the latter, though, the pieces may themselves be aggregates of yet more pieces. So a single web page response may consist of a tree of pieces.</li>
+	<li>Just like the Servlet API and the Portlet API the Component API just defines a Java based framework. Implementing the rendering of pieces in some scripting language is left to the implementation of the Component API.</li>
+	<li>In contrast to the Servlet API and the Portlet API, the Component API is content centric. That is, the request URL does not address a servlet or a portlet but a piece of content represented by an instance of the <code>com.day.components.Content</code> interface. From this content object, the Component framework will derive the <code>com.day.components.Component</code> instance, which is used to perform any actions and render the response.
+<br class="atl-forced-newline"/></li>
+</ul>
+
+
+<p>An implementation of the presentation framework defined by the Component API is called a <em>Component Framework</em>.</p>
+
+
+<h3 id="ApacheSlingComponentAPI-GoingContentCentric">Going Content Centric</h3>
+
+<p>Traditional web applications are built around the notion of a traditional application which is converted into an application which may be used using a Web Browser. Web applications consist of a series of servlets and JSP scripts, which are called based on configuration in the web application deployment descriptor. Such applications are generally based on some internal database or some static filesystem content.</p>
+
+<p>The Component API on the other hand looks more like a traditional web server from the outside, which delivers more or less static content. Thus, while the traditional web application uses the request URL to select a piece of code to execute, the Component API uses the URL to select a piece of content to be delivered. </p>
+
+<p>Apart from using the URLs to address content resources, the Component API abstracts away from a concrete persistence store implementation by defining <em>content</em> to be an instance of a class which implements the <code>Content</code> interface. Instantiation and management of content is left to the Component Framework.</p>
+
+
+<h3 id="ApacheSlingComponentAPI-ComparsiontotheServletAPI">Comparsion to the Servlet API</h3>
+
+<p>The Component API builds upon the Servlet API. Generally a Component Framework will run inside a Servlet Container and be manifested towards the Servlet Container as a single Servlet, which dispatches requests to the Components depending on the request URLs.</p>
+
+<p>Response rendering may itself be a multi-step operation. Depending on the Component implementation, the rendering may include dispatching for child (or even foreign) Content.</p>
+
+
+<h3 id="ApacheSlingComponentAPI-ComparisiontothePortletAPI">Comparision to the Portlet API</h3>
+
+<p>Unlike the Portlet API, which defines one single level of portlet hierarchy - portlets are just pieces residing besides each other - the Component API allows for hierarchic structuring of Content and hence Compoent renderings. To support this structuring, the Component Framework does not control the rendering process of all elements on the page like the Portlet Container does for the portlets. Instead only the Content object addressed by the request URL is processed and it is left to the Component rendering that Content to dispatch other Content/Component tupels to add more data to the response. </p>
+
+
+<h3 id="ApacheSlingComponentAPI-ToIteratororToEnumerate">To Iterator or To Enumerate</h3>
+
+<p>With the advent of the Java Collection framework in Java 2, the <code>Enumeration</code> has been superceded by the <code>Iterator</code>. So the natural choice for the Component API for methods to return enumeratable collection of objects would have be to declare the use of <code>Iterator</code> instances. But because the Servlet API defines to use <code>Enumeration</code> instances, the Component API will also declare the use of <code>Enumeration</code> instances for consistency with the Servlet API extended by the Component API.</p>
+
+
+<h2 id="ApacheSlingComponentAPI-RequestProcessing">Request Processing</h2>
+
+<p>Unlike traditional Servlet API request processing, a Component API request is processed by the Component Framework in four basic steps:</p>
+
+<p> <strong>Content Resolution</strong></p>
+
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> The Component Framework derives a Content instance from the client request URL. The details of how to resolve the Content data and how to instantiate and populate the object is outside the scope of this document. One possible solution would be to map the request URL to a <a href="http://www.jcp.org/en/jsr/detail?id=170" class="external-link" rel="nofollow">Java Content Repository</a> Node and to use an object content mapping tool (e.g. <a href="http://incubator.apache.org/graffito/jcr-mapping/index.html" class="external-link" rel="nofollow">Jackrabbit Object Content Mapping</a>) to instantiate such an object.</p></div>
+<p> <strong>Component Resolution</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> From the Content object created in the first step, the Component object is resolved from the Component ID retrieved from the Content object. The Component ID is a simple string, whose semantics is defined by the Component Framework. One possible definition could be for the Component ID to the fully qualified name of a class implementing the <code>Component</code> interface.</p></div>
+<p> <strong>Input Processing and Response Generation</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> After getting the Content and the Component, the =Component.service()= method is called to process any user supplied input and send the response to the client. To structure the rendered response page, this method is responsible to include other content. See <em>Dispatching Requests</em> below for details. See <em>Error Handling</em> below for a discussion on how exceptions and HTTP stati are handled.</p></div>
+
+
+<h3 id="ApacheSlingComponentAPI-URLdecomposition">URL decomposition</h3>
+
+<p>During the <em>Content Resolution</em> step, the client request URL is decomposed into the following parts:</p>
+
+<p> <strong>Content Path</strong></p>
+
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> The longest substring of the request URL resolving to a Content object such that the content path is either the complete request URL or the next character in the request URL after the content path is either a dot (<code>.</code>) or a slash (<code>/</code>).</p></div>
+<p> <strong>Selectors</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> If the first character in the request URL after the content path is a dot, the string after the dot upto but not including the last dot before the next slash character or the end of the request URL. If the content path spans the complete request URL or if a slash follows the content path in the request URL, no seletors exist. If only one dot follows the content path before the end of the request URL or the next slash, no selectors exist.</p></div>
+<p> <strong>Extension</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> The string after the last dot after the content path in the request URL but before the end of the request URL or the next slash after the content path in the request URL. If a slash follows the content path in the request URL, the extension is empty.</p></div>
+<p> <strong>Suffix Path</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> If the request URL contains a slash character after the content path and optional selectors and extension, the path starting with the slash upto the end of the request URL is the suffix path. Otherwise, the suffix path is empty.</p></div>
+
+<p><strong>Examples</strong>: Assume there is Content at <code>/a/b</code>, which has no child content.</p>
+
+<div class="table-wrap"><table class="confluenceTable"><tbody>
+<tr>
+<td class="confluenceTd"><p> <strong>URI</strong> </p></td>
+<td class="confluenceTd"><p> <strong>Content Path</strong> </p></td>
+<td class="confluenceTd"><p> <strong>Selectors</strong> </p></td>
+<td class="confluenceTd"><p> <strong>Extension</strong> </p></td>
+<td class="confluenceTd"><p> <strong>Suffix</strong> </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b                      </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> &quot;&quot;    </p></td>
+<td class="confluenceTd"><p> &quot;&quot;   </p></td>
+<td class="confluenceTd"><p> &quot;&quot;         </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.html                 </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> &quot;&quot;    </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> &quot;&quot;         </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.s1.html              </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> s1    </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> &quot;&quot;         </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.s1.s2.html           </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> s1.s2 </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> &quot;&quot;         </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b/c/d                  </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> &quot;&quot;    </p></td>
+<td class="confluenceTd"><p> &quot;&quot;   </p></td>
+<td class="confluenceTd"><p> /c/d       </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.html/c/d             </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> &quot;&quot;    </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> /c/d       </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.s1.html/c/d          </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> s1    </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> /c/d       </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.s1.s2.html/c/d       </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> s1.s2 </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> /c/d       </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b/c/d.s.txt            </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> &quot;&quot;    </p></td>
+<td class="confluenceTd"><p> &quot;&quot;   </p></td>
+<td class="confluenceTd"><p> /c/d.s.txt </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.html/c/d.s.txt       </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> &quot;&quot;    </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> /c/d.s.txt </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.s1.html/c/d.s.txt    </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> s1    </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> /c/d.s.txt </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> /a/b.s1.s2.html/c/d.s.txt </p></td>
+<td class="confluenceTd"><p> /a/b </p></td>
+<td class="confluenceTd"><p> s1.s2 </p></td>
+<td class="confluenceTd"><p> html </p></td>
+<td class="confluenceTd"><p> /c/d.s.txt </p></td>
+</tr>
+</tbody></table></div>
+
+
+
+
+<h2 id="ApacheSlingComponentAPI-The">The <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332">ComponentRequest</a></h2>
+
+<p>The <code>org.apache.sling.component.ComponentRequest</code> interface defines the basic data available from the client request to both action processing and response rendering. The <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332">ComponentRequest</a> extends the ==javax.servlet.http.HTTPServletRequest==.</p>
+
+<p>This section describes the data available from the <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332">ComponentRequest</a>. For a complete and normative description of the methods, refer to the Component API <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=JavaDoc&amp;linkCreation=true&amp;fromPageId=115513332">JavaDoc</a>. The following information is represented for reference. In the case of differences between the following descriptions and the Component API <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=JavaDoc&amp;linkCreation=true&amp;fromPageId=115513332">JavaDoc</a>, the latter takes precedence.</p>
+
+<p> <strong>Content access</strong></p>
+
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Content may be accessed from the <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332" class="createlink" rel="nofollow">ComponentRequest</a> object through the following methods: <code>getChildren(Content parent)</code>, <code>getContent()</code>, <code>getContent(String path)</code>.</p></div>
+<p> <strong>Request URL information</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> In addition to the standard <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=JCR&amp;title=HttpServletRequest&amp;linkCreation=true&amp;fromPageId=115513332" class="createlink" rel="nofollow">HttpServletRequest</a> information the <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332" class="createlink" rel="nofollow">ComponentRequest</a> provides the following methods: <code>getExtension()</code>, <code>getSelector(int index)</code>, <code>getSelectors()</code>, <code>getSelectorString()</code>, <code>getSuffix()</code>. Note that the content path is not directly available form the <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;from
 PageId=115513332" class="createlink" rel="nofollow">ComponentRequest</a> object. Instead it is available through the <code>Content.getPath()</code> method of the Content object retrieved through <code>ComponentRequest.getContent()</code>.</p></div>
+<p> <strong>Request Parameters</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> To support user input submitted as <code>multipart/form-data</code> encoded POST parameters, the Component API intrduces the <code>RequestParameter</code> interface allowing file uploads. Request parameters represented as <code>RequestParameter</code> objects are returned by the following methods: <code>getRequestParameter(String name)</code>, <code>getRequestParameterMap()</code>, <code>getRequestParameters(String name)</code>.</p></div>
+<p> <strong>Request Dispatching</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> In addition to standard Serlvet API request dispatching, the Component API supports dispatching requests to render different Content using <code>ComponentRequestDispatcher</code> objects returned by this method: <code>getRequestDispatcher(Content content)</code>.</p></div>
+<p> <strong>Miscellaneous</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Finally the <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332" class="createlink" rel="nofollow">ComponentRequest</a> interface provides the following methods: <code>getCookie(String name)</code>, <code>getResponseContentType()</code>, <code>getResponseContentTypes()</code>, <code>getResourceBundle(Locale locale)</code>.</p></div>
+
+<p>The <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332">ComponentRequest</a> objects are only valid during the time of executing the =performAction= or =render= methods. Implementations of these methods must not keep references for later use. As such, the <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332">ComponentRequest</a> interface and its extensions are defined to not be thread safe.</p>
+
+<p><em>A note on HTTP Sessions</em>: The <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332">ComponentRequest</a> extends the <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=HttpSerlvetRequest&amp;linkCreation=true&amp;fromPageId=115513332">HttpSerlvetRequest</a> and thus supports standard HTTP sessions. Be aware, though that Sessions are server side sessions and hence violate the sessionless principle of REST and therefore should be used with care. It is almost always possible to not use sessions.</p>
+
+
+
+<h2 id="ApacheSlingComponentAPI-The.1">The <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentResponse&amp;linkCreation=true&amp;fromPageId=115513332">ComponentResponse</a></h2>
+
+<p>The <code>com.day.components.ComponentResponse</code> interface extends the <code>javax.servet.http.HttpServletResponse</code> interface with just the following methods: <code>getContentType()</code>, <code>getNamespace()</code>.</p>
+
+
+<h2 id="ApacheSlingComponentAPI-TheContent">The Content</h2>
+
+<p>The <code>org.apache.sling.component.Content</code> interface defines the general contract required by Content objects handled by the Component framework. Implementations may provide any means to implement and/or extend this interface. The interface defines the following methods:</p>
+
+<p> <strong>getComponentId()</strong></p>
+
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Returns the identifier of the Component used to handle the action and render the response for the client request underlying the Content object.</p></div>
+<p> <strong>getPath()</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Returns the path derived from the client request URL which lead to the creation of the Content object. See the <a href="#ApacheSlingComponentAPI-URL_decomposition" rel="nofollow">URL decomposition</a> section above for more information. It is not required, that the Content object path be a part of the original client request URL. The request URL may also have been mapped to some internal path.</p></div>
+
+
+
+<h2 id="ApacheSlingComponentAPI-TheComponent">The Component</h2>
+
+<p>The <code>org.apache.sling.component.Component</code> interface defines the API implemented to actually handle requests. As such the Component interface is comparable to the =javax.servlet.Servlet= interface. Like those other interfaces, the Component interface provides methods for life cycle management: <code>init(ComponentContext context)</code>, <code>destroy()</code>.</p>
+
+
+<h3 id="ApacheSlingComponentAPI-ProcessingtheRequest">Processing the Request</h3>
+
+<p>The Component Framework calls the <code>service(ComponentRequest request, <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentResponse&amp;linkCreation=true&amp;fromPageId=115513332">ComponentResponse</a> response)</code> method of the Component to have the component process the request optionally processing user input, rendering the response and optionally dispatch to other Content/Component tuples to provide more response data.</p>
+
+
+<h3 id="ApacheSlingComponentAPI-ContentanditsComponent">Content and its Component</h3>
+
+<p>The Content object and a Component form a pair, in which the Content object takes the passive part of providing data to the Component and the Component takes the active part of acting upon the Content object. As a consequence, there always exists a link between a given implementation of the Content interface and a given implementation of the Component interface.</p>
+
+<p>This link is manifested by the Component identifier available from the Content object through the <code>Content.getComponentId()</code> method on the one hand. On the other hand, the link is manifested by the <code>getContentClassName()</code> and <code>createContentInstance()</code> methods of the Component interface.</p>
+
+
+<h3 id="ApacheSlingComponentAPI-ComponentLifecylce">Component Lifecylce</h3>
+
+<p>When a Component instance is created and added to the Component framework, the <code>init(ComponentContext)</code> method is called to prepare and initialize the Component. If this method terminates abnormally by throwing an exception, the Component is not used. The Component Framework implementation may try at a later time to recreate the Component, intialize it and use it. If the Component Framework tries to recreate the Component a new instance of the Component must be created to be initialized and used.</p>
+
+<p>When the Component has successfully been initialized, it may be referred to by Content objects. When a client request is to be processed, the Content object is resolved and the <code>service</code> method on the Component to which the Content object refers is called. The <code>service</code> method may - and generally will - be called simultaneously to handle different requests in different threads. As such, implementations of these methods must be thread safe.</p>
+
+<p>When the Component Framework decides to take a Component out of service, the <code>destroy()</code> method is called to give the Component a chance to cleanup any held resources. The destroy method must only be called by the Component Framework when no more request processing is using the Component, that is no thread may be in the <code>service</code> method of a Component to be destroyed. Irrespective of whether the destroy method terminated normally or abnormally, the Component will not be used again.</p>
+
+<p>The addition and removal of Components is at the discretion of the Component Framework. A Component may be loaded at framework start time or on demand and my be removed at any time. But only one single Component instance with the same Component identifier may be active at the same time within a single Component Framework instance.</p>
+
+
+<h3 id="ApacheSlingComponentAPI-The.2">The <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentExtension&amp;linkCreation=true&amp;fromPageId=115513332">ComponentExtension</a></h3>
+
+<p>To enhance the core functionality of Components, each Component may have zero, one ore more Component Extensions attached. A Component Extensions is a Java object implementing the <code>org.apache.sling.component.ComponentExtension</code> interface. This interface just defines a <code>getName()</code> method to identify extensions.</p>
+
+<p>The concrete implementation as well as instantiation and management of Component Extensions is left to the Component Framework implementation with one restriction though: The extensions must be available to the Component at the time the <code>init(ComponentContext)</code> method is called may only be dropped after the <code>destroy()</code> method terminates.</p>
+
+<p>The Component interface defines two methods to access Extensions: The <code>getExtensions()</code> method returns a <code>java.util.Enumeration</code> of all <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentExtension&amp;linkCreation=true&amp;fromPageId=115513332">ComponentExtension</a> objects attached to the component. If no Component Extension are attached to the Component, an empty enumeration is returned. The <code>getExtension(String name)</code> returns the named Component Extension attached to the Component or <code>null</code> if no such Component Extension is attached to the Component.</p>
+
+<p>Component Frameworks are allowed to share Component Extension instances of the same name between different Component instances. Regardless of whether Component Extensions are shared or not, they must be thread safe, as any Component Extension may be used within the <code>service</code> method, which themselves may be called concurrently.</p>
+
+
+
+<h2 id="ApacheSlingComponentAPI-RequestProcessingFilters">Request Processing Filters</h2>
+
+<p>Similar to the Servlet API providing filters for filtering requests and/or responses the Component API provides the <code>org.apache.sling.component.ComponentFilter</code> interface. The filters are called by a <code>ComponentFilterChain</code> and either handle the request, manipulate the request and/or response object and finally forward the request and response optionally wrapped to the <code>ComponentFilterChain.doFilter(ComponentRequest, <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentResponse&amp;linkCreation=true&amp;fromPageId=115513332">ComponentResponse</a>)</code> method.</p>
+
+<p>Like the <code>Component}}s  filters have a defined lifecycle manifested by {{init</code> and <code>destroy</code> methods. When the filter enters the system, the Component Framework calls the <code>ComponentFilter.init(ComponentContext)</code> method. Only when this method completes successfully will the filter be put into action and be used during request processing. When the filter leaves the system, the Component Framework removes the filter from being used in filter chains and calls the <code>ComponentFilter.destroy()</code> method. This method is not expected to throw any exceptions. The filter may be removed from the Component Framework at the discretion of the Component Framework or because the filter is being unregistered from the Component Framework by some means outside this specification.</p>
+
+<p>This specification does not define how <code>ComponentFilter</code> objects are registered with the Component Framework nor is it specified how the order in which the filters are called is defined. Likewise it is outside this specification how the filter instances registered with the Component Framework are configured.</p>
+
+
+
+<h2 id="ApacheSlingComponentAPI-Sessions">Sessions</h2>
+
+
+<p>The <code>org.apache.sling.component.ComponentSession</code> interface provides a way to identify a user across more than one request and to store transient information about that user.</p>
+
+<p>A component can bind an object attribute into a <code>ComponentSession</code> by name. The <code>ComponentSession</code> interface defines two scopes for storing objects: <code>APPLICATION_SCOPE</code>, <code>COMPONENT_SCOPE</code>. All objects stored in the session using the <code>APPLICATION_SCOPE</code> must be available to all the components, servlets and JSPs that belong to the same component application and that handle a request identified as being a part of the same session. Objects stored in the session using the <code>COMPONENT_SCOPE</code> must be available to the component during requests for the same content that the objects where stored from. Attributes stored in the <code>COMPONENT_SCOPE</code> are not protected from other web components of the component application. They are just conveniently namespaced.</p>
+
+<p>The component session extends the Servlet API <code>HttpSession</code>. Therefore all <code>HttpSession</code> listeners do apply to the component session and attributes set in the component session are visible in the <code>HttpSession</code> and vice versa.</p>
+
+<p>The attribute accessor methods without the <em>scope</em> parameter always refer to <code>COMPONENT_SCOPE</code> attributes. To access <code>APPLICATION_SCOPE</code> attributes use the accessors taking an explicit <code>scope</code> parameter.</p>
+
+<p><em>A final note on Sessions</em>: Sessions are server side sessions and hence violate the sessionless principle of REST and therefore should be used with care. It is almost always possible to not use sessions.</p>
+
+
+
+<h2 id="ApacheSlingComponentAPI-DispatchingRequests">Dispatching Requests</h2>
+
+<p>To include renderings of child Content objects, a <code>org.apache.sling.component.ComponentRequestDispatcher</code> object may be retrieved from the <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentContext&amp;linkCreation=true&amp;fromPageId=115513332">ComponentContext</a> with which the Component has been initialized or from the <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentRequest&amp;linkCreation=true&amp;fromPageId=115513332">ComponentRequest</a> provided to the service method. Using this dispatcher the reponse of rendering the Content may be included by calling the <code>ComponentRequestDispatcher.include(ComponentRequest, <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ComponentResponse&amp;linkCreation=true&amp;fromPageId=115513332">ComponentResponse</a>)</code> method.</p>
+
+<p>This method is comparable to the <code>RequestDispatcher.include(ServletRequest, <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ServletResponse&amp;linkCreation=true&amp;fromPageId=115513332">ServletResponse</a></code> method of the Servlet API but dispatching by the <code>ComponentRequestDispatcher</code> does not go through the servlet container and stays within the Component Framework.</p>
+
+<p>The <code>service</code> method of included Components are called with an instance of the <code>ComponentRequest</code> interface whose <code>getContent()</code> returns the Content object for the included Content.</p>
+
+<p>When a Component is included by another component the following request attributes are set:</p>
+
+<div class="table-wrap"><table class="confluenceTable"><tbody>
+<tr>
+<td class="confluenceTd"><p> <strong>Request Attributes</strong> </p></td>
+<td class="confluenceTd"><p> <strong>Type</strong> </p></td>
+<td class="confluenceTd"><p> <strong>Description</strong> </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>org.apache.sling.component.request.content</code> </p></td>
+<td class="confluenceTd"><p> String </p></td>
+<td class="confluenceTd"><p> The <code>Content</code> instance to which the client URL resolved. This attribute is set when included Components are being rendered and it is not set for the Component directly addressed by the client request. </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>org.apache.sling.component.request.component</code> </p></td>
+<td class="confluenceTd"><p> String </p></td>
+<td class="confluenceTd"><p> The <code>Component</code> instance for the <code>Content</code> object to which the client URL resolved. This attribute is set when included Components are being rendered and it is not set for the Component directly addressed by the client request. </p></td>
+</tr>
+</tbody></table></div>
+
+
+
+
+<h3 id="ApacheSlingComponentAPI-ErrorHandling">Error Handling</h3>
+
+<p>While processing requests, the <code>service</code> methods called may have problems. Components have multiple options of reporting issues during processing to the client:</p>
+
+<ul>
+	<li>Set the status of the HTTP response calling the <code>ComponentResponse.setStatus</code> method</li>
+	<li>Send an error page calling the <code>ComponentResponse.sendError</code> method</li>
+	<li>Throw an exception
+<br class="atl-forced-newline"/>
+<br class="atl-forced-newline"/></li>
+</ul>
+
+
+<p>If such an exception is thrown, the Component Framework must act upon the exception in one of the following ways:</p>
+
+<ul>
+	<li>If the request is processed through Servlet API request inclusion, the exception must be given back to the servlet container. A <code>ComponentException</code> is just forwarded as a <code>ServletException</code>. This is a requirement of the Servlet API specification which states for included requests:
+<br class="atl-forced-newline"/></li>
+</ul>
+
+
+<div class="table-wrap"><table class="confluenceTable"><tbody>
+<tr>
+<td class="confluenceTd"><p> <strong>SRV.8.5 Error Handling</strong> <br/>
+If the servlet that is the target of a request dispatcher throws a runtime exception or a checked exception of type <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ServletException&amp;linkCreation=true&amp;fromPageId=115513332">ServletException</a> or IOException, it should be propagated to the calling servlet. All other exceptions should be wrapped as <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=ServletExceptions&amp;linkCreation=true&amp;fromPageId=115513332">ServletExceptions</a> and the root cause of the exception set to the original exception, as it should not be propagated. </p></td>
+</tr>
+</tbody></table></div>
+
+
+<ul>
+	<li>Otherwise, the Component Framework may handle the error itself in a manner similar to the error handling approach defined the Servlet API specification (Section SRV 9.9 Error Handling of the Java Servlet Specification 2.4). Specifically the request attributes defined by the Servlet API specification must be set for the error handler:
+<br class="atl-forced-newline"/></li>
+</ul>
+
+
+<div class="table-wrap"><table class="confluenceTable"><tbody>
+<tr>
+<td class="confluenceTd"><p> <strong>Request Attributes</strong> </p></td>
+<td class="confluenceTd"><p> <strong>Type</strong> </p></td>
+<td class="confluenceTd"><p> <strong>Description</strong> </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>javax.servlet.error.status_code</code> </p></td>
+<td class="confluenceTd"><p> <code>java.lang.Integer</code> </p></td>
+<td class="confluenceTd"><p> The status code of the response. In the case of an exception thrown from the <code>service</code>, the code is defined by the Component Framework. </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>javax.servlet.error.exception_type</code> </p></td>
+<td class="confluenceTd"><p> <code>java.lang.Class</code> </p></td>
+<td class="confluenceTd"><p> The fully qualified name of the exception class thrown. This attribute does not exist, if error handling does not result from an exception. This attribute is maintained for backwards compatibility according to the Servlet API Specification. </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>javax.servlet.error.message</code> </p></td>
+<td class="confluenceTd"><p> <code>java.lang.String</code> </p></td>
+<td class="confluenceTd"><p> The message of the exception thrown. This attribute does not exist, if error handling does not result from an exception. This attribute is maintained for backwards compatibility according to the Servlet API Specification. </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>javax.servlet.error.exception</code> </p></td>
+<td class="confluenceTd"><p> <code>java.lang.Throwable</code> </p></td>
+<td class="confluenceTd"><p> The exception thrown. This attribute does not exist, if error handling does not result from an exception. </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>javax.servlet.error.request_uri</code> </p></td>
+<td class="confluenceTd"><p> <code>java.lang.String</code> </p></td>
+<td class="confluenceTd"><p> The request URL whose processing resulted in the error. </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>javax.servlet.error.servlet_name</code> </p></td>
+<td class="confluenceTd"><p> <code>java.lang.String</code> </p></td>
+<td class="confluenceTd"><p> The name of the servlet which yielded the error. The servlet name will generally not have any significance inside the Component Framework. </p></td>
+</tr>
+<tr>
+<td class="confluenceTd"><p> <code>com.day.components.error.componentId</code> </p></td>
+<td class="confluenceTd"><p> <code>java.lang.String</code> </p></td>
+<td class="confluenceTd"><p> The identifier of the Component whose <code>service</code> method has caused the error. This attribute does not exist, if the Component Framework itself caused the error processing. </p></td>
+</tr>
+</tbody></table></div>
+
+
+<ul>
+	<li>If the Component Framework decides to not handle the error itself, the exception must be forwarded to the servlet container as a <code>ComponentException</code> wrapping the original exception as its root cause.
+<br class="atl-forced-newline"/></li>
+</ul>
+
+
+<p>This specification does not define, how error handlers are configured and used if the Component Framework provides error handling support. Likewise the Component Framework may or may not implement support to handle calls to the <code>ComponentResponse.sendError</code> method. The Component Framework may also use its own error handling also for errors resulting from request processing failures, for example if authentication is required or if the request URL cannot be resolved to a Content object.</p>
+                    </div>
+
+                    
+                                                      
+                </div>             </div> 
+            <div id="footer" role="contentinfo">
+                <section class="footer-body">
+                    <p>Document generated by Confluence on May 20, 2019 11:11</p>
+                    <div id="footer-logo"><a href="http://www.atlassian.com/">Atlassian</a></div>
+                </section>
+            </div>
+        </div>     </body>
+</html>

Propchange: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-ComponentAPI_115513332.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-ComponentAPI_115513332.html
------------------------------------------------------------------------------
    svn:executable = *

Added: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingArchitecture_115513333.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingArchitecture_115513333.html?rev=1859550&view=auto
==============================================================================
--- jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingArchitecture_115513333.html (added)
+++ jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingArchitecture_115513333.html Mon May 20 11:23:18 2019
@@ -0,0 +1,135 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Apache Jackrabbit : ApacheSling SlingArchitecture</title>
+        <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    </head>
+
+    <body class="theme-default aui-theme-default">
+        <div id="page">
+            <div id="main" class="aui-page-panel">
+                <div id="main-header">
+                    <div id="breadcrumb-section">
+                        <ol id="breadcrumbs">
+                            <li class="first">
+                                <span><a href="index.html">Apache Jackrabbit</a></span>
+                            </li>
+                                                    <li>
+                                <span><a href="Home_70731.html">Home</a></span>
+                            </li>
+                                                    <li>
+                                <span><a href="ApacheSling_115513331.html">ApacheSling</a></span>
+                            </li>
+                                                </ol>
+                    </div>
+                    <h1 id="title-heading" class="pagetitle">
+                                                <span id="title-text">
+                            Apache Jackrabbit : ApacheSling SlingArchitecture
+                        </span>
+                    </h1>
+                </div>
+
+                <div id="content" class="view">
+                    <div class="page-metadata">
+                        
+        
+    
+        
+    
+        
+        
+            Created by <span class='author'> ASF Infrabot</span> on May 20, 2019
+                        </div>
+                    <div id="main-content" class="wiki-content group">
+                    <h1 id="ApacheSlingSlingArchitecture-ArchitectureofSling">Architecture of Sling</h1>
+
+<p>Sling is an implementation of the <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=..%2FComponentAPI&amp;linkCreation=true&amp;fromPageId=115513333">Component API</a> consisting of several modules. The core architectural features of Sling are as follows:</p>
+
+<ul>
+	<li>The modules are implemented as OSGi Bundles</li>
+	<li>The functionality of Sling is glued together based on the OSGi Service Layer using Declarative Services to easily manage service registrations, configuration and refererence tracking</li>
+	<li>Configuration is managed using the OSGi Configuration Admin Service
+<br class="atl-forced-newline"/>
+<br class="atl-forced-newline"/></li>
+</ul>
+
+
+<h2 id="ApacheSlingSlingArchitecture-Launching">Launching</h2>
+
+<p>Sling may be launched as a standalone application using the Sling Application or as a Web Application running inside any Servlet API 2.3 or newer Servlet Container.</p>
+
+<p>The Sling Application is a standalone Java Application which is relatively small. It contains some helper classes to launch Apache Felix as the OSGi Framework. Of course the Apache Felix Framework library as well as the OSGi Core and Compendium libraries are part of the Sling Application. These three parts are actually the only ones, which may not be exchanged through the OSGi Lifecycle Layer. To enable bootstrapping, the Sling Application also contains three bundles, which are by default deployed into the started framework: The <code>log</code> bundle, the <code>assembly</code> bundle and the Apache Felix Bundle Repository bundle. As these bundles are deployed using the OSGi Lifecycle Layer, they may of course be updated if need be.</p>
+
+<p>The Sling Servlet is an extension of the Sling Application in that it contains a simple Servlet calling into the Sling Application Launcher to launch Sling inside the Web Application. Additionally, the Sling Servlet provides the hook for the integration of the OSGi Http Service running inside the framework to attach to the Servlet Container in which the Sling Servlet is running.</p>
+
+
+<h2 id="ApacheSlingSlingArchitecture-ServletContainersupport">Servlet Container support</h2>
+
+<p>As we have seen, Sling may be launched as a standalone Java Application or as a Web Application inside any compliant Servlet Container. To blur the differences of the launching mechanism, Sling internally registers a Servlet with a OSGi <code>HttpService</code>. Depending on the launch method, the following <code>HttpService</code> implementations are used:</p>
+
+
+<p> <strong>Apache Felix http.jetty</strong></p>
+
+
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> If Sling is launched as a standalone Java Application, the Apache Felix <code>http.jetty</code> bundle is used as the implementation of the OSGi <code>HttpService</code>. In this case the <code>http.jetty</code> bundle exports the Serlvet API interfaces used by Sling.</p></div>
+<p> <strong>Equinox HTTP Servlet</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> If Sling is launched as a Web Application, the <a href="http://www.eclipse.org/equinox/server" class="external-link" rel="nofollow">Equinox HTTP Servlet</a> is used as the OSGi <code>HttpService</code> implementation in conjunction with <em>sling-servlet-bridge</em> bundle to link the HTTP Servlet into the Servlet Container through the Sling Servlet.</p></div>
+
+
+<h2 id="ApacheSlingSlingArchitecture-BootstrappingSling">Bootstrapping Sling </h2>
+
+<p>The Sling launcher (standalone or web application) only contains core classes and bundles to get a first launch. After the launch, the bundle activator of the <em>sling-assembly</em> bundle will look at the framework properties to try to install further bundles and thus bootstrap Sling.</p>
+
+<p>See <a class="createlink" href="/confluence/pages/createpage.action?spaceKey=JCR&amp;title=..%2FSlingInitialStartup&amp;linkCreation=true&amp;fromPageId=115513333">Initial Provisioning and Startup</a> for a detailed description of this process.</p>
+
+
+<h2 id="ApacheSlingSlingArchitecture-BundlesofSling">Bundles of Sling</h2>
+
+<p>Sling consists of the following bundles:</p>
+
+<p> <strong>sling-log</strong></p>
+
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Implements the OSGi Log Service specification and exports Log4J, SLF4J and Apache Commons Logging for legacy applications. Internally, all logging goes to <em>NLog4J</em>. See also the <span class="error">[page on logging|../SlingLogging]</span>.</p></div>
+<p> <strong>sling-assembly</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Bundle and application installation support. This bundle provides a service to install bundles from an OSGi Bundle Repository. Additionally it supports an application &quot;bundling&quot; functionality called <em>Assembly</em>. See <span class="error">[Assemblies|../SlingAssembly]</span> for more details on this bundling.</p></div>
+<p> <strong>sling-component-api</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Exports the API classes of the <span class="error">[Component API|../ComponentAPI]</span>.</p></div>
+<p> <strong>sling-content-jcr</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Implements the JCR Repository Content mapping functionality. Additionally implements support for initial load of content out of bundles into the JCR Repository as well as defining Node Types.</p></div>
+<p> <strong>sling-core</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> The core implementation of the Sling Component Framework. This bundle implements the core request processing infrastructure of Sling. See also the page on <span class="error">[Content Loading and Nodetype Support|../SlingContent]</span>.</p></div>
+<p> <strong>sling-scripting-core</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Basic framework to support scripting languages in Sling.</p></div>
+<p> <strong>sling-scripting-jsp</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Support for JSP Scripting where the JSP scripts are located in the JCR Repository and will be compiled into classes stored in the JCR Repository. The JSP classes will then be loaded from the JCR Repository using the Jackrabbit Repository Classloader.</p></div>
+<p> <strong>sling-scripting-jsp-taglib</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Provides a simple basic JSP Tag Library to easily access the Sling internals like the <code>ContentManager</code>.</p></div>
+<p> <strong>sling-jackrabbit-classloader</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Provides the Classloader to load JSP (and other scripting) classes from the JCR Repository. This bundle is used by the <em>sling-scripting-jsp</em> bundle to load the compiled JSP classes.</p></div>
+<p> <strong>sling-jasper-sling</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Provides the JSP Compiler to the <em>sling-scripting-jsp</em> bundle. As the name implies it is based on the Jasper JSP compiler: Jasper 5.5.20 has been modified to allow writing JSP classes (and intermediate Java sources) to the JSR Repository instead of the platform filesystem. This bundle also contains the Eclipse 3.2 Java Compiler used to compile the Java sources into JSP class files.</p></div>
+<p> <strong>sling-jackrabbit-api</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Exports the JCR and Jackrabbit API as well as the <code>jackrabbit-jcr-commons</code> library. In addition this bundle provides the basis to implement session pooling.</p></div>
+<p> <strong>sling-jackrabbit-server</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Contains the Jackrabbit core enabling to start Jackrabbit Repository instances embedded in Sling. This bundle uses the <em>sling-jackrabbit-api</em> bundle to provide pooled sessions to the embedded repository instances.</p></div>
+<p> <strong>sling-jackrabbit-client</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Contains support to access an existing Jackrabbit Repository instance running in the same Java VM (e.g. the Jackrabbit web app) or in a foreign Java VM. Again, this bundle uses the <em>sling-jackrabbit-api</em> bundle to provide pooled sessions to the embedded repository instances.</p></div>
+<p> sling-servlet-bridge: A very simple bundle bridging the Eclipse implementation of the OSGi HTTP Service specification to the Servlet Container into which the Sling Servlet is deployed. See above for more details.<br/>
+ <strong>sling-console-web</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Simple Servlet based management GUI to manage a running Sling instance. This tool may be used to manage bundle lifecycle, check the state of the system and manage configurations through the Configuration Admin Service.</p></div>
+<p> <strong>sling-component-standard</strong></p>
+ <div class="indent20 inline" style="margin-left: 20px;"><style type="text/css">div.inline p:first-child { display: inline; }</style><p> Standard Components provided by Sling. Currently this bundle contains Content and Component implementations to support simple access nodes of type <code>nt:folder</code>, <code>nt:file</code> and <code>nt:resource</code>.</p></div>
+                    </div>
+
+                    
+                                                      
+                </div>             </div> 
+            <div id="footer" role="contentinfo">
+                <section class="footer-body">
+                    <p>Document generated by Confluence on May 20, 2019 11:11</p>
+                    <div id="footer-logo"><a href="http://www.atlassian.com/">Atlassian</a></div>
+                </section>
+            </div>
+        </div>     </body>
+</html>

Propchange: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingArchitecture_115513333.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingArchitecture_115513333.html
------------------------------------------------------------------------------
    svn:executable = *

Added: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingAssembly_115513334.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingAssembly_115513334.html?rev=1859550&view=auto
==============================================================================
--- jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingAssembly_115513334.html (added)
+++ jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingAssembly_115513334.html Mon May 20 11:23:18 2019
@@ -0,0 +1,245 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Apache Jackrabbit : ApacheSling SlingAssembly</title>
+        <link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    </head>
+
+    <body class="theme-default aui-theme-default">
+        <div id="page">
+            <div id="main" class="aui-page-panel">
+                <div id="main-header">
+                    <div id="breadcrumb-section">
+                        <ol id="breadcrumbs">
+                            <li class="first">
+                                <span><a href="index.html">Apache Jackrabbit</a></span>
+                            </li>
+                                                    <li>
+                                <span><a href="Home_70731.html">Home</a></span>
+                            </li>
+                                                    <li>
+                                <span><a href="ApacheSling_115513331.html">ApacheSling</a></span>
+                            </li>
+                                                </ol>
+                    </div>
+                    <h1 id="title-heading" class="pagetitle">
+                                                <span id="title-text">
+                            Apache Jackrabbit : ApacheSling SlingAssembly
+                        </span>
+                    </h1>
+                </div>
+
+                <div id="content" class="view">
+                    <div class="page-metadata">
+                        
+        
+    
+        
+    
+        
+        
+            Created by <span class='author'> ASF Infrabot</span> on May 20, 2019
+                        </div>
+                    <div id="main-content" class="wiki-content group">
+                    h1. Assembly: Bundling Bundles
+
+
+h2. Introduction
+
+This chapter discusses the units of deployment as well as the units of functionality. The following contents is based on the Module and Service specifications of the OSGi Service Platform Core Specification, Release 4 but enhances functionality for ease of use and in terms of best practices.
+
+The term _Units of Deployment_ describes the idea of packaging up functionality implemented by Java Classes into modules, so called _Bundles_. For bigger and more complicated applications the fine grained modularity of _Bundles_ may be to complicated, so this chapter proposes an extension called _Assembly_. The goal of the _Assembly_ specification presented below is to provide functionality to delivery a collection of bundles belonging together.
+
+The term _Units of Functionality_ describes the idea of providing services implemented by Java Classes, so called _Services_. A _Service_ is an abstraction and does not actually prescribe the implementation of specific interfaces. Instead the OSGi specification states how functionality may be provided to clients by registering objects implementing interfaces defining the functionality in terms of a Java API.
+
+
+
+h2. Bundles
+
+The core unit of deployment is the _Bundle_. The OSGi core specification defines a _Bundle_ to be a Java Archive (JAR) file whose manifest - the {{META-INF/MANIFEST.MF}} file - contains specific headers identifying the bundle. Most manifest headers are optional with defined default values - only the {{Bundle-SymbolicName}} header is actually required and the {{Bundle-ManifestVersion}} header should be set to {{2}} to identify the bundle to be a R4 bundle. Other information defined in the manifest is the bundle version, the list of packages exported - provided to other bundles - and imported - used and required to be provided by other bundles. See chapter _3.2.1 Bundle Manifest Header_ of the OSGi Service Platform Core Specification for a complete list of the defined bundle manifest headers.
+
+Bundles may be installed, updated , started, stopped and removed in an OSGi framework individually.
+
+
+
+h2. Assemblies
+
+For the deployment of bigger systems, the number of bundles may increase very quickly. To ease the management of products consisting of multiple bundles, this chapter introduces the _Assembly_. An Assembly is simply a collection of bundles deployed together. An Assembly - like a Bundle - is a JAR file whose manifest contains specific headers. In fact, an Assembly is just a standard bundle, with additional functionality.
+
+Assemblies are managed by the _Assembly Manager_ which itself is a bundle installed into the framework.
+
+
+
+h3. Assembly manifest headers
+
+As an Assembly is a standard Bundle, all the defined Bundle manifest headers may be specified. In addition, for the _Assembly Manager_ to recognize an assembly and for the OSGi Bundle Repository to support dependency resolution, the following manifest headers are defined. All headers are optional with documented default values except where noted.
+
+ *Assembly-Bundles*
+
+ {indent}
+
+ The list of bundles contained in this assembly. See below for the definition of the syntax of this header. This header is required. The presence of this headers identifies an Assembly to the _Assembly Manager_.
+
+ {indent}
+ *Assembly-BundleRepository*
+ {indent}
+ A comma-separated list of URLs pointing to OSGi Bundle Repository descriptors. These bundle repositories will be used to install bundles listed in the {{Assembly-Bundles}} header. This header is optional with not default value.
+ {indent}
+
+
+
+h3. Assembly Lifecycle
+
+An Assembly, like all bundles, may be in any of the defined bundle states:
+
+ *Installed*
+
+ {indent}
+
+ The Assembly bundle has been installed into the system but not yet resolved. The _Assembly Manager_ will try to install all bundles listed in the {{Assembly-Bundles}} header. The start levels of the bundles will be set according to the {{startlevel}} parameter. The bundles will not be started. If installation of one or more of the bundles fails, *Assembly Manager* logs an error message.
+
+ {indent}
+ *Resolved*
+ {indent}
+ The Assembly bundle is resolved, that is all imported packages are wired into the framework. The _Assembly Manager_ does not handle this state change, rather the installed bundles will be resolved by the framework either automatically after installation or when started later.
+ {indent}
+ *Started*
+ {indent}
+ The Assembly bundle has been started by calling the {{Bundle.start()}} method. The _Assembly Manager_ will start all newly installed and resolved bundles. Depending on the start level set on the bundle(s) and the current system start level, the bundles will only be permanently marked to start while actually starting the bundles may be delayed until the system enters the respective start level. If any bundle fails to start, an error message is logged.
+ {indent}
+ *Stopped*
+ {indent}
+ The Assembly bundle has been stopped by calling the {{Bundle.stop()}} method. All bundles belong to the Assembly and linked to the Assembly are also stopped.
+ {indent}
+ *Unresolved*
+ {indent}
+ The Assembly bundle has been unresolved by the system for any reason, possibly any missing dependencies. Assembly bundles entering this state are ignored by the _Assembly Manager_.
+ {indent}
+ *Uninstalled*
+ {indent}
+ The Assembly bundle is being uninstalled by calling the {{Bundle.uninstall()}} method. The _Assembly Manager_ will (try to) uninstall all bundles listed in the {{Assembly-Bundles}} header.
+ {indent}
+ *Updated*
+ {indent}
+ The Assembly bundle will update all bundles installed previously according to the {{Assembly-Bundles}} header. If this header omits any bundle listed in the previous bundle version, the respective bundle is uninstalled from the system. If a bundle is already installed with the correct version, the installed bundle is not touched (It may though be uninstalled together with the Assembly Bundle if the Assembly Bundle is uninstalled).
+ {indent}
+
+
+
+h3. Bundles referenced by multiple Assembly Bundles
+
+It is conceivable, that bundles are listed in the {{Assembly-Bundles}} header of more than one Assembly Bundle. If this is the case, the following collision resolution takes place:
+
+ * If the version of the bundle installed by the first Assembly bundle handled matches the version specification of any later Assembly Bundle, the installed bundle is not touched. Otherwise, if the later Assembly Bundle lists a version specification, which is acceptable for the first Assembly Bundle, the installed bundle is updated to the required version. If the version specifications may not be matched one way or the other, the later Assembly Bundle fails to install.
+ * If the bundle is installed with a defined start level, the later Assembly Bundle will not overwrite the already set start level. If the start level has not been set yet it is set to the specified start level.
+ * Bundles installed through Assembly Bundles remain installed as long as there is at least one Assembly Bundle listing the bundle in the {{Assembly-Bundles}} header. As soon as there is no referring Assembly Bundle anymore, the bundle is uninstalled.
+ * Bundles not referred to by any Assembly Bundle are ignored by the _Assembly Manager_.
+ * Bundles installed through the _Assembly Manager_ may be updated and/or uninstalled independently from their defining Assembly Bundle. If a bundle has been installed it will be reinstalled the next time the Assembly Bundle enters the _installed_ state. If a bundle has been updated, it is not touched by the _Assembly Manager_ as long as the updated version matches the version specification of the Assembly Bundle.
+\\
+\\
+\\
+
+h3. Bundle Installation
+
+When an Assembly is installed into the framework, the _Assembly Manager_ checks to see whether the Assembly needs to be deployed. This is done by checking the bundles listed in the {{Assembly-Bundles}} header whether they are installed or not. All bundles not installed will be installed and started if requested so.
+
+The following BNF defines the syntax =Assembly-Bundles= header value:
+
+{{{Assembly-Bundles = Bundle \{ &quot;,&quot; Bundle \} . Bundle = Symbolic-Name \{ &quot;;&quot; Parameter \} . Symbolic-Name = // The Bundle symbolic name  Parameter = [ParameterName] &quot;=&quot; [ParameterValue] .}}}
+
+To control the selection and installation of bundles, the following parameters may be used:
+
+ *version*
+
+ {indent}
+
+ The version of the bundle to install. This is a version range specification as per chapter 3.2.5 Version Ranges of the OSGi core specification. When this parameter is declared as a single version - eg. _1.2.3_ - it is interpreted as the version range _~\[1.2.3, ∞~)_. The default value is _~\[0.0.0,∞~)_ to install the most recent version of the bundle available.
+
+ {indent}
+ *startlevel*
+ {indent}
+ The start level to set for the bundle. This may be any positive integer value. Default value is undefined to use the current initial bundle start level of the framework.
+ {indent}
+ *entry*
+ {indent}
+ The path of the Assembly Bundle entry providing the data to be installed.
+ {indent}
+ *linked*
+ {indent}
+ Defines whether the bundle should be started and stopped together with the Assembly to which the bundle belongs. Default value is {{true}}.
+ {indent}
+
+If resolving the bundles results in more bundles to be downloaded from the bundle repository to resolve the dependency, these bundles are always automatically started and assigned a startlevel which is smaller than the smallest startlevel of any of the bundles listed.
+
+
+h3. Bundle Location
+
+Generally bundles to be installed with an Assembly Bundle are retrieved from an OSGi Bundle Repository. The {{Assembly-BundleRepository}} header may list additional URLs which will be temporarily used to resovle the bundles. Otherwise the system default bundle repositories will be used only.
+
+If a bundle is defined in the {{Assembly-Bundles}} header with an {{entry}} parameter, the respective entry is first looked for in the Assembly Bundle. If the entry exists, it is used as the bundle source to install. If no {{entry}} parameter is present for a declared bundle or the entry is missing, the OSGi Bundle Repository is used.
+
+Restrictions when packaging bundles with the Assembly:
+
+ *Dependency Resolution*
+
+ {indent}
+
+ Any missing dependencies of the bundles to be installed will not be resolved. That is, if the bundles fail to resolve, the Assembly fails to install.
+
+ {indent}
+ *version Parameter*
+ {indent}
+ The {{version}} parameter of the bundle installation declaration is ignored because any JAR file whose name matches the bundle symbolic name to be installed, is installed.
+ {indent}
+
+If the {{Assembly-BundleRepository}} header contains a comma-separated list of URL to OSGi Bundle Repository descriptors and the OSGi Bundle Repository Service is available in the framework, the bundles declared in the {{Assembly-Bundles}} header are resolved through the OSGi Bundle Repository Service using the URL from the {{Assembly-BundleRepository}} header.
+
+If the bundles declare any dependencies, which may not be resolved by bundles already installed in the framework or by any of the bundles to be installed, the OSGi Bundle Repository is used to try to resolve these missing dependencies. If this resolution succeeds, installation of the Assembly succeeds. Any bundles not declared in the Assembly but installed due to this dependency resolution will not be assumed to belong to the Assembly. Hence, these bundles will not be uninstalled (or updated) if the Assembly is uninstalled (or updated).
+
+ *Example*
+
+ {indent}
+
+ Assume the {{Assembly-Bundles}} header is set to {{com.day.sample1;entry=path.jar,com.day.sample2}}. The bundle {{com.day.sample1}} is then installed from the Assembly Bundle entry {{path.jar}}, while the bundle {{com.day.sample2}} is resolved in the OSGi Bundle Repository.
+
+ {indent}
+
+
+
+h2. Maven Plugin
+
+A Maven Plugin will be made available to help creating Assembly Bundles. This plugin is currently being developped and will shortly be described here.
+
+
+
+h2. Best Practices
+
+
+h3. Size of Bundles
+
+There is no fixed formula to calculate the best size for a bundle: It all depends on the contents and the intentions of the bundle and its programmer. The following list provides some hints:
+
+ * For ease of development follow the idea of _One Bundle - One Project_
+ * Don't pack too much into a bundle but do not pack a single class into a bundle (unless you have a very good reason of course :) )
+ * Do not mix and match everything into a bundle. Rather bundle things together which belong together, for example create separate bundles for a HTTP Client implementation and DB support classes
+ * Use similar heuristics to decide on the contents of a bundle as you would for the contents of a plain old JAR file.
+\\
+\\
+
+h3. Nomen est Omen
+
+The symbolic name of a bundle should reflect its contents. A bundle should generally only contain a single subtree in the virtual package tree. The symbolic name of the bundle should be the root package contained within. For example, consider a bundle containing the packages {{com.day.sample}}, {{com.day.sample.impl}}, {{com.day.sample.more}}. The bundle would the be named {{com.day.sample}}.
+                    </div>
+
+                    
+                                                      
+                </div>             </div> 
+            <div id="footer" role="contentinfo">
+                <section class="footer-body">
+                    <p>Document generated by Confluence on May 20, 2019 11:11</p>
+                    <div id="footer-logo"><a href="http://www.atlassian.com/">Atlassian</a></div>
+                </section>
+            </div>
+        </div>     </body>
+</html>

Propchange: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingAssembly_115513334.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/site/live/archive/wiki/JCR/ApacheSling-SlingAssembly_115513334.html
------------------------------------------------------------------------------
    svn:executable = *