This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • GSoC 2010 mini-CMS project
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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/.

Some words about David Mini CMS

This project shows some features of Apache Sling and can be used for educational purpose to move your first steps with this framework.

David uses the following opensource library/technologies:

 

The available features are

  • CRUD (Create, Read, Update and Delete) for the content
  • Full HTML creation of article
  • Creation of PDF rappresentation of a single post or the entire list of contents available
  • Tagging system
  • Search by title,text,tag
  • Send email to someone with the link of article
  • Background service that checks number of articles/tags in the repository

These aren't space age features, but are useful to understand how to create an application using Apache Sling

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:

  • cURL : Command line tool to send HTTP request
  • JCR Explorer : Extension that create a useful explorer for the JCR repository you are working in
  • BitKinex : FTP/SFTP/HTTP/WebDAV Client that can be used to manage the files you uploaded in Sling

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: 

  • ESP
  • JSP
  • Java Servlet
  • Scala
  • Python
  • Groovy
  • Ruby

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:

  • No labels