incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1328899 [8/8] - in /sling/site/trunk: content/ templates/
Date Sun, 22 Apr 2012 16:52:16 GMT
Added: sling/site/trunk/content/the-sling-launchpad.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/the-sling-launchpad.mdtext?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/content/the-sling-launchpad.mdtext (added)
+++ sling/site/trunk/content/the-sling-launchpad.mdtext Sun Apr 22 16:52:13 2012
@@ -0,0 +1,295 @@
+Title: The Sling Launchpad
+<a name="TheSlingLaunchpad-TheSlingLaunchpad"></a>
+# The Sling Launchpad
+
+{toc:minLevel=2|maxLevel=3}
+
+This tries to explain how exactly the Sling Launchpad works, what
+constitutes the Sling Launchpad and how you can use the Sling Launchpad to
+custom create you Sling launchers. For a view behind the scenes of the
+Sling Launchpad Base module (the actual launcher) you might want to refer
+to the [Embedding Sling](embedding-sling.html)
+ page.
+
+
+<a name="TheSlingLaunchpad-SlingHome"></a>
+## Sling Home
+
+Since Sling requires some space on the filesystem to store various files
+Sling has to know where this filesystem space is located.
+
+The following is a list of uses for the Sling Home directory:
+
+* *sling.properties* -- The main configuration file used by Sling to
+launch the framework. It mainly contains OSGi framework configuration and
+initial configuration for some bundles. This file is read on each startup
+of _Launcher JAR_. That is, changes to this file require a restart of the
+_Launcher JAR_.
+* *org.apache.sling.launchpad.base.jar* --  This is the _Launcher JAR_
+file used by the Standalone Application or the Web Application to start the
+OSGi Framework. This file is initially placed when first starting Sling and
+may later be updated by updating the system bundle with a new _Launcher
+JAR_.
+* *felix* -- The directory into which the Apache Felix Framework places
+the bundles, which have been installed into the system. This does generally
+not need to be touched.
+* *config* -- The directory into which the Apache Felix Configuration
+Admin Service stores the configurationes. Do not change any files in this
+directory, since changes will not generally be picked up.
+* *jackrabbit* -- The directory in which the Apache Jackrabbit JCR
+repository is started. Amongst other things this also contains the
+Jackrabbit configuration file *repository.xml*. You may modify this file,
+but don't forget to restart the Embedded Jackrabbit Repository bundle after
+doing this.
+* *logs* -- Contains the log files generated by Sling. By default this
+contains the error.log and its rotated generations.
+
+
+<a name="TheSlingLaunchpad-CommandLineOptions"></a>
+## Command Line Options
+
+
+The Java Standalone Application supports a number of command line options,
+which influence the operation of the launch process.
+
+<table>
+<tr><th> Option </th><th> Argument </th><th> Description </th></tr>
+<tr><td> *start* </td><td> -- </td><td> Open a TCP/IP server socket when starting Sling. Uses
+option *-j* to define the local socket address. </td></tr>
+<tr><td> *status* </td><td> -- </td><td> Check whether a (remote) Sling application is running.
+Uses option *-j* to define the address of the Sling instance to check.
+Note, that the Sling application terminates after checking for the (remote)
+Sling status. </td></tr>
+<tr><td> *stop* </td><td> -- </td><td> Stop a (remote) Sling application is running. Uses option
+*-j* to define the address of the Sling instance to stop. Note, that the
+Sling application terminates after stopping the (remote) Sling instance. </td></tr>
+<tr><td> *-c* </td><td> slinghome </td><td> The directory in which Sling locates its initial
+configuration file *sling.properties* and where files of Sling itself
+such as the Apache Felix bundle archive or the JCR repository files are
+stored. This defaults to the *sling* folder in the current working
+directory. This is the value which is commonly refered to as
+*$\{sling.home}.*
+</tr>
+<tr><td> *-l* </td><td> loglevel </td><td> Sets the initial loglevel as an integer in the range
+0 to 4 or as one of the well known level strings *ERROR*, *WARN*,
+*INFO*, or *DEBUG*. This option overwrites the
+*org.apache.sling.osg.log.level* setting the *sling.properties* file.
+The default is *INFO*. </td></tr>
+<tr><td> *-f* </td><td> logfile </td><td>  The log file to use or *-* to log to standard out.
+This option overwrites the *org.apache.sling.osg.log.file* setting the
+*sling.properties* file. The default is
+*$\{sling.home}/logs/error.log*. </td></tr>
+<tr><td> *-a* </td><td> address </td><td> The interfact to bind to (use 0.0.0.0 for any). This
+option is not implemented yet. </td></tr>
+<tr><td> *-p* </td><td> port </td><td>  The port to listen (default 8080) to handle HTTP
+requests. This option overwrites the *org.osgi.service.http.port* setting
+the *sling.properties* file. </td></tr>
+<tr><td> *-j* </td><td> [ host ":" ](-host-":"-.html)
+ port </td><td>  The socket address to listen on for control connections (*start*
+or to use as the remote endpoint for the control connection (*status* and
+*stop*. If this parameter has no arguments or is not specified, the
+address defaults to port 63000 on localhost/127.0.0.1. If only the port is
+specified localhost/127.0.0.1 is used as the host part of the address. </td></tr>
+<tr><td> *-h* </td><td> -- </td><td> Prints a simple usage message listing all available command
+line options. </td></tr>
+</table>
+
+The Sling Standalone application looks for a definition of the
+*sling.home* setting in the following locations in order of precendence:
+
+1. The *-c* command line option
+1. The *sling.home* system property
+1. The *SLING_HOME* environment variable
+1. If none of the above resolves to a non-null value, the default value of
+*sling* is assumed
+
+
+<a name="TheSlingLaunchpad-SecurityImplication"></a>
+### Security Implication
+
+Note that using a control connection for the Sling Standalone Application
+presents a potential security issue. For this reason the following defaults
+apply:
+
+* The server side socket for a running Sling Standalone Application is only
+created if the application is started with the *start* command line
+option. If this option is omitted -- the default -- the server side socket
+is not created and the Sling Standalone Application instance cannot be
+remotely controlled.
+* The default host name for the socket is localhost/127.0.0.1 meaning that
+the socket is only accessible from the same system as the Sling Standalone
+Application is running on. If the socket is accessible from remote systems
+additional must be taken to prevent malicious attackers to stop the system.
+The server side control connection implementation implements no security
+precaution (except from supporting to not create such a connection at all).
+
+
+<a name="TheSlingLaunchpad-ServletParameters"></a>
+## Servlet Parameters
+
+The Web Application does not require specific servlet parameters. Those
+which are specified are used to overwrite any properties with the same name
+from the *sling.properties* file. One exception to this rule is the
+*sling.home* parameter, which is used to set the value of the
+*sling.home* property. If no parameter with this name is defined the
+Sling home directory is derived from the context path at which the Sling
+Web Application is registered.
+
+The *sling.home* folders for Sling Web Applications without the
+*sling.home* servlet parameter are all located in the *sling* folder in
+the current working directory as reported by the *user.dir* system
+property. The name of the actual directory is derived from the Web
+Application Context Path by replacing all slash characters */* by
+underscore characters *\_*. For the root context a single underscore
+character *\_* is used.
+
+Examples:
+
+<table>
+<tr><th> Servlet Context </th><th> Default *sling.home* </th></tr>
+<tr><td> _root_ </td><td> *sling/\_* </td></tr>
+<tr><td> */sling* </td><td> *sling/\_sling* </td></tr>
+<tr><td> */sling/instance1* </td><td> *sling/\_sling\_instance1* </td></tr>
+</table>
+
+Starting with Launchpad Base 2.2.2 the fixed prefix *sling* is
+configurable with the *sling.home.prefix* system property. If this
+property is set the value used as the prefix.
+
+Examples: Assume the *sling.home.prefix* system property is set to
+*/var/sling*
+
+<table>
+<tr><th> Servlet Context </th><th> Default *sling.home* </th></tr>
+<tr><td> _root_ </td><td> */var/sling/\_* </td></tr>
+<tr><td> */sling* </td><td> */var/sling/\_sling* </td></tr>
+<tr><td> */sling/instance1* </td><td> */var/sling/\_sling\_instance1* </td></tr>
+</table>
+
+
+<a name="TheSlingLaunchpad-sling.properties"></a>
+## sling.properties
+
+The *sling.properties* file contains the initial setup of the Sling
+Application and the OSGi framework. Some of the parameters are required and
+should not be modified without a very good reason. Some parameters may be
+freely modified to your needs. Please see the inlined comment in the
+*sling.properties* file installed when Sling is first started.
+
+One thing to note is, that the *sling.properties* file is a simple Java
+Properties file with support for property references. That is, the value of
+properties may refer other property values by means of the well known
+*$\{name*} notation. Such property references may even be cascaded as in
+
+
+    java.packages=${jre-${java.specification.version}}
+
+
+
+<a name="TheSlingLaunchpad-Components"></a>
+## Components
+
+The Sling Launchapd consists of _Launchbad Base_ project and three
+additional projects which ultimately create a Standalone Java Application
+and a Web Appliction with standard parts of Sling.
+
+
+<a name="TheSlingLaunchpad-LaunchpadBase"></a>
+### Launchpad Base
+
+The _Launchpad Base_ projects creates the following artifacts, which are
+required in actual setups to get a Sling application:
+
+* *Launcher JAR* -- The primary artifact of the Base project contains the
+actual support to launch the Apache Felix OSGi Framework and install
+bundles, which are packaged with the application. It also contains the
+Apache Felix Framework together with the OSGi R4.1 Core and Compendium
+libraries as well as the Equinox HttpService bridge and the Servlet API.
+
+* *App JAR* -- The secondary artifact with classifier _app_ is a minimal
+Standalone Java Application which may be started by simply typing
+
+
+    $ java -jar org.apache.sling.launchpad.base-app.jar
+
+
+* *Web App Archive* -- The secondary artifact with classifier _webapp_ is a
+minimal Web Application, which may simply be deployed into your favirourite
+servlet container, provided it supports at least Servlet API 2.4.
+
+* *Source JAR* -- The secondary artifact with the classifier _sources_ is
+simple the source of the _Launchpad Base_ project.
+
+To build a very basic Sling launcher, the _Launchpad Base_ is actually all
+you need. But to really glue this together and get a usable system, some
+more work is required. Lets see how the additionaly projects _Launchpad
+Bundles_, _Launchpad App_, and _Launchpad WebApp_ get to that.
+
+
+<a name="TheSlingLaunchpad-LaunchpadBundles"></a>
+### Launchpad Bundles
+
+The second project we want to look at is the _Launchpad Bundles_ project.
+This is a very simple project in that it only collects together a number of
+OSGi bundles, which will make up the final application. The bundles are
+stored in a (big) Java Archive in folders whose path is formed with
+*resources/9* where *9* is a start level which is assigned to the
+bundles as they are installed. The special start level *0* instructs the
+installer to not actually assign a specific start level to the bundles
+contained in that folder.
+
+Currently the following start level assignement is used by the _Launchpad
+Bundles_ project:
+
+<table>
+<tr><th> Start Level </th><th> Bundle Group </th><th> Bundle(s) </th></tr>
+<tr><td> 1 </td><td> Basic bundles required for the correct operation of Sling </td><td>
+org.apache.sling.commons.log
+</tr>
+<tr><td> 5 </td><td> Apache Felix Web Console </td><td> org.apache.felix.bundlerepository,
+org.apache.felix.webconsole, org.apache.sling.extensions.threaddump </td></tr>
+<tr><td> 10 </td><td> OSGi Compendium Service Implementations </td><td>
+org.apache.felix.configadmin, org.apache.felix.eventadmin,
+org.apache.felix.metatype, org.apache.felix.scr </td></tr>
+<tr><td> 15 </td><td> JCR Repository (Jackrabbit) </td><td> commons-collections,
+commons-io-1.4.jar
+</tr>
+commons-lang, jackrabbit-api, jackrabbit-jcr-commons,
+org.apache.sling.commons.mime, org.apache.sling.commons.osgi,
+org.apache.sling.jcr.api, org.apache.sling.jcr.base,
+org.apache.sling.jcr.jackrabbit.server, org.apache.sling.jcr.webdav |
+<tr><td> 0 </td><td> Actual Sling Application bundles </td><td> org.apache.sling.adapter,
+org.apache.sling.api, org.apache.sling.bundleresource.impl,
+org.apache.sling.commons.json, org.apache.sling.engine,
+org.apache.sling.extensions.apt.parser,
+org.apache.sling.extensions.apt.servlet, org.apache.sling.httpauth,
+org.apache.sling.jcr.classloader, org.apache.sling.jcr.contentloader,
+org.apache.sling.jcr.ocm, org.apache.sling.jcr.resource,
+org.apache.sling.launchpad.content,
+org.apache.sling.samples.path-based.rtp, org.apache.sling.scripting.api,
+org.apache.sling.scripting.core, org.apache.sling.scripting.javascript,
+org.apache.sling.scripting.jsp, org.apache.sling.scripting.jsp.taglib,
+org.apache.sling.servlets.get, org.apache.sling.servlets.post,
+org.apache.sling.servlets.resolver </td></tr>
+</table>
+
+
+
+<a name="TheSlingLaunchpad-LaunchpadAppandLaunchpadWebApp"></a>
+### Launchpad App and Launchpad WebApp
+
+The _Launchpad App_ and _Launchpad WebApp_ bundles are actually projects
+which just glue together artifacts from the Launchpad projects. There is
+nothing special about them. Here's what is done:
+
+* Take the appropriate secondary artifact from the _Launchpad Base_
+project: _app_ for the Standalone Java Application or _webapp_ for the Web
+Application and unpack
+* Take the _Launchpad Base_ primary artifact and place it under the name
+*org.apache.sling.launchpad.base.jar* into the *resources* folder
+* Take the _Launchpad Bundles_ artifact and unpack it
+* Finally pack all together into a single big JAR or WAR file
+
+That's it. The resulting artifact may be directly used to launch the
+Standalone Java Application or may directly be deployed into any Servlet
+API 2.4 (or later) compliant servlet container.

Added: sling/site/trunk/content/url-decomposition.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/url-decomposition.mdtext?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/content/url-decomposition.mdtext (added)
+++ sling/site/trunk/content/url-decomposition.mdtext Sun Apr 22 16:52:13 2012
@@ -0,0 +1,54 @@
+Title: URL decomposition
+<a name="URLdecomposition-URLdecomposition"></a>
+# URL decomposition
+
+During the _Resource Resolution_ step, the client request URL is decomposed
+into the following parts:
+
+1. *Resource Path* -  The longest substring of the request URL such that the
+resource path is either the complete request URL or the next character in
+the request URL after the resource path is a dot (*.*).
+1. *Selectors* -  If the first character in the request URL after the
+resource path is a dot, the string after the dot up to but not including
+the last dot before the next slash character or the end of the request URL.
+If the resource path spans the complete request URL no seletors exist. If
+only one dot follows the resource path before the end of the request URL or
+the next slash, also no selectors exist.
+1. *Extension* -  The string after the last dot after the resource path in
+the request URL but before the end of the request URL or the next slash
+after the resource path in the request URL. 
+1. *Suffix Path* -  If the request URL contains a slash character after the
+resource path and optional selectors and extension, the path starting with
+the slash up to the end of the request URL is the suffix path. Otherwise,
+the suffix path is empty. Note, that after the resource path at least a dot
+must be in the URL to let Sling detect the resource path.
+
+There's a cheat sheet on Day's dev page under [http://dev.day.com/content/docs/en/cq/current/developing/sling_cheatsheet.html](http://dev.day.com/content/docs/en/cq/current/developing/sling_cheatsheet.html)
+ available to get you familiar with the URL decomposition of Sling.
+
+*Examples*: Assume there is a Resource at */a/b*, which has no children.
+
+<table>
+<tr><th> URI </th><th> Resource Path </th><th> Selectors </th><th> Extension </th><th> Suffix </th><th> Resource
+Found </th></tr>
+<tr><td> /a/b			    </td><td> /a/b </td><td> null  </td><td> null </td><td> null       </td><td> yes </td></tr>
+<tr><td> /a/b.html		    </td><td> /a/b </td><td> null  </td><td> html </td><td> null       </td><td> yes </td></tr>
+<tr><td> /a/b.s1.html		    </td><td> /a/b </td><td> s1    </td><td> html </td><td> null       </td><td> yes </td></tr>
+<tr><td> /a/b.s1.s2.html	    </td><td> /a/b </td><td> s1.s2 </td><td> html </td><td> null       </td><td> yes </td></tr>
+<tr><td> /a/b/c/d		    </td><td> /a/b/c/d </td><td> null  </td><td> null </td><td> null	   </td><td> no! </td></tr>
+<tr><td> /a/b./c/d		     </td><td> /a/b </td><td> null  </td><td> null </td><td> /c/d	</td><td> yes </td></tr>
+<tr><td> /a/b.html/c/d 	    </td><td> /a/b </td><td> null  </td><td> html </td><td> /c/d       </td><td> yes </td></tr>
+<tr><td> /a/b.s1.html/c/d	    </td><td> /a/b </td><td> s1    </td><td> html </td><td> /c/d       </td><td> yes </td></tr>
+<tr><td> /a/b.s1.s2.html/c/d	    </td><td> /a/b </td><td> s1.s2 </td><td> html </td><td> /c/d       </td><td> yes </td></tr>
+<tr><td> /a/b/c/d.s.txt	    </td><td> /a/b/c/d </td><td> s  </td><td> txt </td><td> null </td><td> no! </td></tr>
+<tr><td> /a/b.html/c/d.s.txt	    </td><td> /a/b </td><td> null  </td><td> html </td><td> /c/d.s.txt </td><td> yes </td></tr>
+<tr><td> /a/b.s1.html/c/d.s.txt    </td><td> /a/b </td><td> s1    </td><td> html </td><td> /c/d.s.txt </td><td> yes </td></tr>
+<tr><td> /a/b.s1.s2.html/c/d.s.txt </td><td> /a/b </td><td> s1.s2 </td><td> html </td><td> /c/d.s.txt </td><td> yes </td></tr>
+</table>
+
+{info:title=Automated tests and examples}
+The [SlingRequestPathInfoTest](http://svn.apache.org/repos/asf/sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/impl/request/SlingRequestPathInfoTest.java)
+ demonstrates and tests this decomposition. Feel free to suggest additional
+tests that help clarify how this works!
+{info}
+

Added: sling/site/trunk/content/version-policy.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/version-policy.mdtext?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/content/version-policy.mdtext (added)
+++ sling/site/trunk/content/version-policy.mdtext Sun Apr 22 16:52:13 2012
@@ -0,0 +1,350 @@
+Title: Version Policy
+<a name="VersionPolicy-DRAFTVersionPolicy"></a>
+# DRAFT Version Policy
+
+{excerpt}This page is about how we assign versions to exported packages and
+bundles and defines when to increase which part of the version
+number.{excerpt}
+
+{info}
+Please note that this page is currently in draft stage and still being
+discussed.
+{info}
+
+{toc:minLevel=2|maxLevel=2}
+
+<a name="VersionPolicy-Introduction"></a>
+## Introduction
+
+In comments to SLING-1176 Ian Boston wrote:
+
+{quote}
+The exports in bundle/api/pom.xml look like they might become problematic from a support point of view, although we probably can't avoid this. \[...\](...\.html)
+ \[The problem is the\] manual maintenance of the version numbers. (not a
+big problem but needs to be done)
+{quote}
+
+I agree, that this is a problem. So let me reasonate on this a bit ;-)
+
+As a reference you might want to read [my blog post on version numbers](http://blog.meschberger.ch/2009/10/on-version-numbers.html)
+ and also what the [Eclipse guys have to say|http://wiki.eclipse.org/index.php/Version_Numbering]
+ (great read, btw). The OSGi Alliance has come up with a good definition
+for [Semantic Versioning|http://www.osgi.org/wiki/uploads/Links/SemanticVersioning.pdf]
+ to which the definitions described below perfectly match.
+
+For Sling we have three kinds of version numbers:
+
+1. Big Sling Releases
+1. Sling Bundles
+1. Package Exports
+
+*Big Sling Releases*
+
+For _Big Sling releases_ we already have an ample solution in that we just
+use a single number increased from release to release. Just remember that a
+_Big Sling release_ is a convenience release of existing released Sling
+bundles.
+
+*Sling Bundles*
+
+For _Sling Bundles_ version numbers are just defined as the *<version>*
+element of the bundle's POM. The only restriction here is, that we decided
+to use even numbers for releases and odd numbers for SNAPSHOTs. Whether and
+when which version part is increased is not explicitly defined yet.
+
+*Package Exports*
+
+For _Package Exports_ the situation is more problematic since there are a
+number of places to set exported package version number:
+
+  * In a *packageinfo* file inside the package (picked up by the Maven
+Bundle Plugin to set the export version)
+  * Explicitly in the *<Export-Package>* element of the Maven Bundle
+Plugin configuration
+  * By reference to the bundle version number using the *$\{pom.version*}
+variable.
+
+Upto now, we mostly used the *$\{pom.version* notation linking the
+exported package version to the bundle version. Over time this mechanism
+leads to a number of problems:
+
+  * For bundles with more than one package exported, the exported packages
+will evolve independently. As a consequence their versionin should also
+evolve independently. An example of such a bundle is the Sling API bundle
+of course.
+  * Linking the package export version number to the bundle version number
+confuses the actual semantics of both version numbers. The package export
+version number only indicates the version of the actual package while the
+bundle version number indicates a development state of the overall bundle.
+This will generally not be the same.
+  * The version of the exported package is increased on each bundle
+release, even though nothing may have changed on the export. In such a
+situation the version of the export should stay the same.
+
+That said, the reuse of the bundle version as the package export version
+still is probably the correct thing to do for legacy library wrappers.
+
+Consider for example the Sling API bundle, which exports 9 packages. Each
+of which may evolve independently. Now the *resource* package is extended
+causing a minor version increase. Should the version numbers of the other
+exports also be increased ? Thus acting as if there was some API change ?
+
+I would say, no. Particularly if some API implementation bundle is
+restricting the import version of the API implemented. Such an
+implementation would immediately stop working because the version has been
+increased. But since there has been no change, the implementation would
+still be correct.
+
+So, I think, we should evolve the exported package versions independently
+from each other and even independently from the bundle version.
+
+This places more burden on the developer when deciding on the exported
+package version - in fact this requires such a decision as compared to have
+Maven take the decision by just setting the bundle version.
+
+The only problem is: Where shall this be noted ? In the POM or in the
+*packageinfo* file ? If we would place the *packageinfo* file just
+beneath the class source files, I would say, in the *packageinfo* file.
+
+But this would require defining the class source locations as resource
+location in the POM (at least for *packageinfo*) files.
+
+I am not sure ....
+
+This has not been discussed at large, but I would assume, that the POM is
+still the correct place to take note of the version of the exported
+packages.
+
+*Future*
+
+The newest versions of the BND library also support an *@Export*
+annotation in the *package-info.java* pseudo class file. This pseudo
+class is supported starting with Java 5 to take package level annotations
+(like the *@Export* annotation) and as a replacement of the
+*package-info.html* file.
+
+Using this syntax something like the following would be easily possible:
+
+
+    /**
+     * This is the Package Level JavaDoc
+     */
+    @Export(version = "1.0")
+    package org.apache.sling.api.auth;
+    import aQute.bnd.annotation.Export;
+
+
+See [Bnd Experimental](http://www.aqute.biz/Code/XBnd)
+ for details. Unfortunately the current Maven Bundle Plugin version does
+not support updating to the most recent BND library versions due to
+incompatibilities.
+
+
+<a name="VersionPolicy-VersionNumberSyntax"></a>
+## Version Number Syntax
+
+As a small reminder, this is how a version number is constructed:  In OSGi
+version numbers are composed of four (4) segments: 3 integers and a string
+named major.minor.micro.qualifier.
+
+Each segment captures a different intent:
+
+    * the major segment indicates breakage in the API
+    * the minor segment indicates _externally visible_ changes
+    * the micro segment indicates bug fixes
+    * the qualifier segment is not generally used but may be used to convey
+more information about a particular build, such as a build time or an SVN
+revision number.
+
+
+<a name="VersionPolicy-EvolutionofExportedPackageVersions"></a>
+## Evolution of Exported Package Versions
+
+Version numbers of exported packages evolve independently from each other.
+Depending on the changes applied, the micro, minor, or major segement is
+increased. Whenever the major segment is increased, the minor and micro
+segments are reset to zero. Whenever the minor segment is increased, the
+micro segment is reset to zero.
+
+Segments are increased according to the above listing.
+
+This requires committers to think well about changes they apply to exported
+packages:
+
+  * Removing interfaces, methods or constants is likely an API breakage and
+thus requires a major version increase. In Sling we try to prevent this
+from happening.
+  * Adding new methods to interfaces is likely just an _externally visible_
+change and thus requires a minor version increase
+  * Fixing a bug in an exported class just requires a minor version
+increase.
+
+JavaDoc updates generally do not constitute a reason to evolve the version
+number. The exception is that if the JavaDoc update is caused by a API
+limitation, it might be conceivable to increase the version number of the
+exported package. A decision on this will have to be taken on a
+case-by-case basis.
+
+
+<a name="VersionPolicy-EvolutionofBundleVersions"></a>
+## Evolution of Bundle Versions
+
+Version numbers of bundles evolve depending on the evolution of the
+exported packages but also depending on the evolution of the private code,
+which is not exported.
+
+As a rule of thumb, the following reasons apply for increasing the segments
+of bundle version numbers:
+
+  * Increasing the major version number of any of the exported packages or
+restructuring the bundle such that major parts are removed from the bundle
+(and either completely removed or moved to other bundle(s)).
+  * Increasing the minor version number of any of the exported packages or
+refactoring the internal code or implementing a package exported by another
+bundle whose minor (or even major) version number has increased. Also
+functional extensions of the internal bundle classes consitutes a reason to
+increase the minor version number.
+  * Increasing the micro version number of any of the exported packages or
+bug fixes.
+
+Note, that this definition does not require the bundle and epxorted package
+version numbers to be synchronized in any way. While doing so might help in
+a first or second step, over time it will become close to impossible to
+keep the versions in sync. So rather than trying to keep the versions in
+sync, we should make sure, we increase the versions correctly.
+
+
+<a name="VersionPolicy-Examples"></a>
+## Examples
+
+
+<a name="VersionPolicy-PureAPIBundle"></a>
+### Pure API Bundle
+
+An example of an almost _Pure API Bundle_ is the Sling API bundle. This
+bundle exports 9 packages. Some are really stable -- e.g. the
+*org.apache.sling.api* package or the *org.apache.sling.wrappers*
+package -- and some are being worked on at the moment -- e.g. the
+*org.apache.sling.resource* package.
+
+To not break existing users of the unmodified packages, the exported
+versions of these packages must not be increased.
+
+To signal to users of evolving packages, that there might be new and
+interesting functionality, the version number must be increased according
+to above definition. This also conveys to the implementor(s) of the API,
+that they have to take some action.
+
+
+A hypothetical evolution of version numbers shown on two packages and the
+bundle version might be as follows
+
+<table>
+<tr><td> Description </td><td> *api* package </td><td> *resource* package </td><td> bundle </td></tr>
+<tr><td> Initial Release </td><td> 1.0.0 </td><td> 1.0.0 </td><td> 1.0.0 </td></tr>
+<tr><td> Bug fix in a *resource* class </td><td> 1.0.0 </td><td> 1.0.2 </td><td> 1.0.2 </td></tr>
+<tr><td> New API in the *resource* package </td><td> 1.0.0 </td><td> 1.1.0 </td><td> 1.1.0 </td></tr>
+<tr><td> New API in the *api* package </td><td> 1.1.0 </td><td> 1.1.0 </td><td> 1.2.0 </td></tr>
+<tr><td> API breakage in the *api* package </td><td> 2.0.0 </td><td> 1.1.0 </td><td> 2.0.0 </td></tr>
+</table>
+
+
+<a name="VersionPolicy-ImplementationBundleprovidingAPI"></a>
+### Implementation Bundle providing API
+
+An example of such a hybrid bundle is the Sling Engine bundle. This bundle
+exports two packages themselves defining API and contains a number of
+internal packages which actually implement parts of the Sling API.
+
+A hypothetical evolution of version numbers shown on one exported package
+and the bundle version might be as follows
+
+<table>
+<tr><td> Description </td><td> *engine* package </td><td> bundle </td></tr>
+<tr><td> Initial Release </td><td> 1.0.0 </td><td> 1.0.0 </td></tr>
+<tr><td> Bug fix in a *engine* class </td><td> 1.0.2 </td><td> 1.0.2 </td></tr>
+<tr><td> Bug fix in an internal calss </td><td> 1.0.2 </td><td> 1.0.4 </td></tr>
+<tr><td> New API in the *engine* package </td><td> 1.1.0 </td><td> 1.1.0 </td></tr>
+<tr><td> Implement new API from *api* 1.1.0 </td><td> 1.1.0 </td><td> 1.2.0 </td></tr>
+<tr><td> Refactor internal classes </td><td> 1.1.0 </td><td> 1.3.0 </td></tr>
+<tr><td> Implement API from *api* 2.0.0 </td><td> 1.1.0 </td><td> 2.0.0 </td></tr>
+</table>
+
+
+<a name="VersionPolicy-PureImplementationBundle"></a>
+### Pure Implementation Bundle
+
+For Pure Implementation Bundles only the bundle version numbers are
+maintained because there is no exported package whose version number needs
+to be managed. This makes the decision process of version number evolution
+very simple.
+
+
+<a name="VersionPolicy-ImportingPackages"></a>
+## Importing Packages
+
+
+When importing packages a version number will automatically be generated by
+the Maven Bundle Plugin as follows:
+
+  * If the providing package exports a package with an explicit version
+number, that exact version number will be used as the lower bound
+  * If such a lower bound exists, the upper bound is exclusive the next
+major version number.
+
+For example if importing the *api* package exported at version 1.2.3, the
+*Import-Package* statement is generated as
+
+
+    Import-Package: api;version=[1.2.3,2.0.0)
+
+
+
+This default works well for consumers of the API, since according to above
+definitions an API is guaranteed to not contain breakages if the major
+version number is not increased.
+
+For bundles implementing the API, this default does not work well, since
+from their point of view an _externally visible_ change in fact constitutes
+a breakage, because the implementation is not complete. So if a bundle
+implements a package a manually crafted import version should be defined
+which includes the export version of the defining bundle but excludes the
+next minor version.
+
+For example implementing the *api* package exported at version 1.2.3,
+would require the following manually created *Import-Package* statement:
+
+
+    Import-Package: api;version=[1.2.3,1.3.0)
+
+
+This allows for the implementation to work correctly with bug fixed package
+exports but as soon as there are any _externally visible_ changes, the
+implementation bundle has to be adapted -- even if this just means
+increasing the upper version bound in the *Import-Package* statement thus
+guaranteeing compliance (again).
+
+*Future*
+
+Recent versions of the BND library support automatic differntiation between
+use and implementation of API and to set the import version ranges
+accordingly. See [Bnd Experimental](http://www.aqute.biz/Code/XBnd)
+ for details. Unfortunately the current Maven Bundle Plugin version does
+not support updating to the most recent BND library versions due to
+incompatibilities.
+
+<a name="VersionPolicy-References"></a>
+## References
+
+[Version Numbers](http://markmail.org/thread/zshobgjwtqrncajt)
+ -- The mail thread discussing version numbering
+[On Version Numbers](http://blog.meschberger.ch/2009/10/on-version-numbers.html)
+ -- Blog about version numbers
+[Version Numbering](http://wiki.eclipse.org/index.php/Version_Numbering)
+ -- An Eclipse paper on assigning version numbers. Very good read.
+[Semantic Versioning](http://www.osgi.org/wiki/uploads/Links/SemanticVersioning.pdf)
+ -- An OSGi Alliance paper on semantic versioning.
+[Bnd Experimental](http://www.aqute.biz/Code/XBnd)
+ -- Experimental extensions to the BND library; unfortunately these
+extensions are not yet usable with Maven Bundle Plugin 2.1.0 due to API
+changes in the BND library not supported by the plugin.

Added: sling/site/trunk/content/web-console-extensions.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/web-console-extensions.mdtext?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/content/web-console-extensions.mdtext (added)
+++ sling/site/trunk/content/web-console-extensions.mdtext Sun Apr 22 16:52:13 2012
@@ -0,0 +1,65 @@
+Title: Web Console Extensions
+<a name="WebConsoleExtensions-WebConsoleExtensions"></a>
+# Web Console Extensions
+
+The Apache Sling project provides two extensions to the [Apache Felix Web Console](http://felix.apache.org/site/apache-felix-web-console.html)
+ (in addition to a number of plugins, of course):
+
+{toc:minLevel=2|maxLevel=2}
+
+<a name="WebConsoleExtensions-Branding(org.apache.sling.extensions.webconsolebranding)"></a>
+## Branding (org.apache.sling.extensions.webconsolebranding)
+
+The Apache Sling Web Console Branding provided by Apache Sling is currently
+just for the product logo displayed in the upper right corner of the Web
+Console and some titles and strings.
+
+This bundle will attach as a fragment bundle to the Apache Felix Web
+Console bundle. To enable it after installation into a running system, you
+might have to refresh the package imports of the Apache Felix Web Console
+bundle. If you install using the Apache Felix Web Console bundle
+installation functionality, this will be taken care of by the Web Console.
+
+
+h2. Security Provider
+(org.apache.sling.extensions.webconsolesecurityprovider)
+
+The Apache Sling Web Console Security Provider implements the Apache Felix
+Web Console *WebConsoleSecurityProvider* interface authenticating Web
+Console users against the JCR repository. Each username and password
+presented is used to login to the JCR repository and to check the
+respective session.
+
+1. Ensure the username and password can be used to login to the default
+workspace. If not, access is denied
+1. If the username presented is one of the user names configured with the
+*users* configuration property, access is granted.
+1. Otherwise if the user is a (direct or indirect) member of one of the
+groups configured with the *groups* configuration property, access is
+granted.
+
+Access is denied if the username and password cannot be used to login to
+the default workspace or if the user is neither one of the configured
+allowed users nor in any of the configured groups.
+
+<a name="WebConsoleExtensions-Configuration"></a>
+### Configuration
+
+The Security Provider is configured with configuration with PID
+*org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider*
+supporting the following properties:
+
+<table>
+<tr><th> Property </th><th> Type </th><th> Default Value </th><th> Description
+</tr>
+<tr><td> *users* </td><td> *String*, {{String[](.html)
+}} or *Vector<String>* </td><td> admin </td><td> The list of users granted access to the
+Web Console </td></tr>
+<tr><td> *groups*</td><td> *String*, {{String[](.html)
+}} or *Vector<String>* </td><td> --- </td><td> The list of groups whose (direct or
+indirect) members are granted access to the Web Console </td></tr>
+</table>
+
+Note, that while the default value explicitly grants the _admin_ user to
+access the Web Console it is suggested that system administrators define a
+special group and assign users with Web Console access to this group.

Added: sling/site/trunk/content/wiki.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/wiki.mdtext?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/content/wiki.mdtext (added)
+++ sling/site/trunk/content/wiki.mdtext Sun Apr 22 16:52:13 2012
@@ -0,0 +1,29 @@
+Title: wiki
+<a name="wiki-ApacheSlingWebsite"></a>
+# Apache Sling Website
+
+{tip:title=Use Generated Pages}
+The Apache Sling project uses a Confluence space for documentation purposes
+and to generate the static Sling web site. You are currently looking at the
+source wiki. End users should generally use the static, generated pages, at
+http://incubator.apache.org/sling since the wiki is typically only
+necessary for editing content. Below you'll find an overview of the main
+menu, all pages in this wiki as well as a list of recently modified pages.
+{tip}
+
+{section}
+{column:width=50%}
+<a name="wiki-Menu"></a>
+# Menu
+{include:navigation}
+<a name="wiki-Recentlyupdatedpages"></a>
+# Recently updated pages
+{recently-updated:spaces=SLINGxSITE}
+{column}
+
+{column:width=50%}
+<a name="wiki-Sitemap"></a>
+# Site map
+{children:page=SLINGxSITE:|all=true}
+{column}
+{section} 

Added: sling/site/trunk/content/wrap-or-decorate-resources.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/wrap-or-decorate-resources.mdtext?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/content/wrap-or-decorate-resources.mdtext (added)
+++ sling/site/trunk/content/wrap-or-decorate-resources.mdtext Sun Apr 22 16:52:13 2012
@@ -0,0 +1,48 @@
+Title: Wrap or Decorate Resources
+<a name="WraporDecorateResources-Servicetowrapresources"></a>
+# Service to wrap resources
+
+<a name="WraporDecorateResources-Introduction"></a>
+## Introduction
+
+The Sling API provides an easy way to wrap or decorate a resource before
+returning. Use cases for this could for example be
+* overwrite resource type/resource super type (for example based on the
+resource path)
+* add metadata
+
+<a name="WraporDecorateResources-"></a>
+## 
+
+To add a resource decorator just register one or more services which
+implement the interface *ResourceDecorator*
+
+
+    interface ResourceDecorator {
+        Resource decorate(Resource)
+    
+        @Deprecated
+        Resource decorate(Resource, HttpServletRequest)
+    } 
+
+
+The registered decorators will be called from the resource resolver for
+each resource returned. 
+If the service decorates the resource it should return the new resource. If
+the service does not want to decorate the resource, it should return the
+original resource or null. 
+
+The two-argument *{decorate*} method will not be invoked, starting with
+version 2.1.0 of the JCR Resource bundle. Implementors of this interface
+targeting both newer and older versions of this bundle are advised to
+implement this method with:
+
+
+        public Resource decorate(Resource resource, HttpServletRequest request)
+{
+    	return this.decorate(resource);
+        }
+
+
+And use some other method (e.g. a *{ThreadLocal*}) to obtain the current
+request if necessary.

Added: sling/site/trunk/content/xslt-processing-pipeline.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/xslt-processing-pipeline.mdtext?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/content/xslt-processing-pipeline.mdtext (added)
+++ sling/site/trunk/content/xslt-processing-pipeline.mdtext Sun Apr 22 16:52:13 2012
@@ -0,0 +1,208 @@
+Title: XSLT Processing Pipeline
+{excerpt:hidden=true}
+Explains how to use the XSLT processing support (script extension
+*.xpl*){excerpt}
+In the _Apache Sling Scripting W3C XML Processing Support_ bundle, Juanjo
+Vázquez has implemented XSLT processing support for Sling as another new
+scripting engine, based on the [Cocoon 3 pipeline engine](http://cocoon.apache.org//3.0/)
+.
+
+<a name="XSLTProcessingPipeline-Intro"></a>
+## Intro
+
+An XML pipeline specifies a sequence of operations to be performed on zero
+or more XML documents. There are a number of advantages to using pipelines
+above all in terms of separation of concerns. On the other hand, we talk
+about XSLT processing if the operations in a pipeline are performed
+executing or applying XSLT stylesheets.
+
+XSLT processing support is implemented in Sling as an scripting engine
+bundle named _Apache Sling Scripting W3C XML Processing Support_. This
+bundle is based on the [Cocoon 3 pipeline engine](http://cocoon.apache.org//3.0/)
+ and uses the [W3C XProc language|http://www.w3.org/TR/xproc/]
+ in order to specify pipelines to be processed.
+
+For the time being, XProc is partially implemented and it´s not clear that
+Sling must support all W3C recomendation yet. This could depend of concrete
+user requirements or use cases.
+
+The source code is found in the [contrib/scripting/xproc](-http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/scripting/xproc.html)
+ module.
+
+<a name="XSLTProcessingPipeline-HowtoInstall"></a>
+## How to Install
+
+Install the *org.apache.sling.scripting.xproc* bundle in order to work
+with XProc. You can achieve this either building it from
+*contrib/scripting/xproc* folder in the Sling trunk or by downloading it
+from the Apache Snapshot repository here: [org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar](http://people.apache.org/repo/m2-snapshot-repository/org/apache/sling/org.apache.sling.scripting.xproc/2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar)
+.
+
+To deploy the bundle go to the bundles page of Apache Felix Web Console ([http://localhost:8888/system/console/bundles](http://localhost:8888/system/console/bundles)
+), select the bundle file to upload, check the Start check box and click
+Install or Update button.
+
+In order to check whether XProc scripting engine has been installed, go to
+the Script Engines page of the Apache Felix Web Console and see the entry
+for XProc there:
+
+
+    Apache Sling Scripting W3C XML Processing Support, 2.0.0-incubator-SNAPSHOT
+    	Language	XMLProc, 1.0
+    	Extensions	xpl
+    	MIME Types	application/xml
+    	Names	XProc, xml processing, xml pipeline processor 
+
+
+<a name="XSLTProcessingPipeline-Howitworks"></a>
+## How it works
+
+As explained above, the bundle is able to perform a sequence of XSLT
+transforms on an XML document just as is expressed in a pipeline
+definition. A pipeline definition is a file with an xpl extension that
+follows the [W3C XProc grammar](http://www.w3.org/TR/xproc/)
+. Only *p:xslt* steps are supported at the moment.
+
+For the XML input of pipeline, the processing uses a Cocoon generator named
+*SlingGenerator* that tries to resolve the requested resource as (in
+order of preference):
+
+* an static XML file 
+* a dynamically generated XML 
+* the underlying node´s export document view 
+
+<a name="XSLTProcessingPipeline-Samples"></a>
+## Samples
+
+Let´s see some samples in order to understand the processing behaviour.
+
+1. Create some content
+
+    $ curl -F sling:resourceType=xproc -F title="some title" -F text="And some
+text" http://admin:admin@localhost:8888/foo
+
+2. Use WebDAV or curl to create a pipeline script at
+*/apps/xproc/xproc.xpl* :
+
+    <?xml version="1.0" encoding="UTF-8"?>
+    <p:pipeline xmlns:p="http://www.w3.org/ns/xproc">
+    
+      <p:xslt>
+        <p:input port="stylesheet">
+          <p:document href="/apps/xproc/one.xsl"/>
+        </p:input>
+      </p:xslt>
+    
+      <p:xslt>
+        <p:input port="stylesheet">
+          <p:document href="/apps/xproc/two.xsl"/>
+        </p:input>
+      </p:xslt>
+    
+    </p:pipeline>
+
+3. Store the XSLT transforms in the repository:
+{code:xml|title=/apps/xproc/one.xsl}
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="/">
+  <one>
+    <xsl:copy-of select="."/>
+  </one>
+</xsl:template>
+
+</xsl:stylesheet>
+
+    {code:xml|title=/apps/xproc/two.xsl}
+    <xsl:stylesheet version="1.0"
+        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    
+    <xsl:template match="/">
+      <two>
+        <xsl:copy-of select="."/>
+      </two>
+    </xsl:template>
+    
+    </xsl:stylesheet>
+
+4. Request foo.html to execute the pipeline:
+
+    $ curl http://admin:admin@localhost:8888/foo.html
+    
+    <?xml version="1.0" encoding="UTF-8"?>
+    <two>
+      <one>
+        <foo ...sling:resourceType="xproc" text="And some text" title="some
+title"/>
+      </one>
+    </two>
+
+
+In this case, the node´s document view has been the pipeline´s source.
+
+5. Now, store an static XML in the repository:
+{code:xml|title=/foo.xml}
+<?xml version="1.0" encoding="UTF-8"?>
+<foo>
+	<content>
+		foo: static content
+	</content>
+</foo>
+
+    
+    6. Again, request foo.html to execute the pipeline:
+    {noformat}
+    $ curl http://admin:admin@localhost:8888/foo.html
+    
+    <?xml version="1.0" encoding="UTF-8"?>
+    <two>
+      <one>
+        <foo>
+    	<content>
+    	  foo: static content
+    	</content>
+        </foo>
+      </one>
+    </two>
+    {noformat}
+    
+    This time the pipeline´s source has been an static XML file.
+    
+    7. Store an script in the repository:
+    {code:xml|title=/apps/xproc/xproc.xml.esp}
+    <?xml version="1.0" encoding="UTF-8"?>
+    <foo>
+    	<content>
+    		foo: dynamic content
+    	</content>
+    </foo>
+
+
+8. Delete previous static xml file (/foo.xml).
+
+9. Request foo.html to execute the pipeline:
+
+    $ curl http://admin:admin@localhost:8888/foo.html
+    
+    <?xml version="1.0" encoding="UTF-8"?>
+    <two>
+      <one>
+        <foo>
+    	<content>
+    	  foo: dynamic content
+    	</content>
+        </foo>
+      </one>
+    </two>
+
+
+This time the pipeline´s source has been a dinamically generated XML.
+
+<a name="XSLTProcessingPipeline-References"></a>
+## References
+
+* [Cocoon 3 pipeline engine](http://cocoon.apache.org//3.0/)
+* [W3C XProc language](http://www.w3.org/TR/xproc/)
+* [SLING-893](https://issues.apache.org/jira/browse/SLING-893)
+* [Mail list discussion](http://markmail.org/thread/33h5nhk5e3mswrue)

Added: sling/site/trunk/templates/standard.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/templates/standard.html?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/templates/standard.html (added)
+++ sling/site/trunk/templates/standard.html Sun Apr 22 16:52:13 2012
@@ -0,0 +1,38 @@
+<!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 - {% block title %}{% endblock %}</title>
+    <link rel="stylesheet" href="${sling}/media.data/site.css" type="text/css" media="all">
+    <link rel="icon" href="${sling}/media.data/favicon.ico">
+    <meta http-equiv="Content-Type" content="text/html">
+  </head>
+  <body>
+    <div class="title">
+      <div class="logo">
+        <a href="${sling}/index.html">
+          <img border="0" alt="Apache Sling" src="${sling}/media.data/logo.png">
+        </a>
+      </div>
+      <div class="header">
+        <a href="http://www.apache.org/">
+          <img border="0" alt="Apache" src="${sling}/media.data/apache.png">
+        </a>
+      </div>
+    </div>
+    <div class="menu">
+$content
+    </div>
+    <div class="main">
+        <div class="breadcrump" style="font-size: 80%;">
+{{ breadcrumbs|safe }}
+        </div>
+{% block content %}{% endblock %}
+        <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by $page.lastModifierName on $page.lastModificationDate
+        </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>

Added: sling/site/trunk/templates/standard_markdown.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/templates/standard_markdown.html?rev=1328899&view=auto
==============================================================================
--- sling/site/trunk/templates/standard_markdown.html (added)
+++ sling/site/trunk/templates/standard_markdown.html Sun Apr 22 16:52:13 2012
@@ -0,0 +1,3 @@
+{% extends "standard.html" %}
+{% block title %}{{ headers.title }}{% endblock %}
+{% block content %}{{ content|markdown }}{% endblock %}



Mime
View raw message