You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2012/12/12 10:14:44 UTC

svn commit: r1420577 [10/30] - in /sling/site/trunk/content/site: ./ 46-line-blog.data/ authentication.data/ documentation.data/ first-steps.data/ getting-and-building-sling.data/ how-to-manage-events-in-sling.data/ index.data/ links.data/ manipulating...

Added: sling/site/trunk/content/site/everything-is-a-resource.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/everything-is-a-resource.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/everything-is-a-resource.html (added)
+++ sling/site/trunk/content/site/everything-is-a-resource.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,467 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Everything is a Resource</TITLE>
+    <LINK rel="stylesheet" href="http://incubator.apache.org/sling/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://incubator.apache.org/sling/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://incubator.apache.org/sling/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://incubator.apache.org/sling/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://incubator.apache.org/">
+          <IMG border="0" alt="Apache Incubator" src="http://incubator.apache.org/images/apache-incubator-logo.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+                                    <P>
+
+<UL>
+	<LI><A href="index.html" title="Index">Home</A></LI>
+	<LI><A href="project-information.html" title="Project Information">Project Information</A></LI>
+	<LI><A href="usecases.html" title="UseCases">Use Cases</A></LI>
+	<LI><A href="guides.html" title="Guides">Guides</A></LI>
+	<LI><A href="documentation.html" title="Documentation">Documentation</A></LI>
+	<LI><A href="plugins.html" title="Plugins">Plugins</A></LI>
+	<LI><A href="faq.html" title="FAQ">FAQ</A></LI>
+	<LI><A href="links.html" title="Links">Links</A></LI>
+	<LI><A href="old-documentation.html" title="Old Documentation">Old Documentation</A></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/x/GAUB" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/thanks.html" title="Visit page outside Confluence" rel="nofollow">Sponsors<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/sponsorship.html" title="Visit page outside Confluence" rel="nofollow">Sponsorship<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+</UL>
+
+
+<P>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </DIV>
+    <DIV class="main">
+<H1><A name="EverythingisaResource-IntroducingtheSlingParadigm%3AEverythingisaResource"></A>Introducing the Sling Paradigm: Everything is a Resource</H1>
+
+
+
+<P>Status: DRAFT<BR>
+Created: 22. December 2007<BR>
+Author: fmeschbe</P>
+
+<DIV>
+<UL>
+  <LI><A href="#EverythingisaResource-1CurrentState">1 Current State</A></LI>
+  <LI><A href="#EverythingisaResource-2EntertheSlingParadigm">2 Enter the Sling Paradigm</A></LI>
+  <LI><A href="#EverythingisaResource-3ImplementingtheSlingParadigm">3 Implementing the Sling Paradigm</A>
+<UL>
+  <LI><A href="#EverythingisaResource-3.1ResourceProvisioning">3.1 Resource Provisioning</A></LI>
+  <LI><A href="#EverythingisaResource-3.2Adapters">3.2 Adapters</A>
+<UL>
+  <LI><A href="#EverythingisaResource-3.2.1Adaptable">3.2.1 Adaptable</A></LI>
+  <LI><A href="#EverythingisaResource-3.2.1SlingAdaptable">3.2.1 SlingAdaptable</A></LI>
+  <LI><A href="#EverythingisaResource-3.2.1AdapterFactory">3.2.1 AdapterFactory</A></LI>
+  <LI><A href="#EverythingisaResource-3.2.1AdapterManager">3.2.1 AdapterManager</A></LI>
+</UL></LI>
+  <LI><A href="#EverythingisaResource-3.3ChangeEvents">3.3 Change Events</A></LI>
+  <LI><A href="#EverythingisaResource-3.4ResourceEnumeration">3.4 Resource Enumeration</A></LI>
+</UL></LI>
+  <LI><A href="#EverythingisaResource-4EmployingtheSlingParadigm">4 Employing the Sling Paradigm</A>
+<UL>
+  <LI><A href="#EverythingisaResource-4.1ResourcesinBundles">4.1 Resources in Bundles</A></LI>
+  <LI><A href="#EverythingisaResource-4.2Servlets">4.2 Servlets</A></LI>
+  <LI><A href="#EverythingisaResource-4.3Filters">4.3 Filters</A>
+<UL>
+  <LI><A href="#EverythingisaResource-4.3.1FilterServices">4.3.1 Filter Services</A></LI>
+  <LI><A href="#EverythingisaResource-4.3.2FilterScripts">4.3.2 Filter Scripts</A></LI>
+</UL></LI>
+  <LI><A href="#EverythingisaResource-4.4ScriptsfromResource">4.4 Scripts from Resource</A></LI>
+</UL></LI>
+  <LI><A href="#EverythingisaResource-5ChangestotheCode">5 Changes to the Code</A>
+<UL>
+  <LI><A href="#EverythingisaResource-5.1SlingAPI">5.1 Sling API</A></LI>
+  <LI><A href="#EverythingisaResource-5.2OSGiCommons">5.2 OSGi Commons</A></LI>
+  <LI><A href="#EverythingisaResource-5.3Merge%257B%257Bscripting%252Fresolver%257D%257Dinto%257B%257Bsling%252Fservletresolver%257D%257D">5.3 Merge <TT>scripting/resolver</TT> into <TT>sling/servlet-resolver</TT></A></LI>
+  <LI><A href="#EverythingisaResource-5.4SeparateObjectContentMappingfromResourceResolution">5.4 Separate Object Content Mapping from Resource Resolution</A></LI>
+  <LI><A href="#EverythingisaResource-5.5EnhanceSlingConsole">5.5 Enhance Sling Console</A></LI>
+  <LI><A href="#EverythingisaResource-5.6CreateNewAdapterProject">5.6 Create New Adapter Project</A></LI>
+</UL></LI>
+</UL></DIV>
+
+
+<H2><A name="EverythingisaResource-1CurrentState"></A>1 Current State</H2>
+
+<P>Currently Sling uses resources, servlets and scripts as follows:</P>
+
+<UL>
+	<LI>The <TT>Resource</TT> interface is mainly used to abstract JCR <TT>Node</TT> instances</LI>
+	<LI>The <TT>ServletResolver</TT> uses an internal registration of servlets registered as OSGi services with the interface <TT>javax.servlet.Servlet</TT> and selects the servlet based on the resource type of the <TT>Resource</TT> of the request only.</LI>
+	<LI>The <TT>ScriptResolver</TT> uses the <TT>ResourceResolver</TT> to find request handling scripts based on the resource type of the <TT>Resource</TT> of the request, the request selector string and the request method or request extension.</LI>
+	<LI>Request processing filters are based on OSGi services registered with the interface name <TT>javax.servlet.Filter</TT></LI>
+	<LI>Error handling is implemented in the <TT>ServletResolver</TT> implementation using the same mechanism to find a servlet (or script) based on the response status code or the caught <TT>Throwable</TT> as the pseudo request method name and using a different default error handling servlet.</LI>
+</UL>
+
+
+<P>This mechanism works rather good, but there are currently enhancement requests, which may not easily be implemented with the current concepts:</P>
+
+<UL>
+	<LI>Allow scripting of request processing filters. Implementing this requires special filter wrappers, which may select filter scripts.</LI>
+	<LI>Enhance servlet selection to include the same parameters as script resolution, namely the request selector string and the request method or request extension. Implementing this would require replicating much of the code of the current <TT>ScriptResolver</TT> implementation.</LI>
+</UL>
+
+
+
+<H2><A name="EverythingisaResource-2EntertheSlingParadigm"></A>2 Enter the Sling Paradigm</H2>
+
+<P>To overcome the limitations we introduce the Sling paradigm</P>
+
+<DIV class="panel"><DIV class="panelContent">
+<P>Everything is a Resource</P>
+</DIV></DIV>
+
+<P>The Sling paradigm brings the paradigm of Java Content Repository API (JCR) <EM>Everything is Content</EM> to Sling.</P>
+
+<P>This means, that every script, servlet, filter, error handler, etc. is available from the <TT>ResourceResolver</TT> just like normal content providing data to be rendered upon requests. To enable this resource resolution and resources have to provide certain functionality:</P>
+
+<UL>
+	<LI>Allow registration of resources with the resource resolver. This is required to access servlets and filters registered as OSGi services through the resource resolver.</LI>
+	<LI>Provide eventing mechanism to support caching and cache management</LI>
+	<LI>Extend resource adapter mechanism, that is to provide extension to the <TT>Resource.adaptTo(Class&lt;?&gt;)</TT> method</LI>
+	<LI>Extend resource enumeration to include resources from various sources</LI>
+</UL>
+
+
+
+
+<H2><A name="EverythingisaResource-3ImplementingtheSlingParadigm"></A>3 Implementing the Sling Paradigm</H2>
+
+<H3><A name="EverythingisaResource-3.1ResourceProvisioning"></A>3.1 Resource Provisioning</H3>
+
+<P>To be able to access resources from different locations through a single resource resolver, a new <TT>ResourceProvider</TT> interface is added. A resource provider is able to provide resources below a certain location in the (virtual) resource tree. The resource resolver selects a resource provider to ask for a resource looking for a longest match amongst the root paths of the providers. If the longest match resource provider cannot find the requested resource, the provider with the second longest match is asked, and so forth.</P>
+
+<P>Accessing the JCR repository is also implemented in the form of a resource provider. This JCR resource provider is registered at the root &ndash; <TT>/</TT> &ndash; of the (virtual) resource tree. Thus the JCR repository is always asked if, no more specific resource provider has the requested resource.</P>
+
+<P>The <TT>ResourceProvider</TT> interface is defined as follows:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.apache.sling.api.resource;
+
+<SPAN class="code-keyword">public</SPAN> class ResourceProvider {
+
+    /**
+     * The name of the service registration property containing the root paths
+     * of the resources provided by <SPAN class="code-keyword">this</SPAN> provider (value is <SPAN class="code-quote">&quot;provider.roots&quot;</SPAN>).
+     */
+    <SPAN class="code-keyword">static</SPAN> <SPAN class="code-keyword">final</SPAN> <SPAN class="code-object">String</SPAN> ROOTS = <SPAN class="code-quote">&quot;provider.roots&quot;</SPAN>;
+
+    /**
+     * Returns a resource from <SPAN class="code-keyword">this</SPAN> resource provider or &lt;code&gt;<SPAN class="code-keyword">null</SPAN>&lt;/code&gt; <SPAN class="code-keyword">if</SPAN>
+     * the resource provider cannot find it. The path should have one of the
+     * {@link #getRoots()} strings as its prefix.
+     * &lt;p&gt;
+     * This method is called to resolve a resource <SPAN class="code-keyword">for</SPAN> the given request. The
+     * properties of the request, such as request parameters, may be use to
+     * parametrize the resource resolution. An example of such parametrization
+     * is support <SPAN class="code-keyword">for</SPAN> a JSR-311 style resource provider to support the
+     * parametrized URL patterns.
+     * 
+     * @<SPAN class="code-keyword">throws</SPAN> SlingException may be thrown in <SPAN class="code-keyword">case</SPAN> of any problem creating the
+     *             &lt;code&gt;Resource&lt;/code&gt; instance.
+     */
+    Resource getResource(/* ResourceResolver resourceResolver, */
+          HttpServletRequest request, <SPAN class="code-object">String</SPAN> path) <SPAN class="code-keyword">throws</SPAN> SlingException;
+
+    /**
+     * Returns a resource from <SPAN class="code-keyword">this</SPAN> resource provider or &lt;code&gt;<SPAN class="code-keyword">null</SPAN>&lt;/code&gt; <SPAN class="code-keyword">if</SPAN>
+     * the resource provider cannot find it. The path should have one of the
+     * {@link #getRoots()} strings as its prefix.
+     *
+     * @<SPAN class="code-keyword">throws</SPAN> SlingException may be thrown in <SPAN class="code-keyword">case</SPAN> of any problem creating the
+     *             &lt;code&gt;Resource&lt;/code&gt; instance.
+     */
+    Resource getResource(<SPAN class="code-object">String</SPAN> path) <SPAN class="code-keyword">throws</SPAN> SlingException;
+
+    /**
+     * Returns an &lt;code&gt;Iterator&lt;/code&gt; of {@link Resource} objects loaded
+     * from the children of the given &lt;code&gt;Resource&lt;/code&gt;.
+     * &lt;p&gt;
+     * This method is only called <SPAN class="code-keyword">for</SPAN> resource providers whose root path list
+     * contains an entry which is a prefix <SPAN class="code-keyword">for</SPAN> the path of the parent resource.
+     * 
+     * @param parent The {@link Resource Resource} whose children are requested.
+     * @<SPAN class="code-keyword">return</SPAN> An &lt;code&gt;Iterator&lt;/code&gt; of {@link Resource} objects or
+     *         &lt;code&gt;<SPAN class="code-keyword">null</SPAN>&lt;/code&gt; <SPAN class="code-keyword">if</SPAN> the resource provider has no children <SPAN class="code-keyword">for</SPAN>
+     *         the given resource.
+     * @<SPAN class="code-keyword">throws</SPAN> NullPointerException If &lt;code&gt;parent&lt;/code&gt; is
+     *             &lt;code&gt;<SPAN class="code-keyword">null</SPAN>&lt;/code&gt;.
+     * @<SPAN class="code-keyword">throws</SPAN> SlingException If any error occurs acquiring the child resource
+     *             iterator.
+     */
+    Iterator&lt;Resource&gt; listChildren(Resource parent) <SPAN class="code-keyword">throws</SPAN> SlingException;
+}</PRE>
+</DIV></DIV>
+
+<P>Resource providers are registered as OSGi services under the name <TT>org.apache.sling.api.resource.ResourceProvider</TT> providing the list of resource path roots as a service registration property with the name <TT>provider.roots</TT>.</P>
+
+
+<H3><A name="EverythingisaResource-3.2Adapters"></A>3.2 Adapters</H3>
+
+<P>The <TT>Resource</TT> and <TT>ResourceResolver</TT> interfaces are defined with a method <TT>adaptTo</TT>, which adapts the object to other classes. Using this mechanism the JCR session of the resource resolver calling the <TT>adaptTo</TT> method with the <TT>javax.jcr.Session</TT> class object. Likewise the node on which a resource is based can be retrieved by calling the <TT>Resource.adaptTo</TT> method with the <TT>javax.jcr.Node</TT> class object.</P>
+
+<P>To use resources as scripts, the <TT>Resource.adaptTo</TT> method must support being called with the <TT>org.apache.sling.api.script.SlingScript</TT> class object. But of course, we do not want to integrate the script manager with the resource resolver. To enable adapting objects to classes which are not foreseen by the original implementation, a factory mechanism is used. This way, the script manager can provide an adapter factory to adapt <TT>Resource</TT> to <TT>SlingScript</TT> objects.</P>
+
+
+<H4><A name="EverythingisaResource-3.2.1Adaptable"></A>3.2.1 Adaptable</H4>
+
+<P>The <TT>Adaptable</TT> interface defines the API to be implemented by a class providing adaptability to another class. The single method defined by this interface is</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">/**
+ * Adapts the adaptable to another type.
+ *
+ * @param &lt;AdapterType&gt; The <SPAN class="code-keyword">generic</SPAN> type to which <SPAN class="code-keyword">this</SPAN> resource is adapted
+ *            to
+ * @param type The <SPAN class="code-object">Class</SPAN> object of the target type, such as
+ *            &lt;code&gt;Node.class&lt;/code&gt;
+ * @<SPAN class="code-keyword">return</SPAN> The adapter target or &lt;code&gt;<SPAN class="code-keyword">null</SPAN>&lt;/code&gt; <SPAN class="code-keyword">if</SPAN> the resource cannot
+ *         adapt to the requested type
+ */
+&lt;AdapterType&gt; AdapterType adaptTo(<SPAN class="code-object">Class</SPAN>&lt;AdapterType&gt; type);</PRE>
+</DIV></DIV>
+
+<P>This method is called to get a view of the same object in terms of another class. Examples of implementations of this method is the Sling <TT>ResourceResolver</TT> implementation providing adapting to a JCR session and the Sling JCR based <TT>Resource</TT> implementation providing adapting to a JCR node.</P>
+
+
+<H4><A name="EverythingisaResource-3.2.1SlingAdaptable"></A>3.2.1 SlingAdaptable</H4>
+
+<P>The <TT>SlingAdaptable</TT> class is an implementation of the <TT>Adaptable</TT> interface, calls the <TT>AdapterManager</TT> (see below) to provider an adapter to the <TT>SlingAdaptable</TT> object to the requested class. This class may be extended to have extensible adapters not foreseen at the time of the class development.</P>
+
+<P>An example of extending the <TT>SlingAdaptable</TT> class will be the Sling JCR based <TT>Resource</TT> implementation. This way, such a resource may be adapted to a <TT>SlingScript</TT> by means of an appropriatley programmed <TT>AdapterFactory</TT> (see below).</P>
+
+
+<H4><A name="EverythingisaResource-3.2.1AdapterFactory"></A>3.2.1 AdapterFactory</H4>
+
+<P>The <TT>AdapterFactory</TT> interface defines the service interface and API for factories supporting extensible adapters for <TT>SlingAdaptable</TT> objects. The interface has a single method:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">/**
+ * Adapt the given adaptble object to the adaptable type. The adaptable
+ * object is guaranteed to be an instance of one of the classes listed in
+ * the {@link #ADAPTABLE_CLASSES} services registration property. The type
+ * parameter is on of the classes listed in the {@link #ADAPTER_CLASSES}
+ * service registration properties.
+ *
+ * @param &lt;AdapterType&gt;
+ * @param adaptable
+ * @param type
+ * @<SPAN class="code-keyword">return</SPAN>
+ */
+&lt;AdapterType&gt; AdapterType getAdapter(<SPAN class="code-object">Object</SPAN> adaptable,
+        <SPAN class="code-object">Class</SPAN>&lt;AdapterType&gt; type);</PRE>
+</DIV></DIV>
+
+<P>This method is called by the <TT>AdapterManager</TT> on behalf of the <TT>SlingAdaptable</TT> object providing the <TT>SlingAdaptable</TT> as the <TT>adaptable</TT> parameter the requested class as the <TT>type</TT> parameter. Implementations of this interface are registered as OSGi services providing two lists: The list of classes wich may be adapted and the list of classes to which the adapted class may be adapted.</P>
+
+
+<H4><A name="EverythingisaResource-3.2.1AdapterManager"></A>3.2.1 AdapterManager</H4>
+
+<P>The <TT>AdapterManager</TT> is an internal class used by the <TT>SlingAdaptable</TT> objects to find an <TT>AdapterFactory</TT> to delegate the <TT>adaptTo</TT> method call to. To make the <TT>AdapterManager</TT> available globally, it is actually defined as a service interface. Thus the adapter manager may be retrieved from the service registry to try to adapt whatever object that needs to be adapted - provided appropriate adapters exist.</P>
+
+<P>The <TT>AdapterManager</TT> interface is defined as follows:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> AdapterManager {
+
+    /**
+     * Returns an adapter object of the requested &lt;code&gt;AdapterType&lt;/code&gt; <SPAN class="code-keyword">for</SPAN>
+     * the given &lt;code&gt;adaptable&lt;/code&gt; object.
+     * &lt;p&gt;
+     * The &lt;code&gt;adaptable&lt;/code&gt; object may be any non-&lt;code&gt;<SPAN class="code-keyword">null</SPAN>&lt;/code&gt;
+     * object and is not required to implement the &lt;code&gt;Adaptable&lt;/code&gt;
+     * <SPAN class="code-keyword">interface</SPAN>.
+     * 
+     * @param &lt;AdapterType&gt; The <SPAN class="code-keyword">generic</SPAN> type of the adapter (target) type.
+     * @param adaptable The object to adapt to the adapter type.
+     * @param type The type to which the object is to be adapted.
+     * @<SPAN class="code-keyword">return</SPAN> The adapted object or &lt;code&gt;<SPAN class="code-keyword">null</SPAN>&lt;/code&gt; <SPAN class="code-keyword">if</SPAN> no factory exists to
+     *         adapt the &lt;code&gt;adaptable&lt;/code&gt; to the
+     *         &lt;code&gt;AdapterType&lt;/code&gt; or <SPAN class="code-keyword">if</SPAN> the &lt;code&gt;adaptable&lt;/code&gt;
+     *         cannot be adapted <SPAN class="code-keyword">for</SPAN> any other reason.
+     */
+    &lt;AdapterType&gt; AdapterType getAdapter(<SPAN class="code-object">Object</SPAN> adaptable,
+            <SPAN class="code-object">Class</SPAN>&lt;AdapterType&gt; type);
+
+}</PRE>
+</DIV></DIV>
+
+
+
+<H3><A name="EverythingisaResource-3.3ChangeEvents"></A>3.3 Change Events</H3>
+
+<P>The Sling <TT>ResourceResolver</TT> implementation defines events to be fired on changes in the (virtual) resource tree:</P>
+
+<UL>
+	<LI>All repository events are forwarded</LI>
+	<LI>Resource provider addition and removal events are generated</LI>
+</UL>
+
+
+<P>Events are transmitted using the OSGi EventTracker specification. That is interested parties must register as OSGi event listener services.</P>
+
+
+<H3><A name="EverythingisaResource-3.4ResourceEnumeration"></A>3.4 Resource Enumeration</H3>
+
+<P>To be help in development and debugging and also to merely visualize the (virtual) resource tree, the resource tree must be explorable. That is, for every resource, the method <TT>ResourceResolver.listChildren(Resource resource)</TT> method must return all resources which may be considered children of the given resource.</P>
+
+<P>Consider for example the following (partial) repository:</P>
+
+<DIV class="preformatted"><DIV class="preformattedContent">
+<PRE>/
++-- filters
+        +-- request
+                +-- FilterA.esp
+                +-- FilterB.jsp
+</PRE>
+</DIV></DIV>
+
+<P>Further consider the filter <EM>FilterC</EM> registered as an OSGi service. Thus the <TT>listChildren</TT> call for the resource at <TT>/filters/request</TT> must return three resources <TT>/filters/request/FilterA.esp</TT>, <TT>/filters/request/FilterB.jsp</TT> and <TT>/filters/request/FilterC</TT>. The first two will be JCR based resources, while the latter will be  a servlet resource.</P>
+
+
+<H2><A name="EverythingisaResource-4EmployingtheSlingParadigm"></A>4 Employing the Sling Paradigm</H2>
+
+<H3><A name="EverythingisaResource-4.1ResourcesinBundles"></A>4.1 Resources in Bundles</H3>
+
+<P>Resources may be located in OSGi bundles and mapped into the (virtual) resource tree by means of a <TT>BundleResourceProvider</TT>. Bundles containing resources indicate this fact by means of a special bundle manifest header: <TT>Sling-Bundle-Resources</TT>. Two notes regarding bundle resources:</P>
+
+<OL>
+	<LI>Bundle entries are either files or directories. To have these files and directories be handled as if they would be file and folder nodes in a repository, bundle based files will have a resource type <TT>nt:file</TT> and bundle based directories will have a resource type <TT>nt:folder</TT>.</LI>
+	<LI>Bundle resource may be anything which may be represented by a file (or directory). That is the resources may be static content to be delivered to clients on request or resources may be scripts to be called to handle requests (or filter scripts even).</LI>
+</OL>
+
+
+
+<H3><A name="EverythingisaResource-4.2Servlets"></A>4.2 Servlets</H3>
+
+<P>Servlets to be used for request processing are registered as OSGi services with a series of required service registration properties:</P>
+
+<OL>
+	<LI><TT>servlet.name</TT> - The name of the servlet as returned from <TT>ServletConfig.getServletName()</TT>. If this property is not set, the <TT>component.name</TT>, <TT>service.pid</TT> and <TT>service.id</TT> properties are checked in order.</LI>
+	<LI><TT>servlet.path</TT> - A list of absolute paths under which the servlet is provided in the (virtual) resource tree.</LI>
+	<LI><TT>sling.servlet.paths</TT> - The name of the service registration property of a Servlet registered as a service providing the absolute paths under which the servlet is accessible as a Resource (value is &quot;sling.servlet.paths&quot;). The type of this property is a String or String[] (array of strings) denoting the resource types.</LI>
+	<LI><TT>sling.servlet.resourceTypes</TT> - The name of the service registration property of a Servlet registered as a service containing the resource type(s) supported by the servlet (value is &quot;sling.servlet.resourceTypes&quot;). The type of this property is a String or String[] (array of strings) denoting the resource types. This property is ignored if the <TT>SLING_SERVLET_PATHS</TT> property is set. Otherwise this property must be set or the servlet is ignored.</LI>
+	<LI><TT>sling.servlet.selectors</TT> - The name of the service registration property of a Servlet registered as a service containing the request URL selectors supported by the servlet (value is &quot;sling.servlet.selectors&quot;). The selectors must be configured as they would be specified in the URL that is as a list of dot-separated strings such as <EM>print.a4</EM>. The type of this property is a String or String[] (array of strings) denoting the resource types. This property is ignored if the <TT>SLING_SERVLET_PATHS</TT> property is set. Otherwise this property is optional and ignored if not set.</LI>
+	<LI><TT>sling.servlet.extensions</TT> - The name of the service registration property of a Servlet registered as a service containing the request URL extensions supported by the servlet for GET requests (value is &quot;sling.servlet.extensions&quot;). The type of this property is a String or String[] (array of strings) denoting the resource types. This property is ignored if the <TT>SLING_SERVLET_PATHS</TT> property is set. Otherwise this property or <TT>SLING_SERVLET_METHODS</TT> must be set or the servlet is ignored.</LI>
+	<LI><TT>sling.servlet.methods</TT> - The name of the service registration property of a Servlet registered as a service containing the request methods supported by the servlet (value is &quot;sling.servlet.methods&quot;). The type of this property is a String or String[] (array of strings) denoting the resource types. This property is ignored if the <TT>SLING_SERVLET_PATHS</TT> property is set. Otherwise this property or <TT>SLING_SERVLET_EXTENSIONS</TT> must be set or the servlet is ignored.</LI>
+</OL>
+
+
+
+<P>A <TT>SlingServletResolver</TT> will listen for <TT>Servlet</TT> services and - given the correct service registration properties - provide the servlets as resources in the (virtual) resource tree. Such servlets are provided as <TT>ServletResource</TT> instances which adapt to the <TT>javax.servlet.Servlet</TT> class.</P>
+
+
+<H3><A name="EverythingisaResource-4.3Filters"></A>4.3 Filters</H3>
+
+<P>Filters may be provided in two different ways: As <TT>javax.servlet.Filter</TT> instances registered as OSGi services and as scripts located in a predefined place. When requests are processed the filters are looked up in the (virtual) resource tree below the <TT>/filters</TT> node. The list of filters is comprised of all the filters directly below the respective scope &ndash; <EM>request</EM> or <EM>resource</EM> &ndash; and the those below the respective scope and the type of the resource of the request.</P>
+
+<P>The filters are sorted by their names. Hence a convention for the names of the filters in the (virtual) resource tree is defined such that the names is composed of an ordering number and the actual filter name, e.g. <EM>0&#95;sample</EM>.</P>
+
+<H4><A name="EverythingisaResource-4.3.1FilterServices"></A>4.3.1 Filter Services</H4>
+
+<P>Filters registered as OSGi services have three required service registration properties:</P>
+
+<OL>
+	<LI><TT>filter.scope</TT> - (String) Scope of the filter, which must be either <EM>request</EM> or <EM>resource</EM></LI>
+	<LI><TT>filter.order</TT> - (Integer) Call order of the filter used to define the filter call sequence</LI>
+	<LI><TT>filter.name</TT> - (String) The name of the filter as returned <TT>FilterConfig.getFilterName()</TT>. If this property is not set, the <TT>component.name</TT>, <TT>service.pid</TT> and <TT>service.id</TT> properties are checked in order.</LI>
+	<LI><TT>filter.resource.type</TT> - (String[]) The list of resource types to which this filter applies. This property is optional. If missing, the filter applies to all resource types. If this property is an empty list, the filter is not used as it applies to an empty list of resource types.</LI>
+</OL>
+
+
+<P>Such Filter services are added to the (virtual) resource tree at a path defined as follows for each resource type <TT>resource_type</TT> listed in the <TT>filter.resource.type</TT>.</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">/filters/${filter.scope}/${resource_type}/${filter.order}_${filter.name}</PRE>
+</DIV></DIV>
+
+<P>If the <TT>filter.resource.type</TT> property is missing, the filter is added at</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">/filters/${filter.scope}/${filter.order}_${filter.name}</PRE>
+</DIV></DIV>
+
+
+<H4><A name="EverythingisaResource-4.3.2FilterScripts"></A>4.3.2 Filter Scripts</H4>
+
+<P>Filter scripts may just be added as resources in the JCR repository at the appropriate location. For example for a request level filter applicable to <TT>nt:file</TT> nodes only, the filter would be placed in the <TT>/filters/request/nt/file</TT> folder.</P>
+
+
+<H3><A name="EverythingisaResource-4.4ScriptsfromResource"></A>4.4 Scripts from Resource</H3>
+
+<P>A <TT>Resource</TT> returned from the resource resolver may be a script. The script manager registers an <TT>AdapterFactory</TT> to adapt <TT>Resource</TT> to <TT>SlingScript</TT>. This factory will resolve a script engine for the resource file extension and return a <TT>SlingScript</TT> instance based on the <TT>Resource</TT>. If no script engine exists, the <TT>Resource</TT> may not be adapted.</P>
+
+<P>The <TT>AdapterFactory</TT> adapting to a <TT>SlingScript</TT> is also able to adapt to <TT>Servlet</TT> by wrapping the adapted <TT>SlingScript</TT> in a <TT>ScriptServlet</TT>.</P>
+
+
+<P>h3 4.5 Object Content Mapping</P>
+
+<P>To cope with the new extensible functionality based on the <TT>SlingAdaptable</TT> class and adapter factories, object content mapping cannot be hard coded to just respond to any class. Instead, the Object Content Mapping functionality is in fact provided in terms of adapter factories, which are registered to be able to adapt instances the <TT>Resource</TT> interface to predefined types.</P>
+
+<P>This way, Object Content Mapping takes part in adapter resolution just like any extensible adaption.</P>
+
+<P>As a consequence, Object Content Mapping may probable be taken out of the current <TT>jcr/resource</TT> project into its own project.</P>
+
+
+<H2><A name="EverythingisaResource-5ChangestotheCode"></A>5 Changes to the Code</H2>
+
+
+<H3><A name="EverythingisaResource-5.1SlingAPI"></A>5.1 Sling API</H3>
+
+<OL>
+	<LI>Add <TT>org.apache.sling.api.adapter.Adaptable</TT> interface</LI>
+	<LI><TT>Resource</TT> and <TT>RespourceResolver</TT> interfaces extend the <TT>Adaptable</TT> interface</LI>
+	<LI>Add <TT>org.apache.sling.api.resource.ResourceProvider</TT> interface</LI>
+	<LI>Merge <TT>SlingScriptResolver</TT> and <TT>ServletResolver</TT></LI>
+	<LI>Add <TT>AdapterFactory</TT> and <TT>AdapterManager</TT> service interfaces</LI>
+</OL>
+
+
+<H3><A name="EverythingisaResource-5.2OSGiCommons"></A>5.2 OSGi Commons</H3>
+
+<P>The <TT>org.apache.sling.osgi.commons</TT> bundle is a new project providing the following functionality:</P>
+
+<UL>
+	<LI><TT>ServiceLocator</TT> implementation (moved from <TT>sling/core</TT> project</LI>
+</UL>
+
+
+<H3><A name="EverythingisaResource-5.3Merge%7B%7Bscripting%2Fresolver%7D%7Dinto%7B%7Bsling%2Fservletresolver%7D%7D"></A>5.3 Merge <TT>scripting/resolver</TT> into <TT>sling/servlet-resolver</TT></H3>
+
+<P>The <TT>SlingScriptResolver</TT> and  <TT>ServletResolver</TT> interfaces are merged into a single <TT>ServletResolver</TT> interface, which has a <TT>resolve(SlingHttpServletRequest)</TT> and a <TT>find(ResourceResolver, String relPath)</TT> method. The implementation of this method will apply the alogirthm of the current <TT>scripting/resolver</TT> implementation of the <TT>SlingScriptResolver</TT>.</P>
+
+<P>Any script (or servlet or actually code) may call any script or servlet by just resolving the script or servlet to a <TT>Resource</TT> and adapting the resource found to a <TT>SlingScript</TT> or <TT>Servlet</TT>.</P>
+
+
+<H3><A name="EverythingisaResource-5.4SeparateObjectContentMappingfromResourceResolution"></A>5.4 Separate Object Content Mapping from Resource Resolution</H3>
+
+<P>By applying the mechanisms of adapter factories, Object Content Mapping can be broken out of the <TT>jcr/resource</TT> project into its own project <TT>jcr/ocm</TT>.</P>
+
+
+<H3><A name="EverythingisaResource-5.5EnhanceSlingConsole"></A>5.5 Enhance Sling Console</H3>
+
+<P>Provide a Sling Console enhancement to explore the (virtual) resource tree</P>
+
+
+<H3><A name="EverythingisaResource-5.6CreateNewAdapterProject"></A>5.6 Create New Adapter Project</H3>
+
+<P>A new Adapter project <TT>sling/adapter</TT> takes the following classes:</P>
+
+<UL>
+	<LI><TT>SlingAdaptable</TT> class implementing <TT>Adaptable</TT> and leveraging adapter factories</LI>
+	<LI>Implementation of the <TT>AdapterManager</TT> service also used by <TT>SlingAdaptable</TT> class</LI>
+</UL>
+
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/everything-is-a-resource.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/everything-is-a-resource.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/everything-is-a-resource.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/faq.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/faq.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/faq.html (added)
+++ sling/site/trunk/content/site/faq.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,114 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - FAQ</TITLE>
+    <LINK rel="stylesheet" href="http://incubator.apache.org/sling/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://incubator.apache.org/sling/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://incubator.apache.org/sling/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://incubator.apache.org/sling/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://incubator.apache.org/">
+          <IMG border="0" alt="Apache Incubator" src="http://incubator.apache.org/images/apache-incubator-logo.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+                                    <P>
+
+<UL>
+	<LI><A href="index.html" title="Index">Home</A></LI>
+	<LI><A href="project-information.html" title="Project Information">Project Information</A></LI>
+	<LI><A href="usecases.html" title="UseCases">Use Cases</A></LI>
+	<LI><A href="guides.html" title="Guides">Guides</A></LI>
+	<LI><A href="documentation.html" title="Documentation">Documentation</A></LI>
+	<LI><A href="plugins.html" title="Plugins">Plugins</A></LI>
+	<LI><A href="" title="FAQ">FAQ</A></LI>
+	<LI><A href="links.html" title="Links">Links</A></LI>
+	<LI><A href="old-documentation.html" title="Old Documentation">Old Documentation</A></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/x/GAUB" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/thanks.html" title="Visit page outside Confluence" rel="nofollow">Sponsors<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/sponsorship.html" title="Visit page outside Confluence" rel="nofollow">Sponsorship<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+</UL>
+
+
+<P>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </DIV>
+    <DIV class="main">
+<H1><A name="FAQ-FrequentlyAskedQuestions"></A>Frequently Asked Questions</H1>
+
+<P>This page lists a series of common questions and answers. It is of course work in progress ...</P>
+<DIV>
+<UL>
+  <LI><A href="#FAQ-AccessingClassesfromtheEnvironment">Accessing Classes from the Environment</A></LI>
+  <LI><A href="#FAQ-HowdoesSlingsupportthe%257B%257Borg.osgi.framework.bootdelegation%257D%257DProperty%253F">How does Sling support the <TT>org.osgi.framework.bootdelegation</TT> Property ?</A></LI>
+  <LI><A href="#FAQ-HowdoseSlingsupportthe%257B%257Borg.osgi.framework.system.packages%257D%257DProperty%253F">How dose Sling support the <TT>org.osgi.framework.system.packages</TT> Property ?</A></LI>
+  <LI><A href="#FAQ-Shouldthe%257B%257Borg.osgi.framework.bootdelegation%257D%257Dorthe%257B%257Borg.osgi.framework.system.packages%257D%257DPropertybeused%253F">Should the <TT>org.osgi.framework.bootdelegation</TT> or the <TT>org.osgi.framework.system.packages</TT> Property be used ?</A></LI>
+  <LI><A href="#FAQ-Isthereaneasywaytoupdatebundlesinarunninginstallationduringdevelopment%253F">Is there an easy way to update bundles in a running installation during development?</A></LI>
+</UL></DIV>
+
+<H3><A name="FAQ-AccessingClassesfromtheEnvironment"></A>Accessing Classes from the Environment</H3>
+
+<P>Mostly when using the Sling Web Application, that is running Sling inside a web application deployed into some servlet container, you might want to share classes between the servlet container and Sling. Some examples of such sharing are:</P>
+<OL>
+	<LI>Accessing EJB from the Application Server</LI>
+	<LI>Sharing classe with another web application such as a Jackrabbit instance</LI>
+	<LI>Using other container features</LI>
+</OL>
+
+
+<P>For such cases the OSGi Core Specification provides a functionality to declare such class sharing. The functionality is defined in terms of two Framework properties <TT>org.osgi.framework.system.packages</TT> and <TT>org.osgi.framework.bootdelegation</TT>:</P>
+<OL>
+	<LI><TT><B>org.osgi.framework.bootdelegation</B></TT> &#45; All classes matching any entry in this list are always loaded from the parent class loader and not through the OSGi framework infrastructure. This property is a comma separated list of package names. A package name may be terminated by a wildcard character such that any package starting with the list entry matches the entry and thus will be used from the parent class loader.</LI>
+	<LI><TT><B>org.osgi.framework.system.packages</B></TT> &#45; Additional package declarations for packages to be exported from the system bundle. This property is a simple package declaration list just like any <TT>Export-Package</TT> manifest header. In a sense the <TT>org.osgi.framework.system.packages</TT> property may be seen as the <TT>Export-Package</TT> manifest header of the system bundle. Namely these entries may not contain wildcards (as is allowed for the <TT>bootdelegation</TT> property) and may contain directives and attributes such as the <TT>uses</TT> directive and the <TT>version</TT> attribute. It is recommended to provide this additional information to help in resolving the bundles. The OSGi Core Specification even prescribes the use of the <TT>uses</TT> directive.</LI>
+</OL>
+
+
+<P>The problem with the <TT>org.osgi.framework.bootdelegation</TT> property is, that it completely bypasses any bundle import wirings and just asks the parent classloader. Such situations are not easily recognizable. Therefore the Sling Console will be enhanced to mark any package import which matchs an entry in the <TT>org.osgi.framework.bootdelegation</TT> appropriately (<SPAN class="nobr"><A href="ttps://issues.apache.org/jira/browse/SLING-148" title="Visit page outside Confluence" rel="nofollow">SLING-148<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>).</P>
+
+<P>Also note, that any package listed as an import in a bundle must be resolveable for the bundle resolve. The import resolution process does not take the <TT>org.osgi.framework.bootdelegation</TT> configuration into account. This means, that regardless of whether a package is listed in the <TT>org.osgi.framework.bootdelegation</TT> property or not, if the package is listed as a required import in the <TT>Import-Package</TT> header, it must be exported by some other bundle.</P>
+
+<H3><A name="FAQ-HowdoesSlingsupportthe%7B%7Borg.osgi.framework.bootdelegation%7D%7DProperty%3F"></A>How does Sling support the <TT>org.osgi.framework.bootdelegation</TT> Property ?</H3>
+
+<P>Sling supports the <TT>org.osgi.framework.bootdelegation</TT> property to list additional classes to be used from the environment by interpreting Sling configuration properties starting with <TT>sling.bootdelegation</TT> (This is done in the <TT>org.apache.sling.launcher.app.Sling.resolve()</TT> method).</P>
+
+<P>If a property starts with the prefix <TT>sling.bootdelegation.class.</TT> the list of packages defined as the property value is only appended to the <TT>org.osgi.framework.bootdelegation</TT> property if the fully qualified class taken from the rest of the property name exists in the parent class loader.</P>
+
+<P>If the property does not start with this <TT>sling.bootdelegation.class.</TT> property, the list of packages is just appended to the <TT>org.osgi.framework.bootdelegation</TT> property.</P>
+
+<H3><A name="FAQ-HowdoseSlingsupportthe%7B%7Borg.osgi.framework.system.packages%7D%7DProperty%3F"></A>How dose Sling support the <TT>org.osgi.framework.system.packages</TT> Property ?</H3>
+
+<P>Currently extending the <TT>org.osgi.framework.system.packages</TT> property in a Sling configuration file is only possibly by setting the <TT>org.apache.sling.launcher.system.packages</TT> property. The value of this property, which <EM>must</EM> start with a comma, is just appended to the <TT>org.osgi.framewrok.system.packages</TT> property.</P>
+
+<P>A more elaborate support as is supported for the <TT>org.osgi.framework.bootdelegation</TT> Property is being prepared (<SPAN class="nobr"><A href="http://issues.apache.org/jira/browse/SLING-147" title="Visit page outside Confluence" rel="nofollow">SLING-147<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>).</P>
+
+<H3><A name="FAQ-Shouldthe%7B%7Borg.osgi.framework.bootdelegation%7D%7Dorthe%7B%7Borg.osgi.framework.system.packages%7D%7DPropertybeused%3F"></A>Should the <TT>org.osgi.framework.bootdelegation</TT> or the <TT>org.osgi.framework.system.packages</TT> Property be used ?</H3>
+
+<P>So, what mechanism should be used ? The answer is, that it depends.</P>
+
+<P>Most of the time, you will want to use the <TT>org.osgi.framework.system.packages</TT> property. Because this property ensures that you will allways benefit from the normal class resolution mechanism through package imports and exports.</P>
+
+<P>This allows creating the bundles normally by having the package import lists being built according to the packages used by the bundle classes. For example you may use the Apache Felix Maven Bundle Plugin to build your OSGi bundles and the imports are automatically calculated (by default).</P>
+
+<P>The drawback of this method is, that there may be bundles in your system, which export packages also listed in the <TT>org.osgi.framework.system.packages</TT> property. Depending on the export version, the wrong package may be bound. So to prevent such collisions you should not install such bundles.</P>
+
+<P>An example of such a declaration is the Servlet API packages (<TT>javax.servlet</TT>, <TT>javax.servlet.http</TT> and <TT>javax.servlet.resources</TT>). These packages are imported into the OSGi framework by the <TT>SlingServlet</TT> of the <TT>launcher/webapp</TT> project as part of the <TT>org.osgi.framework.system.packages</TT> property. To have this work correctly, no bundle should export the respective packages. In the case of Sling, this means, the <TT>org.apache.felix.commons.sling-api</TT> bundle must not be installed.</P>
+
+<P>If on the other hand you cannot prevent the installation of such bundles and hence the export of the respective packages, you might want to set the <TT>org.osgi.framework.bootdelegation</TT> property conditionally as described above in the answer to how this property is supported in Sling. This ensures the property is only set, if the classes are actually available. This should be used as a fall back only, if the <TT>org.osgi.framework.system.packages</TT> method does not work.</P>
+
+<H3><A name="FAQ-Isthereaneasywaytoupdatebundlesinarunninginstallationduringdevelopment%3F"></A>Is there an easy way to update bundles in a running installation during development?</H3>
+
+<P>The Sling Maven Plugin provides an install goal which is able to install or update a bundle in a running Sling application (if the Sling web console is deployed). If the plugin properties are configured accordingly you can just <TT>mvn clean package org.apache.sling:maven-sling-plugin:install</TT> and the bundle is uploaded.</P>
+
+<P>You can use the <TT>settings.xml</TT> to set the url to your Sling application. See the <A href="plugins.html" title="Plugins">Sling Maven Plugin</A> for more information.</P>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/faq.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/faq.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/faq.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/filters.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/filters.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/filters.html (added)
+++ sling/site/trunk/content/site/filters.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,300 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Filters</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="documentation.html" title="Documentation">Documentation</A>&nbsp;&gt;&nbsp;<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A>&nbsp;&gt;&nbsp;<A href="" title="Filters">Filters</A>
+        </DIV>
+<H1><A name="Filters-ServletFilterSupport"></A>Servlet Filter Support</H1>
+
+<P>Sling supports filter processing by applying filter chains to the requests before actually dispatching to the servlet or script for processing. Filters to be used in such filter processing are plain OSGi services of type <TT>javax.servlet.Filter</TT> which of course means that the services implement this interface.</P>
+
+<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>Support for Servlet Filters is currently being further developed in the trunk of the Sling Engine module. This page is being updated to reflect these changes. There is a section at the end of this page which will shortly describe the Servlet Filter Support of Sling up to and including the Sling Engine 2.1.0 bundle.<BR class="atl-forced-newline">
+See <A href="https://issues.apache.org/jira/browse/SLING-1213" class="external-link" rel="nofollow">SLING-1213</A>, <A href="https://issues.apache.org/jira/browse/SLING-1734" class="external-link" rel="nofollow">SLING-1734</A>, and <A href="http://markmail.org/message/quxhm7d5s6u66crr" class="external-link" rel="nofollow">Registering filters with Sling</A> for more details.</TD></TR></TABLE></DIV>
+
+<P>For Sling to pick up a <TT>javax.servlet.Filter</TT> service for filter processing two service registration properties are inspected:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Property </TH>
+<TH class="confluenceTh"> Type </TH>
+<TH class="confluenceTh"> Default Value </TH>
+<TH class="confluenceTh"> Valid Values </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.filter.scope</TT> </TD>
+<TD class="confluenceTd"> <TT>String</TT>, <TT>String[]</TT> or <TT>Vector&lt;String&gt;</TT> </TD>
+<TD class="confluenceTd"> <TT>request</TT> </TD>
+<TD class="confluenceTd"> <TT>REQUEST</TT>, <TT>INCLUDE</TT>, <TT>FORWARD</TT>, <TT>ERROR</TT>, <TT>COMPONENT</TT> </TD>
+<TD class="confluenceTd"> Indication of which chain the filter should be added to. This property is required. If it is missing from the service, the service is ignored because it is assumed another consumer will be interested in using the service. Any unknown values of this property are also ignored causing the service to be completely ignored if none of the values provided by the property are valid. See below for the description of the filter chains. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>service.ranking</TT> </TD>
+<TD class="confluenceTd"> <TT>Integer</TT> </TD>
+<TD class="confluenceTd"> <TT>0</TT> </TD>
+<TD class="confluenceTd"> Any <TT>Integer</TT> value </TD>
+<TD class="confluenceTd"> Indication of where to place the filter in the filter chain. The higher the number the earlier in the filter chain. This value may span the whole range of integer values. Two filters with equal <TT>service.ranking</TT> property value (explicitly set or default value of zero) will be ordered according to their <TT>service.id</TT> service property as described in section 5.2.5, Service Properties, of the OSGi Core Specification R 4.2. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+<H2><A name="Filters-FilterChains"></A>Filter Chains</H2>
+
+<P>Sling maintains five filter chains: request level, component level, include filters, forward filters and error filters. Except for the component level filter these filter chains correspond to the filter <TT>&lt;dispatcher&gt;</TT> configurations as defined for Servlet API 2.5 web applications (see section SRV.6.2.5 Filters and the RequestDispatcher).</P>
+
+<P>The following table summarizes when each of the filter chains is called and what value must be defined in the <TT>sling.filter.scope</TT> property to have a filter added to the respective chain:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> <TT>sling.filter.scope</TT> </TH>
+<TH class="confluenceTh"> Servlet API Correspondence </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>REQUEST</TT> </TD>
+<TD class="confluenceTd"> <TT>REQUEST</TT> </TD>
+<TD class="confluenceTd"> Filters are called once per request hitting Sling from the outside. These filters are called after the resource addressed by the request URL and the Servlet or script to process the request has been resolved before the <TT>COMPONENT</TT> filters (if any) and the Servlet or script are called. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>INCLUDE</TT> </TD>
+<TD class="confluenceTd"> <TT>INCLUDE</TT> </TD>
+<TD class="confluenceTd"> Filters are called upon calling the <TT>RequestDispatcher.include</TT> method after the included resource and the Servlet or script to process the include have been resolved before the Servlet or script is called. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>FORWARD</TT> </TD>
+<TD class="confluenceTd"> <TT>FORWARD</TT> </TD>
+<TD class="confluenceTd"> Filters are called upon calling the <TT>RequestDispatcher.forward</TT> method after the included resource and the Servlet or script to process the include have been resolved before the Servlet or script is called. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>ERROR</TT> </TD>
+<TD class="confluenceTd"> <TT>ERROR</TT> </TD>
+<TD class="confluenceTd"> Filters are called upon <TT>HttpServletResponse.sendError</TT> or any uncaught <TT>Throwable</TT> before resolving the error handler Servlet or script. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>COMPONENT</TT> </TD>
+<TD class="confluenceTd"> <TT>REQUEST,INCLUDE,FORWARD</TT> </TD>
+<TD class="confluenceTd"> The <TT>COMPONENT</TT> scoped filters are present for backwards compatibility with earlier Sling Engine releases. These filters will be called among the <TT>INCLUDE</TT> and <TT>FORWARD</TT> filters upon <TT>RequestDispatcher.include</TT> or <TT>RequestDispatcher.forward</TT> as well as before calling the request level Servlet or script after the <TT>REQUEST</TT> filters. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>Note on <TT>INCLUDE</TT> and <TT>FORWARD</TT> with respect to JSP tags: These filters are also called if the respective including (e.g. <TT>&lt;jsp:include&gt;</TT> or <TT>&lt;sling:include&gt;</TT>) or forwarding (e.g. <TT>&lt;jsp:forward&gt;</TT> or <TT>&lt;sling:forward&gt;</TT>) ultimately calls the <TT>RequestDispatcher</TT>.</P>
+
+
+<H2><A name="Filters-FilterProcessing"></A>Filter Processing</H2>
+
+<P>Filter processing is part of the Sling request processing, which may be sketched as follows:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> <EM>Request Level</EM> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Authentication </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Resource Resolution </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Servlet/Script Resolution </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Request Level Filter Processing </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <EM>Component Level</EM> </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>The first step of request processing is the <EM>Request Level</EM> processing which is concerned with resolving the resource, finding the appropriate servlet and calling into the request level filter chain. The next step is the <EM>Component Level</EM> processing, calling into the component level filters before finally calling the servlet or script:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> <EM>Component Level</EM> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Component Level Filter Processing </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Call Servlet or Script </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>When a servlet or script is including or forwarding to another resource for processing through the <TT>RequestDispatcher</TT> (or any JSP tag or other language feature ultimately using a <TT>RequestDispatcher</TT>) the following <EM>Dispatch</EM> processing takes place:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> <EM>Dispatch</EM> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Resolve the resource to dispatch to if not already defined when getting the <TT>RequestDispatcher</TT> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Servlet/Script resolution </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Call include or forward filters depending on the kind of dispatch </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> Call Servlet or Script </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>As a consequence, request level filters will be called at most once during request processing (they may not be called at all if a filter earlier in the filter chain decides to terminate the request) while the component level, include, and forward filters may be called multiple times while processing a request.</P>
+
+
+<H2><A name="Filters-Troubleshooting"></A>Troubleshooting</H2>
+<P>Apart form the logs which tell you when filters are executed, two Sling plugins provide information about filters in the OSGi console.</P>
+
+<H3><A name="Filters-RecentRequestsplugin"></A>Recent Requests plugin</H3>
+<P>The request traces provided at <TT>/system/console/requests</TT> contain information about filter execution, as in this example:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;"><B>Recent Requests plugin info</B></DIV><DIV class="codeContent panelContent">
+<PRE class="code-java">
+0 (2010-09-08 15:22:38) TIMER_START{Request Processing}
+...
+0 (2010-09-08 15:22:38) LOG Method=GET, PathInfo=/libs/wcm/core/content/siteadmin.html
+3 (2010-09-08 15:22:38) LOG Applying request filters
+3 (2010-09-08 15:22:38) LOG Calling filter: org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter
+3 (2010-09-08 15:22:38) LOG Calling filter: org.apache.sling.portal.container.internal.request.PortalFilter
+3 (2010-09-08 15:22:38) LOG Calling filter: org.apache.sling.rewriter.impl.RewriterFilter
+3 (2010-09-08 15:22:38) LOG Calling filter: com.day.cq.wcm.core.impl.WCMRequestFilter
+3 (2010-09-08 15:22:38) LOG Calling filter: org.apache.sling.i18n.impl.I18NFilter
+3 (2010-09-08 15:22:38) LOG Calling filter: com.day.cq.theme.impl.ThemeResolverFilter
+3 (2010-09-08 15:22:38) LOG Calling filter: com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet
+3 (2010-09-08 15:22:38) LOG Calling filter: org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter
+3 (2010-09-08 15:22:38) LOG Calling filter: com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter
+3 (2010-09-08 15:22:38) LOG RedirectFilter did not redirect (MobileUtil.isMobileResource() returns <SPAN class="code-keyword">false</SPAN>)
+3 (2010-09-08 15:22:38) LOG Applying <SPAN class="code-keyword">inner</SPAN> filters
+3 (2010-09-08 15:22:38) LOG Calling filter: com.day.cq.wcm.core.impl.WCMComponentFilter
+3 (2010-09-08 15:22:38) LOG Calling filter: com.day.cq.wcm.core.impl.WCMDebugFilter
+3 (2010-09-08 15:22:38) TIMER_START{/libs/cq/ui/components/widget/html.jsp#0}
+...
+8 (2010-09-08 15:22:38) TIMER_END{8,Request Processing} Request Processing
+</PRE>
+</DIV></DIV>
+
+<H3><A name="Filters-ConfigStatusplugin"></A>Config Status plugin</H3>
+<P>The configuration status page at <TT>/system/console/config</TT> includes the current list of active filters in its <EM>Servlet Filters</EM> category, as in this example:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;"><B>Config Status plugin info</B></DIV><DIV class="codeContent panelContent">
+<PRE class="code-java">
+Current Apache Sling Servlet Filter Configuration
+
+Request Filters:
+-2147483648 : class org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter (2547)
+-3000 : class org.apache.sling.portal.container.internal.request.PortalFilter (2562)
+-2500 : class org.apache.sling.rewriter.impl.RewriterFilter (3365)
+-2000 : class com.day.cq.wcm.core.impl.WCMRequestFilter (2548)
+-700 : class org.apache.sling.i18n.impl.I18NFilter (2334)
+-600 : class com.day.cq.theme.impl.ThemeResolverFilter (2244)
+-600 : class com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet (2268)
+0 : class org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter (2402)
+1000 : class com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter (3363)
+
+Error Filters:
+---
+
+Include Filters:
+-200 : class com.day.cq.wcm.core.impl.WCMComponentFilter (2583)
+1000 : class com.day.cq.wcm.core.impl.WCMDebugFilter (2449)
+
+Forward Filters:
+-200 : class com.day.cq.wcm.core.impl.WCMComponentFilter (2583)
+1000 : class com.day.cq.wcm.core.impl.WCMDebugFilter (2449)
+
+Component Filters:
+-200 : class com.day.cq.wcm.core.impl.WCMComponentFilter (2583)
+1000 : class com.day.cq.wcm.core.impl.WCMDebugFilter (2449)
+</PRE>
+</DIV></DIV>
+
+<P>The first numbers on those lines are the filter priorities, and the last number in parentheses is the OSGi service ID.</P>
+
+
+<H2><A name="Filters-SupportinSlingEngine2.1.0"></A>Support in Sling Engine 2.1.0</H2>
+
+<P>Up to and including Sling Engine 2.1.0 support for Servlet Filters has been as follows:</P>
+
+<UL>
+	<LI>Any <TT>javax.servlet.Filter</TT> service is accepted as a filter for Sling unless the <TT>pattern</TT> property used by the <A href="http://felix.apache.org/site/apache-felix-http-service.html#ApacheFelixHTTPService-UsingtheWhiteboard" class="external-link" rel="nofollow">Apache Felix HttpService whiteboard support</A> is set in the service registration properties.</LI>
+	<LI>The <TT>filter.scope</TT> property is optional and supports the case-sensitive values <TT>request</TT> and <TT>component</TT>.</LI>
+	<LI>Filter ordering is defined by the <TT>filter.order</TT> property whose default value is <TT>Integer.MAX_VALUE</TT> where smaller values have higher priority over higher values.</LI>
+</UL>
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by fmeschbe on 2010-09-08 09:25:43.0
+        </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>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/filters.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/filters.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/filters.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/site/trunk/content/site/first-steps.data/test.sh
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/first-steps.data/test.sh?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/first-steps.data/test.sh (added)
+++ sling/site/trunk/content/site/first-steps.data/test.sh Wed Dec 12 09:13:50 2012
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements.  See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership.  The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License.  You may obtain a copy of the License at
+#    
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied.  See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+
+JAVA_HOME=${JAVA_HOME:=/usr/java/jdk1.5.0_11}
+JAVA=${JAVA_HOME}/bin/java
+JAVA_DEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=30503,server=y,suspend=n"
+SLING_HOME=sling.test
+SLING_LOG_FILE=
+SLING_DEFS="-Dsling.install.20= -Dorg.osgi.service.http.port=8080"
+SLING_JAR="target/org.apache.sling.launcher.app-2.0.0-incubator-SNAPSHOT.jar"
+
+## Append command line arguments (not actually correct, but suffices it)
+SLING_DEFS="${SLING_DEFS} $@"
+
+## Enable this for JAAS LDAP Auth
+# SLING_DEFS="${SLING_DEFS} -Djava.security.auth.login.config=${PWD}/ldap_login.conf"
+
+## Enable this for JVMTI profiling
+# SLING_DEFS="${SLING_DEFS} -agentlib:yjpagent"
+
+export JAVA JAVA_DEBUG SLING_HOME SLING_LOG_FILE SLING_DEFS
+
+${JAVA} ${JAVA_DEBUG} -Dsling.home=${SLING_HOME} -Dorg.apache.sling.osgi.log.file=${SLING_LOG_FILE} ${SLING_DEFS} -jar ${SLING_JAR}

Propchange: sling/site/trunk/content/site/first-steps.data/test.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/first-steps.data/test.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: sling/site/trunk/content/site/first-steps.data/test.sh
------------------------------------------------------------------------------
    svn:keywords = Id

Added: sling/site/trunk/content/site/first-steps.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/site/first-steps.html?rev=1420577&view=auto
==============================================================================
--- sling/site/trunk/content/site/first-steps.html (added)
+++ sling/site/trunk/content/site/first-steps.html Wed Dec 12 09:13:50 2012
@@ -0,0 +1,111 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - First Steps</TITLE>
+    <LINK rel="stylesheet" href="http://incubator.apache.org/sling/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://incubator.apache.org/sling/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://incubator.apache.org/sling/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://incubator.apache.org/sling/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://incubator.apache.org/">
+          <IMG border="0" alt="Apache Incubator" src="http://incubator.apache.org/images/apache-incubator-logo.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+                                    <P>
+
+<UL>
+	<LI><A href="index.html" title="Index">Home</A></LI>
+	<LI><A href="project-information.html" title="Project Information">Project Information</A></LI>
+	<LI><A href="usecases.html" title="UseCases">Use Cases</A></LI>
+	<LI><A href="guides.html" title="Guides">Guides</A></LI>
+	<LI><A href="documentation.html" title="Documentation">Documentation</A></LI>
+	<LI><A href="plugins.html" title="Plugins">Plugins</A></LI>
+	<LI><A href="../SLING/faq.html" title="FAQ">FAQ</A></LI>
+	<LI><A href="links.html" title="Links">Links</A></LI>
+	<LI><A href="old-documentation.html" title="Old Documentation">Old Documentation</A></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/SLING/" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/thanks.html" title="Visit page outside Confluence" rel="nofollow">Sponsors<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/sponsorship.html" title="Visit page outside Confluence" rel="nofollow">Sponsorship<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+</UL>
+
+
+<P>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </DIV>
+    <DIV class="main">
+<H1><A name="FirstSteps-FirstSteps"></A>First Steps</H1>
+
+<P>A short recount on the first step for getting a running Sling instance after checking out the source from the SVN repository</P>
+
+
+<H2><A name="FirstSteps-Prerequisites"></A>Prerequisites</H2>
+
+<P>Before you begin, you should have installed the following tools on your system:</P>
+
+<UL>
+	<LI>Java 5 or higher</LI>
+	<LI>Maven 2.0.7 (or later)</LI>
+</UL>
+
+
+<H2><A name="FirstSteps-GettingaRunningInstance"></A>Getting a Running Instance</H2>
+
+<OL>
+	<LI>Checkout Sling from the Repository
+<DIV class="preformatted"><DIV class="preformattedContent">
+<PRE>$ svn checkout http://svn.apache.org/repos/asf/incubator/sling/trunk sling
+</PRE>
+</DIV></DIV></LI>
+	<LI>Enter the directory and do a full build and local install
+<DIV class="preformatted"><DIV class="preformattedContent">
+<PRE>$ cd sling
+$ mvn install
+</PRE>
+</DIV></DIV></LI>
+	<LI>Enter the <TT>launcher/app</TT> directory and launch Sling for the first time
+<DIV class="preformatted"><DIV class="preformattedContent">
+<PRE>$ cd launcher/app
+$ java -jar -Dsling.home=sling -Dorg.apache.sling.osgi.log.file= target/org.apache.sling.launcher.app-2.0.0-incubator-SNAPSHOT.jar
+</PRE>
+</DIV></DIV>
+<P>Messages should now be printed to the console which is used as the &quot;log file&quot; because the <TT>org.apache.sling.osgi.log.file</TT> (see <A href="logging.html" title="Logging">Logging</A>) is defined empty indicating to use standard output as the log file. The <TT>sling.home</TT> property instructs Sling to use the <TT>sling</TT> directory in the current directory for its data store, which is the Apache Felix bundle archive, the Jackrabbit repository data and configuration. You may also specify another directory here, either a relative or absolute path name (See also <A href="configuration.html" title="Configuration">Configuration</A> for more information).<BR>
+After all messages have been printed you should now be able to contact the Sling Management Console by pointing your web browser at <TT><SPAN class="nobr"><A href="http://localhost:8080/sling" title="Visit page outside Confluence" rel="nofollow">http://localhost:8080/sling<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></TT>. You will be prompted for a user name and password. Enter <TT>admin</TT> as both the user name and the passwort (this may be set on <EM>Configuration</EM> page later). From this console, you may manage the installed bundles, modify configuration objects, dump a configuration status and get some system information.<BR>
+To stop Sling, just hit <TT>Ctrl-C</TT> at the console or click the <EM>Stop</EM> button on the <EM>System Information</EM> page of the Sling Management Console. For the moment, we need a running Sling instance to continue.<BR>
+For now, you just have a bare running OSGi framework and the Sling Management Console. We will now install more bundles to get the real Sling instance.</P></LI>
+	<LI>First we need some bundles from the Apache Felix Commons sub project. Open a new console, checkout these subprojects and install bundles in the running Sling instance as follows:
+<DIV class="preformatted"><DIV class="preformattedContent">
+<PRE>$ svn checkout http://svn.apache.org/repos/asf/felix/trunk/commons felix-commons
+$ cd felix-commons
+$ for DIR in commons-io commons-fileupload commons-collections commons-beanutils commons-codec \
+   cglib ; \
+   do cd ${DIR} ; mvn package org.apache.sling:maven-sling-plugin:2.0.0-incubator-SNAPSHOT:install ; cd .. ; done
+</PRE>
+</DIV></DIV>
+<P>On the <EM>Bundles</EM> page of the Sling Management Console you will see the additional bundles. All bundles are started with status <EM>Active</EM>.</P></LI>
+	<LI>Now you are ready to install the Sling bundles. Go back to the Sling checkout directory and run a loop to install the bundles.
+<DIV class="preformatted"><DIV class="preformattedContent">
+<PRE>$ cd ../..
+$ for DIR in commons/mime api jcr/api jcr/resource jcr/jackrabbit-server jcr/classloader \
+    sling/core scripting/api scripting/resolver scripting/jsp scripting/jsp-taglib \
+    sling/servlet-resolver; \
+    do cd ${DIR} ; mvn package org.apache.sling:maven-sling-plugin:2.0.0-incubator-SNAPSHOT:install ; cd .. ; done
+</PRE>
+</DIV></DIV></LI>
+</OL>
+
+
+
+<P>Congratulations ! You should now have a running Sling instance, which you may start playing around with.</P>
+    </DIV>
+  </BODY>
+</HTML>
+

Propchange: sling/site/trunk/content/site/first-steps.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/site/trunk/content/site/first-steps.html
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/site/trunk/content/site/first-steps.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain