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

svn commit: r841833 [14/28] - in /websites/staging/sling/trunk/content: ./ site/ site/46-line-blog.data/ site/authentication.data/ site/documentation.data/ site/first-steps.data/ site/getting-and-building-sling.data/ site/how-to-manage-events-in-sling....

Added: websites/staging/sling/trunk/content/site/links.html
==============================================================================
--- websites/staging/sling/trunk/content/site/links.html (added)
+++ websites/staging/sling/trunk/content/site/links.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,140 @@
+
+<!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 - Links</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="" 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="" title="Links">Links</A>
+        </DIV>
+<H1><A name="Links-Links"></A>Links</H1>
+
+<P>Here are some links to other resources</P>
+
+<H2><A name="Links-Articles"></A>Articles</H2>
+<UL>
+	<LI><A href="http://java.dzone.com/articles/java-content-repository-best" class="external-link" rel="nofollow">Java Content Repository: The Best Of Both Worlds</A> - by Bertrand Delacretaz on Javalobby - uses the Sling HTTP interface to demonstrate JCR features.</LI>
+	<LI><A href="http://www.lucamasini.net/Home/sling-and-cq5/accessing-relational-data-as-sling-restful-urls" class="external-link" rel="nofollow">Accessing Relational Data as SLING RESTful URLs</A> - by Luca Masini</LI>
+	<LI><A href="http://confluence.sakaiproject.org/display/KERNDOC/Your%20First%20Day%20With%20Sakai%20Nakamura" class="external-link" rel="nofollow">Your First Day With Sakai Nakamura</A> - Sakai Nakamura is based on Sling, that introductory article has very good explanations of REST and Sling basics, and on why hierarchies are useful on the Web.</LI>
+</UL>
+
+
+<H2><A name="Links-AboutSling"></A>About Sling</H2>
+
+<UL>
+	<LI><A href="http://dev.day.com/microsling/content/blogs/main.html?category=sling" class="external-link" rel="nofollow">Sling on dev.day.com</A> - Day's developers blog, regularly includes articles on Sling and JCR. Powered by Sling, of course.</LI>
+	<LI><A href="http://weblogs.goshaky.com/weblogs/lars/tags/sling" class="external-link" rel="nofollow">Sling on Lars Trieloff's Blog</A> - Lars regularly writes on his experiences with Sling. Most notably the mini series of three entries introducing Sling and microsling.</LI>
+	<LI><A href="http://del.icio.us/tag/sling%20jcr" class="external-link" rel="nofollow">Sling links at del.icio.us</A> - If you're a del.icio.us user, please tag Sling-related posts with both <EM>sling</EM> and <EM>jcr</EM> tags, so that they appear in that list.</LI>
+	<LI><A href="http://fisheye6.atlassian.com/browse/sling" class="external-link" rel="nofollow">Sling on Fisheye</A> - code repository viewer, activity statistics, etc.</LI>
+	<LI><A href="https://www.ohloh.net/p/sling" class="external-link" rel="nofollow">Sling on ohloh</A> - activity and community statistics.</LI>
+	<LI><A href="http://sling.markmail.org/" class="external-link" rel="nofollow">Sling on MarkMail</A> - searchable mailing list archives.</LI>
+</UL>
+
+
+
+<H2><A name="Links-ProjectsusingSling"></A>Projects using Sling</H2>
+
+<UL>
+	<LI>Gert Vanthienen succeeded in installing Sling into the new Apache ServiceMix kernel and documented his experience <A href="http://servicemix.apache.org/SMX4KNL/running-apache-sling-on-servicemix-kernel.html" class="external-link" rel="nofollow">Sling On ServiceMix Kernel</A></LI>
+</UL>
+
+
+<H2><A name="Links-SlingPresentationsandScreencasts"></A>Sling Presentations and Screencasts</H2>
+
+<UL>
+	<LI><A href="http://www.slideshare.net/tag/sling" class="external-link" rel="nofollow">Presentations tagged with &quot;sling&quot; at slideshare</A></LI>
+</UL>
+
+
+<P>The following screencasts demonstrate Day Software's CRX quickstart product, powered by Sling:</P>
+<UL>
+	<LI><A href="http://dev.day.com/microsling/content/blogs/main/firststeps1.html" class="external-link" rel="nofollow">First Steps with CRX Quickstart</A></LI>
+	<LI><A href="http://dev.day.com/microsling/content/blogs/main/firststeps2.html" class="external-link" rel="nofollow">TheServerSide.com in 15 minutes</A></LI>
+</UL>
+
+
+<H2><A name="Links-FromApacheConEU08"></A>From ApacheCon EU 08</H2>
+
+<UL>
+	<LI><A href="links.data/ApacheConEU08_FFT_Sling.pdf">ApacheCon EU 08 Fast Feather Track Presentation on Sling</A></LI>
+	<LI><A href="links.data/ApacheConEU08_JCR_Meetup_Sling_Architecture.pdf">JCR Meetup Presentation on Sling Architecture</A></LI>
+</UL>
+
+
+<H2><A name="Links-FromApacheConUS07"></A>From ApacheCon US 07</H2>
+
+<UL>
+	<LI><A href="links.data/ApacheConUS07_FFT_Sling.pdf">ApacheCon US 07 Fast Feather Track Presentation on Sling</A></LI>
+	<LI><A href="http://feathercast.org/?p=59" class="external-link" rel="nofollow">Feathercast On Day 4 with an interview on Sling with Felix</A></LI>
+</UL>
+
+
+<H2><A name="Links-TechnologyusedbySling"></A>Technology used by Sling</H2>
+
+<UL>
+	<LI><A href="http://jackrabbit.apache.org/" class="external-link" rel="nofollow">Apache Jackrabbit</A> - The reference implementation of the Content Repository for Java (JCR) Specification. This implementation is used in Sling as the primary repository.</LI>
+	<LI><A href="http://www.jcp.org/en/jsr/detail?id=170" class="external-link" rel="nofollow">JSR 170: Content Repository for Java<SPAN class="tm mark "><B></B><SMALL><SUP>TM</SUP></SMALL></SPAN>
+ technology API</A> - The specification of the repository API.</LI>
+	<LI><A href="http://felix.apache.org/" class="external-link" rel="nofollow">Apache Felix</A> - The OSGi Framework implementation we use in Sling.</LI>
+	<LI><A href="http://www.osgi.org/" class="external-link" rel="nofollow">The OSGi Alliance</A> - The OSGi Alliance is the specification body defining the OSGi Core and Compendium Services. These specifications are at the center of making Sling possible.</LI>
+</UL>
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by bdelacretaz on 2010-04-23 06:04:57.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>
+

Added: websites/staging/sling/trunk/content/site/logging.html
==============================================================================
--- websites/staging/sling/trunk/content/site/logging.html (added)
+++ websites/staging/sling/trunk/content/site/logging.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,290 @@
+
+<!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 - Logging</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="development.html" title="Development">Development</A>&nbsp;&gt;&nbsp;<A href="" title="Logging">Logging</A>
+        </DIV>
+<H1><A name="Logging-Logging"></A>Logging</H1>
+
+<H2><A name="Logging-Introduction"></A>Introduction</H2>
+
+<P>Logging in Sling is supported by the <TT>org.apache.sling.commons.log</TT> bundle, which is one of the first bundles installed and started by the Sling Launcher. The <TT>org.apache.sling.commons.log</TT> bundle has the following tasks:</P>
+
+<UL>
+	<LI>Implements the OSGi Log Service Specification and registers the <TT>LogService</TT> and <TT>LogReader</TT> services</LI>
+	<LI>Exports three commonly used logging APIs:
+	<UL>
+		<LI><A href="http://www.slf4j.org/" class="external-link" rel="nofollow">Simple Logging Facade for Java (SLF4J)</A></LI>
+		<LI><A href="http://jakarta.apache.org/commons/logging" class="external-link" rel="nofollow">Apache Commons Logging</A></LI>
+		<LI><A href="http://logging.apache.org/log4j/index.html" class="external-link" rel="nofollow">log4j</A></LI>
+		<LI><A href="http://download.oracle.com/javase/6/docs/api/java/util/logging/package-summary.html" class="external-link" rel="nofollow">java.util.logging</A> (as of r1169918)</LI>
+	</UL>
+	</LI>
+	<LI>Configures logging through our own implementation of the SLF4J backend API</LI>
+</UL>
+
+
+
+<H2><A name="Logging-InitialConfiguration"></A>Initial Configuration</H2>
+
+<P>The <TT>org.apache.sling.commons.log</TT> bundle gets the initial configuration from the following <TT>BundleContext</TT> properties:</P>
+
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Property </TH>
+<TH class="confluenceTh"> Default </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.level</TT> </TD>
+<TD class="confluenceTd"> <TT>INFO</TT> </TD>
+<TD class="confluenceTd"> Sets the initial logging level of the root logger. This may be any of the defined logging levels <TT>DEBUG</TT>, <TT>INFO</TT>, <TT>WARN</TT>, <TT>ERROR</TT> and <TT>FATAL</TT>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.file</TT> </TD>
+<TD class="confluenceTd"> undefined </TD>
+<TD class="confluenceTd"> Sets the log file to which log messages are written. If this property is empty or missing, log messages are written to <TT>System.out</TT>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.file.number</TT> </TD>
+<TD class="confluenceTd"> 5 </TD>
+<TD class="confluenceTd"> The number of rotated files to keep. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.file.size</TT> </TD>
+<TD class="confluenceTd"> '.'yyyy-MM-dd </TD>
+<TD class="confluenceTd"> Defines how the log file is rotated (by schedule or by size) and when to rotate. See the section <EM>Log File Rotation</EM> below for full details on log file rotation. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.pattern</TT> </TD>
+<TD class="confluenceTd"> {0,date,dd.MM.yyyy HH:mm:ss.SSS} &#42;{4}&#42; [{2}] {3} {5} </TD>
+<TD class="confluenceTd"> The <TT>MessageFormat</TT> pattern to use for formatting log messages with the root logger. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.julenabled</TT> </TD>
+<TD class="confluenceTd"> n/a </TD>
+<TD class="confluenceTd"> Enables the <TT>java.util.logging</TT> support. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+<H2><A name="Logging-UserConfiguration"></A>User Configuration</H2>
+
+<P>User Configuration after initial configuration is provided by the Configuration Admin Service. To this avail two <TT>org.osgi.services.cm.ManagedServiceFactory</TT> services are registered under the PIDs <TT>org.apache.sling.commons.log.LogManager.factory.writer</TT> and <TT>org.apache.sling.commons.log.LogManager.factory.config</TT> which may receive configuration.</P>
+
+
+<H3><A name="Logging-LoggerConfiguration"></A>Logger Configuration</H3>
+
+<P>Loggers (or Categories) can be configured to log to specific files at specific levels using configurable patterns. To this avail factory configuration instances with factory PID <TT>org.apache.sling.commons.log.LogManager.factory.config</TT> may be created and configured with the Configuration Admin Service.</P>
+
+<P>The following properties may be set:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Property </TH>
+<TH class="confluenceTh"> Type </TH>
+<TH class="confluenceTh"> Default </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.level</TT> </TD>
+<TD class="confluenceTd"> String </TD>
+<TD class="confluenceTd"> <TT>INFO</TT> </TD>
+<TD class="confluenceTd"> Sets the logging level of the loggers. This may be any of the defined logging levels <TT>DEBUG</TT>, <TT>INFO</TT>, <TT>WARN</TT>, <TT>ERROR</TT> and <TT>FATAL</TT>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.file</TT> </TD>
+<TD class="confluenceTd"> String </TD>
+<TD class="confluenceTd"> undefined </TD>
+<TD class="confluenceTd"> Sets the log file to which log messages are written. If this property is empty or missing, log messages are written to <TT>System.out</TT>. This property should refer to the file name of a configured Log Writer (see below). If no Log Writer is configured with the same file name an implicit Log Writer configuration with default configuration is created. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.pattern</TT> </TD>
+<TD class="confluenceTd"> String </TD>
+<TD class="confluenceTd"> {0,date,dd.MM.yyyy HH:mm:ss.SSS} &#42;{4}&#42; [{2}] {3} {5} </TD>
+<TD class="confluenceTd"> The <TT>java.util.MessageFormat</TT> pattern to use for formatting log messages with the root logger. This is a <TT>java.util.MessageFormat</TT> pattern supporting up to six arguments: {0} The timestamp of type <TT>java.util.Date</TT>, {1} the log marker, {2} the name of the current thread, {3} the name of the logger, {4} the debug level and {5} the actual debug message. If the log call includes a Throwable, the stacktrace is just appended to the message regardless of the pattern. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.names</TT> </TD>
+<TD class="confluenceTd"> String[] </TD>
+<TD class="confluenceTd"> &ndash; </TD>
+<TD class="confluenceTd"> A list of logger names to which this configuration applies. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+<P>Note that multiple Logger Configurations may refer to the same Log Writer Configuration. If no Log Writer Configuration exists whose file name matches the file name set on the Logger Configuration an implicit Log Writer Configuration with default setup (daily log rotation) is internally created. </P>
+
+
+<H3><A name="Logging-LogWriterConfiguration"></A>Log Writer Configuration</H3>
+
+<P>Log Writer Configuration is used to setup file output and log file rotation characteristics for log writers used by the Loggers.</P>
+
+<P>The following properties may be set:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Property </TH>
+<TH class="confluenceTh"> Default </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.file</TT> </TD>
+<TD class="confluenceTd"> undefined </TD>
+<TD class="confluenceTd"> Sets the log file to which log messages are written. If this property is empty or missing, log messages are written to <TT>System.out</TT>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.file.number</TT> </TD>
+<TD class="confluenceTd"> 5 </TD>
+<TD class="confluenceTd"> The number of rotated files to keep. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.commons.log.file.size</TT> </TD>
+<TD class="confluenceTd"> '.'yyyy-MM-dd </TD>
+<TD class="confluenceTd"> Defines how the log file is rotated (by schedule or by size) and when to rotate. See the section <EM>Log File Rotation</EM> below for full details on log file rotation. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>See the section <EM>Log File Rotation</EM> below for full details on the <TT>org.apache.sling.commons.log.file.size</TT> and <TT>org.apache.sling.commons.log.file.number</TT> properties.</P>
+
+
+
+<H2><A name="Logging-LogFileRotation"></A>Log File Rotation</H2>
+
+<P>Log files can grow rather quickly and fill up available disk space. To cope with this growth log files may be rotated in two ways: At specific times or when the log file reaches a configurable size. The first method is called <EM>Scheduled Rotation</EM> and is used by specifying a <TT>SimpleDateFormat</TT> pattern as the log file &quot;size&quot;. The second method is called <EM>Size Rotation</EM> and is used by setting a maximum file size as the log file size.</P>
+
+<P>As of version 2.0.6 of the Sling Commons Log bundle, the default value for log file scheduling is <TT>'.'yyyy-MM-dd</TT> causing daily log rotation. Previously log rotation defaulted to a 10MB file size limit.</P>
+
+
+
+<H3><A name="Logging-ScheduledRotation"></A>Scheduled Rotation</H3>
+
+<P>The rolling schedule is specified by setting the <TT>org.apache.sling.commons.log.file.size</TT> property to a <TT>java.text.SimpleDateFormat</TT> pattern. Literal text (such as a leading dot) to be included must be <EM>enclosed</EM> within a pair of single quotes. A formatted version of the date pattern is used as the suffix for the rolled file name.</P>
+
+<P>For example, if the log file is configured as <TT>/foo/bar.log</TT> and the pattern set to <TT>'.'yyyy-MM-dd</TT>, on 2001-02-16 at midnight, the logging file <TT>/foo/bar.log</TT> will be renamed to <TT>/foo/bar.log.2001-02-16</TT> and logging for 2001-02-17 will continue in a new <TT>/foo/bar.log</TT> file until it rolls over the next day.</P>
+
+<P>It is possible to specify monthly, weekly, half-daily, daily, hourly, or minutely rollover schedules.</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> DatePattern </TH>
+<TH class="confluenceTh"> Rollover schedule </TH>
+<TH class="confluenceTh"> Example </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>'.'yyyy-MM</TT> </TD>
+<TD class="confluenceTd"> Rollover at the beginning of each month </TD>
+<TD class="confluenceTd"> At midnight of May 31st, 2002 <TT>/foo/bar.log</TT> will be copied to <TT>/foo/bar.log.2002-05</TT>. Logging for the month of June will be output to <TT>/foo/bar.log</TT> until it is also rolled over the next month. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>'.'yyyy-ww</TT> </TD>
+<TD class="confluenceTd"> Rollover at the first day of each week. The first day of the week depends on the locale. </TD>
+<TD class="confluenceTd"> Assuming the first day of the week is Sunday, on Saturday midnight, June 9th 2002, the file <TT>/foo/bar.log</TT> will be copied to <TT>/foo/bar.log.2002-23</TT>. Logging for the 24th week of 2002 will be output to <TT>/foo/bar.log</TT> until it is rolled over the next week. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>'.'yyyy-MM-dd</TT> </TD>
+<TD class="confluenceTd"> Rollover at midnight each day.</TD>
+<TD class="confluenceTd"> At midnight, on March 8th, 2002, <TT>/foo/bar.log</TT> will be copied to <TT>/foo/bar.log.2002-03-08</TT>. Logging for the 9th day of March will be output to <TT>/foo/bar.log</TT> until it is rolled over the next day.</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>'.'yyyy-MM-dd-a</TT> </TD>
+<TD class="confluenceTd"> Rollover at midnight and midday of each day.</TD>
+<TD class="confluenceTd"> at noon, on March 9th, 2002, <TT>/foo/bar.log</TT> will be copied to  <TT>/foo/bar.log.2002-03-09-AM</TT>. Logging for the afternoon of the 9th will be output to <TT>/foo/bar.log</TT> until it is rolled over at midnight.</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>'.'yyyy-MM-dd-HH</TT> </TD>
+<TD class="confluenceTd"> Rollover at the top of every hour.</TD>
+<TD class="confluenceTd"> At approximately 11:00.000 o'clock on March 9th, 2002, <TT>/foo/bar.log</TT> will be copied to <TT>/foo/bar.log.2002-03-09-10</TT>. Logging for the 11th hour of the 9th of March will be output to <TT>/foo/bar.log</TT> until it is rolled over at the beginning of the next hour.</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>'.'yyyy-MM-dd-HH-mm</TT> </TD>
+<TD class="confluenceTd"> Rollover at the beginning of every minute.</TD>
+<TD class="confluenceTd"> At approximately 11:23,000, on March 9th, 2001, <TT>/foo/bar.log</TT> will be copied to <TT>/foo/bar.log.2001-03-09-10-22</TT>. Logging for the minute of 11:23 (9th of March) will be output to <TT>/foo/bar.log</TT> until it is rolled over the next minute.</TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>Do not use the colon &quot;:&quot; character in anywhere in the pattern option. The text before the colon is interpeted as the protocol specificaion of a URL which is probably not what you want.</P>
+
+<P>Note that Scheduled Rotation ignores the <TT>org.apache.sling.commons.log.file.number</TT> property since the old log files are not numbered but &quot;dated&quot;.</P>
+
+
+<H3><A name="Logging-SizeRotation"></A>Size Rotation</H3>
+
+<P>Log file rotation by size is specified by setting the <TT>org.apache.sling.commons.log.file.size</TT> property to a plain number or a number plus a size multiplier. The size multiplier may be any of <TT>K</TT>, <TT>KB</TT>, <TT>M</TT>, <TT>MB</TT>, <TT>G</TT>, or <TT>GB</TT> where the case is ignored and the meaning is probably obvious.</P>
+
+<P>When using Size Rotation, the <TT>org.apache.sling.commons.log.file.number</TT> defines the number of old log file generations to keep. For example to keep 5 old log files indexed by 0 through 4, set the <TT>org.apache.sling.commons.log.file.number</TT> to <TT>5</TT> (which happens to be the default).</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by justinedelson on 2011-09-12 16:57:06.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>
+

Added: websites/staging/sling/trunk/content/site/managing-events.html
==============================================================================
--- websites/staging/sling/trunk/content/site/managing-events.html (added)
+++ websites/staging/sling/trunk/content/site/managing-events.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,332 @@
+
+<!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 - Managing events</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/sling5/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="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"></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="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How-Tos</A>&nbsp;&gt;&nbsp;<A href="" title="Managing events">Managing events</A>
+        </DIV>
+<P>Apache Sling provides some mechanisms and support for managing events. This page describes ...</P>
+
+<P>Sling makes a distinction between 2 types of events:</P>
+<UL>
+	<LI>standard events: no garantee of processing</LI>
+	<LI>job events: garantee of processing. Someone has to do something with the event (do the job).</LI>
+</UL>
+
+
+<P>The event mechanism is leveraging the OSGi Event Admin Specification (OSGi Compendium 113).<BR>
+The OSGi API is very simple and leightweight - sending an event is just generating the event object and calling the event admin. Receiving the event is implementing a single interface and declaring through properties which topics one is interested in. For more details please refer to the following javadocs:</P>
+<UL>
+	<LI>package <A href="http://www.osgi.org/javadoc/r4v42/org/osgi/service/event/package-summary.html" class="external-link" rel="nofollow">org.osgi.service.event</A> of the OSGI API.</LI>
+	<LI>package <A href="http://sling.apache.org/apidocs/sling5/org/apache/sling/event/package-summary.html" class="external-link" rel="nofollow">org.apache.sling.event</A> of the Sling API.</LI>
+</UL>
+
+
+<P>You can learn more in the <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=SLINGxSITE&title=Eventing,%20Jobs%20and%20Scheduling%20section&linkCreation=true&fromPageId=23335037" class="createlink">Eventing, Jobs and Scheduling section</A> (<A href="http://sling.apache.org/site/eventing-and-jobs.html" class="external-link" rel="nofollow">http://sling.apache.org/site/eventing-and-jobs.html</A>).</P>
+
+<P>To get started with the Sling eventing API, you will implement here a service that listens to files posted to <B>/tmp/dropbox</B> and moves them to the appropriate locations depending on the mime-type:</P>
+<UL>
+	<LI>images (.png) are moved to <B>/dropbox/images/</B></LI>
+	<LI>music (.mp3) are moved to <B>/dropbox/music/</B></LI>
+	<LI>movies (.avi) are moved to <B>/dropbox/movies/</B></LI>
+	<LI>otherwise the files are moved to <B>/dropbox/other/</B></LI>
+</UL>
+
+
+<P>To do that, you will implement 2 services. The first one, called <B>OsgiDropBoxService</B>:</P>
+<UL>
+	<LI>listens to osgi event <B>resource added</B></LI>
+	<LI>sends a job event<BR>
+The second one, called <B>DropBoxEventHandler</B>:</LI>
+	<LI>listens to job event <B>file added to /tmp/dropbox</B></LI>
+	<LI>moves the file according to its extension</LI>
+</UL>
+
+
+<H2><A name="Managingevents-ListeningtoOSGIEvents"></A>Listening to OSGI Events</H2>
+
+<P>To listen to the specific osgi event <B>resource added</B>:</P>
+<UL>
+	<LI>The service needs to implement the <B>org.osgi.service.event.EventHandler</B> interface and its <B>handleEvent(Event event)</B> method.</LI>
+	<LI>The property <B>event.topics</B> needs to be set to <B>org.apache.sling.api.SlingConstants.TOPIC_RESOURCE_ADDED</B> in the class annotations.</LI>
+</UL>
+
+
+<P>To get a list of possible events available in Sling (resource added, removed or changed), refer to the <A href="http://sling.apache.org/apidocs/sling5/org/apache/sling/api/SlingConstants.html" class="external-link" rel="nofollow">org.apache.sling.api.SlingConstants</A> class in the Javadocs.</P>
+
+<H2><A name="Managingevents-SendingaJobEvent"></A>Sending a Job Event</H2>
+
+<P>To send a job event:</P>
+<UL>
+	<LI>The service needs to implement the <B>org.apache.sling.event.JobProcessor</B> interface and its <B>process(org.osgi.service.event.Event job)</B> method.</LI>
+</UL>
+
+
+<P>The first part of the code looks as follows:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+/**
+ * The &lt;code&gt;OsgiDropBoxService&lt;/code&gt; is listening content added to /tmp/dropbox by using OSGI events
+ * 
+ * @scr.component  immediate=<SPAN class="code-quote">&quot;<SPAN class="code-keyword">true</SPAN>&quot;</SPAN>
+ * @scr.service <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;org.osgi.service.event.EventHandler&quot;</SPAN>
+ * @scr.property name=<SPAN class="code-quote">&quot;event.topics&quot;</SPAN> valueRef=<SPAN class="code-quote">&quot;org.apache.sling.api.SlingConstants.TOPIC_RESOURCE_ADDED&quot;</SPAN>
+ */
+<SPAN class="code-keyword">public</SPAN> class OsgiDropBoxService <SPAN class="code-keyword">implements</SPAN> JobProcessor, EventHandler {
+</PRE>
+</DIV></DIV>
+
+<P>The Event Admin service is needed to send the job event:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+	/** 
+	 * The OSGI event admin used <SPAN class="code-keyword">for</SPAN> sending events 
+	 * @scr.reference
+	 */
+	<SPAN class="code-keyword">private</SPAN> EventAdmin eventAdmin;
+</PRE>
+</DIV></DIV>
+
+<P>The job topic for dropbox job events needs to be defined:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+    /** The job topic <SPAN class="code-keyword">for</SPAN> dropbox job events. */
+    <SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> <SPAN class="code-keyword">final</SPAN> <SPAN class="code-object">String</SPAN> JOB_TOPIC = <SPAN class="code-quote">&quot;com/sling/eventing/dropbox/job&quot;</SPAN>;
+</PRE>
+</DIV></DIV>
+
+<P>The org.osgi.service.event.EventHandler#handleEvent(Event event) method needs to be implemented:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+	<SPAN class="code-keyword">public</SPAN> void handleEvent(Event event) {
+	    <SPAN class="code-keyword">if</SPAN> (EventUtil.isLocal(event)) {
+	        EventUtil.processJob(event, <SPAN class="code-keyword">this</SPAN>);
+	    }
+	}
+</PRE>
+</DIV></DIV>
+
+<P>The <B>org.apache.sling.event.JobProcessor#process(Event event)</B> method needs to be implemented.</P>
+
+<P>The logic is as follows:</P>
+<UL>
+	<LI>the OSGI event is analyzed</LI>
+	<LI>if the event is a file that has been added to &quot;/tmp/dropbox&quot;:
+	<UL>
+		<LI>an event is created with 2 properties:
+		<UL>
+			<LI>one to flag the event as a job event</LI>
+			<LI>the file path</LI>
+		</UL>
+		</LI>
+		<LI>the job event is sent to all the listeners that subscribe to the topic of the event.</LI>
+	</UL>
+	</LI>
+</UL>
+
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+	<SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">boolean</SPAN> process(Event event) {
+		<SPAN class="code-object">String</SPAN> propPath = (<SPAN class="code-object">String</SPAN>) event.getProperty(SlingConstants.PROPERTY_PATH);
+		<SPAN class="code-object">String</SPAN> propResType = (<SPAN class="code-object">String</SPAN>) event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);
+		<SPAN class="code-comment">// an event is sent <SPAN class="code-keyword">if</SPAN> a file is added to /tmp/dropbox
+</SPAN>		<SPAN class="code-keyword">if</SPAN> (propPath.startsWith(<SPAN class="code-quote">&quot;/tmp/dropbox&quot;</SPAN>) &amp;&amp; propResType.equals(<SPAN class="code-quote">&quot;nt:file&quot;</SPAN>)) {
+    		<SPAN class="code-keyword">final</SPAN> Dictionary&lt;<SPAN class="code-object">String</SPAN>, <SPAN class="code-object">Object</SPAN>&gt; props = <SPAN class="code-keyword">new</SPAN> Hashtable&lt;<SPAN class="code-object">String</SPAN>, <SPAN class="code-object">Object</SPAN>&gt;();
+            props.put(EventUtil.PROPERTY_JOB_TOPIC, JOB_TOPIC);
+    		props.put(<SPAN class="code-quote">&quot;resourcePath&quot;</SPAN>, propPath);
+    		Event dropboxJobEvent = <SPAN class="code-keyword">new</SPAN> Event(EventUtil.TOPIC_JOB, props);
+    		eventAdmin.sendEvent(dropboxJobEvent);
+    		log.info(<SPAN class="code-quote">&quot;the dropbox job has been sent: {}&quot;</SPAN>, propPath);
+		}
+		<SPAN class="code-keyword">return</SPAN> <SPAN class="code-keyword">true</SPAN>;
+	}
+</PRE>
+</DIV></DIV>
+
+<P>The whole service looks now as follows:<BR>
+...</P>
+
+<P>Now that you have a service that sends job events whenever a file is uploaded to <B>/tmp/dropbox</B>, you will create the service <B>DropBoxEventHandler</B> that listens to those job events and moves the files to a location corresponding to their mime-types.</P>
+
+<H2><A name="Managingevents-ListeningtoJobEvents"></A>Listening to Job Events</H2>
+
+<P>To listen to the job events that have been defined before:</P>
+<UL>
+	<LI>The service also needs to implement the <B>org.osgi.service.event.EventHandler</B> interface and its <B>handleEvent(Event event)</B> method.</LI>
+	<LI>The property <B>event.topics</B> needs to be set to <B>com.jck.sling.eventing.osgi.OsgiDropBoxService.JOB_TOPIC</B> in the class annotations.</LI>
+</UL>
+
+
+<P>To move the files:</P>
+<UL>
+	<LI>The service needs to implement the <B>org.apache.sling.event.JobProcessor</B> interface and its <B>process(org.osgi.service.event.Event job)</B> method.</LI>
+</UL>
+
+
+<P>The first part of the code looks as follows:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+/**
+ * @scr.component  immediate=<SPAN class="code-quote">&quot;<SPAN class="code-keyword">true</SPAN>&quot;</SPAN>
+ * @scr.service <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;org.osgi.service.event.EventHandler&quot;</SPAN>
+ * @scr.property name=<SPAN class="code-quote">&quot;event.topics&quot;</SPAN> valueRef=<SPAN class="code-quote">&quot;com.jck.sling.eventing.osgi.OsgiDropBoxService.JOB_TOPIC&quot;</SPAN>
+ */
+
+<SPAN class="code-keyword">public</SPAN> class DropBoxEventHandler <SPAN class="code-keyword">implements</SPAN> JobProcessor, EventHandler {
+</PRE>
+</DIV></DIV>
+
+
+<P>Several class fields are defined:</P>
+<UL>
+	<LI>for logging</LI>
+	<LI>to reference the SlingRepository and the JcrResourceResolverFactory services, which are used in the implementation</LI>
+	<LI>to define the destination path of the files</LI>
+</UL>
+
+
+ <DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+   /** Default log. */
+    <SPAN class="code-keyword">protected</SPAN> <SPAN class="code-keyword">final</SPAN> Logger log = LoggerFactory.getLogger(<SPAN class="code-keyword">this</SPAN>.getClass());
+
+    <SPAN class="code-keyword">private</SPAN> Session adminSession;
+    
+    /** @scr.reference */
+    <SPAN class="code-keyword">private</SPAN> SlingRepository repository;
+    
+    /**
+     * @scr.reference
+     */
+    <SPAN class="code-keyword">private</SPAN> JcrResourceResolverFactory resolverFactory;
+    
+    <SPAN class="code-keyword">private</SPAN> <SPAN class="code-keyword">final</SPAN> <SPAN class="code-keyword">static</SPAN> <SPAN class="code-object">String</SPAN> IMAGES_PATH = <SPAN class="code-quote">&quot;/dropbox/images/&quot;</SPAN>;
+    <SPAN class="code-keyword">private</SPAN> <SPAN class="code-keyword">final</SPAN> <SPAN class="code-keyword">static</SPAN> <SPAN class="code-object">String</SPAN> MUSIC_PATH = <SPAN class="code-quote">&quot;/dropbox/music/&quot;</SPAN>;
+    <SPAN class="code-keyword">private</SPAN> <SPAN class="code-keyword">final</SPAN> <SPAN class="code-keyword">static</SPAN> <SPAN class="code-object">String</SPAN> MOVIES_PATH = <SPAN class="code-quote">&quot;/dropbox/movies/&quot;</SPAN>;
+    <SPAN class="code-keyword">private</SPAN> <SPAN class="code-keyword">final</SPAN> <SPAN class="code-keyword">static</SPAN> <SPAN class="code-object">String</SPAN> OTHER_PATH = <SPAN class="code-quote">&quot;/dropbox/other/&quot;</SPAN>;
+</PRE>
+</DIV></DIV>
+
+<H2><A name="Managingevents-HandlingJobEvents"></A>Handling Job Events</H2>
+
+<P>The <B>org.osgi.service.event.EventHandler#handleEvent(Event event)</B> method needs to be implemented:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+	<SPAN class="code-keyword">public</SPAN> void handleEvent(Event event) {
+	    <SPAN class="code-keyword">if</SPAN> (EventUtil.isLocal(event)) {
+	        EventUtil.processJob(event, <SPAN class="code-keyword">this</SPAN>);
+	    }
+	}
+</PRE>
+</DIV></DIV>
+
+<P>The <B>org.apache.sling.event.JobProcessor#process(Event event)</B> method needs to be implemented.<BR>
+The logic is as follows:</P>
+<UL>
+	<LI>the resource path is extracted from the job event property</LI>
+	<LI>the resource is obtained from the file path</LI>
+	<LI>if the resource is a file, the destination path is defined based on the file mime-type</LI>
+	<LI>the file is moved to the new location</LI>
+</UL>
+
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+	<SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">boolean</SPAN> process(Event event) {
+		<SPAN class="code-keyword">try</SPAN> {
+			<SPAN class="code-object">String</SPAN> resourcePath = (<SPAN class="code-object">String</SPAN>) event.getProperty(<SPAN class="code-quote">&quot;resourcePath&quot;</SPAN>);
+			<SPAN class="code-object">String</SPAN> resourceName = resourcePath.substring(resourcePath.lastIndexOf(<SPAN class="code-quote">&quot;/&quot;</SPAN>) + 1);
+        	adminSession = repository.loginAdministrative(<SPAN class="code-keyword">null</SPAN>);
+	        ResourceResolver resourceResolver = resolverFactory.getResourceResolver(adminSession);
+	        Resource res = resourceResolver.getResource(resourcePath);
+	        <SPAN class="code-keyword">if</SPAN> (ResourceUtil.isA(res, <SPAN class="code-quote">&quot;nt:file&quot;</SPAN>)) {
+	        	<SPAN class="code-object">String</SPAN> mimeType = res.getResourceMetadata().getContentType();
+	        	<SPAN class="code-object">String</SPAN> destDir;
+	        	<SPAN class="code-keyword">if</SPAN> (mimeType.equals(<SPAN class="code-quote">&quot;image/png&quot;</SPAN>)) {
+	        		destDir = IMAGES_PATH;
+	        	}
+	        	<SPAN class="code-keyword">else</SPAN> <SPAN class="code-keyword">if</SPAN> (mimeType.equals(<SPAN class="code-quote">&quot;audio/mpeg&quot;</SPAN>)) {
+	        		destDir = MUSIC_PATH;
+	        	}
+	        	<SPAN class="code-keyword">else</SPAN> <SPAN class="code-keyword">if</SPAN> (mimeType.equals(<SPAN class="code-quote">&quot;video/x-msvideo&quot;</SPAN>)) {
+	        		destDir = MOVIES_PATH;
+	        	}
+	        	<SPAN class="code-keyword">else</SPAN> {
+	        		destDir = OTHER_PATH;
+	        	}
+        		adminSession.move(resourcePath, destDir + resourceName);
+	        	adminSession.save();
+	        	log.info(<SPAN class="code-quote">&quot;The file {} has been moved to {}&quot;</SPAN>, resourceName, destDir);
+	        }
+	        <SPAN class="code-keyword">return</SPAN> <SPAN class="code-keyword">true</SPAN>;
+		} <SPAN class="code-keyword">catch</SPAN> (RepositoryException e) {
+			log.error(<SPAN class="code-quote">&quot;RepositoryException: &quot;</SPAN> + e);
+			<SPAN class="code-keyword">return</SPAN> <SPAN class="code-keyword">false</SPAN>;
+        } <SPAN class="code-keyword">finally</SPAN> {
+            <SPAN class="code-keyword">if</SPAN> (adminSession != <SPAN class="code-keyword">null</SPAN> &amp;&amp; adminSession.isLive()) {
+            	adminSession.logout();
+            	adminSession = <SPAN class="code-keyword">null</SPAN>;
+            }
+        }
+	}
+</PRE>
+</DIV></DIV>
+
+<P>The complete code for the service looks as follows:<BR>
+...</P>
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by jck on Mon Aug 16 08:58:35 EDT 2010
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Added: websites/staging/sling/trunk/content/site/managing-permissions-jackrabbitaccessmanager.html
==============================================================================
--- websites/staging/sling/trunk/content/site/managing-permissions-jackrabbitaccessmanager.html (added)
+++ websites/staging/sling/trunk/content/site/managing-permissions-jackrabbitaccessmanager.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,287 @@
+
+<!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 - Managing permissions (jackrabbit.accessmanager)</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="bundles.html" title="Bundles">Bundles</A>&nbsp;&gt;&nbsp;<A href="" title="Managing permissions (jackrabbit.accessmanager)">Managing permissions (jackrabbit.accessmanager)</A>
+        </DIV>
+<H1><A name="Managingpermissions%28jackrabbit.accessmanager%29-Managingpermissions"></A>Managing permissions</H1>
+
+
+<P>The <TT>jackrabbit-accessmanager</TT> bundle delivers a REST interface to manipulate users permissions in the JCR. After installing the <TT>jackrabbit-accessmanager</TT> bundle the REST services are exposed under the path of the node where you will manipulate the permissions for a user with a specific selector like <TT>modifyAce</TT>, <TT>acl</TT> and <TT>deleteAce</TT>.</P>
+<DIV>
+<UL>
+    <LI><A href="#Managingpermissions%2528jackrabbit.accessmanager%2529-Privileges">Privileges</A></LI>
+    <LI><A href="#Managingpermissions%2528jackrabbit.accessmanager%2529-Addormodifypermissions">Add or modify permissions</A></LI>
+    <LI><A href="#Managingpermissions%2528jackrabbit.accessmanager%2529-Deletepermissions">Delete permissions</A></LI>
+    <LI><A href="#Managingpermissions%2528jackrabbit.accessmanager%2529-Getpermissions">Get permissions</A></LI>
+<UL>
+    <LI><A href="#Managingpermissions%2528jackrabbit.accessmanager%2529-BoundPermissions">Bound Permissions</A></LI>
+    <LI><A href="#Managingpermissions%2528jackrabbit.accessmanager%2529-EffectivePermissions">Effective Permissions</A></LI>
+</UL>
+    <LI><A href="#Managingpermissions%2528jackrabbit.accessmanager%2529-SampleUserInterfaceImplementation">Sample User Interface Implementation</A></LI>
+</UL></DIV>
+
+<H2><A name="Managingpermissions%28jackrabbit.accessmanager%29-Privileges"></A>Privileges</H2>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> privilagename </TH>
+<TH class="confluenceTh"> description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:read </TD>
+<TD class="confluenceTd"> the privilege to retrieve a node and get its properties and their values </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:readAccessControl </TD>
+<TD class="confluenceTd"> the privilege to get the access control policy of a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:modifyProperties </TD>
+<TD class="confluenceTd"> the privilege to create, modify and remove the properties of a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:addChildNodes </TD>
+<TD class="confluenceTd"> the privilege to create child nodes of a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:removeChildNodes </TD>
+<TD class="confluenceTd"> the privilege to remove child nodes of a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:removeNode </TD>
+<TD class="confluenceTd"> the privilege to remove a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:write </TD>
+<TD class="confluenceTd"> an aggregate privilege that contains: jcr:modifyProperties  jcr:addChildNodes  jcr:removeNode  jcr:removeChildNodes </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:modifyAccessControl </TD>
+<TD class="confluenceTd"> the privilege to modify the access control policies of a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:lockManagement </TD>
+<TD class="confluenceTd"> the privilege to lock and unlock a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:versionManagement </TD>
+<TD class="confluenceTd"> the privilege to perform versioning operations on a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:nodeTypeManagement </TD>
+<TD class="confluenceTd"> the privilege to add and remove mixin node types and change the primary node type of a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:retentionManagement </TD>
+<TD class="confluenceTd"> the privilege to perform retention management operations on a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:lifecycleManagement </TD>
+<TD class="confluenceTd"> the privilege to perform lifecycle operations on a node </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> jcr:all </TD>
+<TD class="confluenceTd"> an aggregate privilege that contains all predefined privileges </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<H2><A name="Managingpermissions%28jackrabbit.accessmanager%29-Addormodifypermissions"></A>Add or modify permissions</H2>
+
+<P>To modify the permissions for a node POST a request to <TT>/&lt;path-to-the-node&gt;.modifyAce.&lt;html or json&gt;</TT>. The following parameters are available:</P>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> parameter name <BR class="atl-forced-newline"> </TH>
+<TH class="confluenceTh"> required <BR class="atl-forced-newline"> </TH>
+<TH class="confluenceTh"> description <BR class="atl-forced-newline"> </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> principalId <BR class="atl-forced-newline"> </TD>
+<TD class="confluenceTd"> yes <BR class="atl-forced-newline"> </TD>
+<TD class="confluenceTd"> The name of the user or the group to assign the privileges to<BR class="atl-forced-newline"> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> privilege@&lt;privilege-name&gt;<BR class="atl-forced-newline"> </TD>
+<TD class="confluenceTd"> yes <BR class="atl-forced-newline"> </TD>
+<TD class="confluenceTd"> The privilege which should be updated. See table above for possible &lt;privilege-name&gt; values.  The request may contain several of these parameters to update multiple privileges in a single request.  The parameter value should be one of the following: <BR class="atl-forced-newline">
+<UL>
+	<LI><EM>granted</EM> - Set the privlege as granted to the user or group. <BR class="atl-forced-newline"></LI>
+	<LI><EM>denied</EM> - Set the privilege as denied to the user or group. <BR class="atl-forced-newline"></LI>
+	<LI><EM>none</EM> - Unset a privilege that was previously set as granted or denied. <BR class="atl-forced-newline"></LI>
+</UL>
+</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> order </TD>
+<TD class="confluenceTd"> no </TD>
+<TD class="confluenceTd"> The position where the access control entry should go in the list.  The parameter value should be one of the following: <BR class="atl-forced-newline">
+<UL>
+	<LI><EM>first</EM> - Place the target ACE as the first amongst its siblings. <BR class="atl-forced-newline"></LI>
+	<LI><EM>last</EM> - Place the target ACE as the last amongst its siblings. <BR class="atl-forced-newline"></LI>
+	<LI><EM>before xyz</EM> - Place the target ACE immediately before the sibling whose principalId is xyz. <BR class="atl-forced-newline"></LI>
+	<LI><EM>after xyz</EM> - Place the target ACE immediately after the sibling whose principalId is xyz. <BR class="atl-forced-newline"></LI>
+	<LI><EM>numeric</EM> - Place the target ACE at the specified numeric index.</LI>
+</UL>
+</TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+<P>Responses:</P>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> 200 </TD>
+<TD class="confluenceTd"> Success </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> 500  </TD>
+<TD class="confluenceTd"> Failure, HTML (or JSON) explains failure. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+<P>Example with curl:</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>curl -FprincipalId=myuser -Fprivilege@jcr:read=granted http://localhost:8080/test/node.modifyAce.html
+</PRE>
+</DIV></DIV>
+
+
+<H2><A name="Managingpermissions%28jackrabbit.accessmanager%29-Deletepermissions"></A>Delete permissions</H2>
+
+<P>To delete permissions for a node POST a request to <TT>/&lt;path-to-the-node&gt;.deleteAce.&lt;html or json&gt;</TT>. The following parameters are available:</P>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> parameter name <BR class="atl-forced-newline"> </TH>
+<TH class="confluenceTh"> required <BR class="atl-forced-newline"> </TH>
+<TH class="confluenceTh"> description <BR class="atl-forced-newline"> </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> :applyTo<BR class="atl-forced-newline"> </TD>
+<TD class="confluenceTd"> yes <BR class="atl-forced-newline"> </TD>
+<TD class="confluenceTd"> An array with the name of the users and/or the name of the groups to remove the privileges. <BR class="atl-forced-newline"> </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>Responses:</P>
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> 200 </TD>
+<TD class="confluenceTd"> Success </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> 500  </TD>
+<TD class="confluenceTd"> Failure, HTML (or JSON) explains failure. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+<P>Example with curl:</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>curl -F:applyTo=myuser http://localhost:8080/test/node.deleteAce.html
+</PRE>
+</DIV></DIV>
+
+<H2><A name="Managingpermissions%28jackrabbit.accessmanager%29-Getpermissions"></A>Get permissions</H2>
+
+<H3><A name="Managingpermissions%28jackrabbit.accessmanager%29-BoundPermissions"></A>Bound Permissions</H3>
+
+<P>To get the permissions bound to a particular node in a json format for a node send a GET request to <TT>/&lt;path-to-the-node&gt;.acl.json</TT>. </P>
+
+<P>Example:</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>http://localhost:8080/test/node.acl.json
+</PRE>
+</DIV></DIV>
+
+<H3><A name="Managingpermissions%28jackrabbit.accessmanager%29-EffectivePermissions"></A>Effective Permissions</H3>
+
+<P>To get the permissions which are effective for a particular node in a json format for a node send a GET request to <TT>/&lt;path-to-the-node&gt;.eacl.json</TT>. </P>
+
+<P>Example:</P>
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>http://localhost:8080/test/node.eacl.json
+</PRE>
+</DIV></DIV>
+
+<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>See section 16.3 of the JCR 2.0 specification for an explanation of the difference between bound and effective policies.</TD></TR></TABLE></DIV>
+
+
+<H2><A name="Managingpermissions%28jackrabbit.accessmanager%29-SampleUserInterfaceImplementation"></A>Sample User Interface Implementation</H2>
+
+<P><EM>Since Version 2.1.1</EM></P>
+
+<P>A sample implementation of ui pages for permissions management is provided @ <A href="http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/" class="external-link" rel="nofollow">http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/</A></P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by edn on 2011-05-05 23:30:30.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>
+