Overview (from SLING-1438)

This is a Google Summer of Code 2010, Federico Paparoni has been accepted as a student to work on it, mentored by Bertrand Delacretaz

The goal is to create a mini-CMS with Sling, that demonstrates Sling best practices.

See http://tinyurl.com/asfgsoc for the full list of GSoC 2010 projects at the ASF, and http://community.apache.org/gsoc for general GSoC information.

Introduction

Apache Sling is an opensource project with a lot of technologies and features. The goal of this project is to create a mini-CMS, that developers can use to understand how to develop a simple application with Sling. 

So it is necessary to know a little about two main topics: OSGi and JCR. The following links are useful resources to read something about these technologies.

OSGi

JCR

The repository for this project can be found at http://code.google.com/p/davidgsoc2010/.

First steps into Sling

Firstly you must setup the environment for Sling, so you can follow the guide at http://sling.apache.org/site/getting-and-building-sling.html.

Now that you created your environment, you can setup some other tools that can be useful during the development:

It's time to make our "Hello world" in Apache Sling. 
Open a console and simply launch the next command:

curl -F"sling:resourceType=foo/bar" -F"title=Hello world" http://admin:admin@localhost:8080/content/myfirstnode

curl -F"sling:resourceType=foo/bar" -F"title=Hello world" http://admin:admin@localhost:8080/content/myfirstnode

This is a simple HTTP request, where you pass some parameters and values. Using it you have created a first resource under Sling. 
The resource is a JCR node, as every resource in Sling, put under folder /content. This node has two parameters, title and sling:resourceType. 

Node creation is a simple task, but you must understand how you can render the information stored in the nodes using Sling.
The first document you can read is the next one: http://dev.day.com/content/ddc/blog/2008/07/cheatsheet/_jcr_content/par/download/file.res/cheatsheet.pdf
It simply describes how content resolution works in Sling. 

Another important information to better understand Sling, is that a resource is rendered by a script.
Script files are stored under the folders /apps or /libs and there is a wide choice of possible scripting engine: 

To select a script, Sling uses the node's sling:resourceType property. So if we say that sling:resourceType is foo/bar, Sling will search under the /apps/foo/bar/ folder.
The following links describes how the scripts work and what type of variables we have during the script execution: