26
CQ5 and Sling overview Bertrand Delacrétaz Bertrand Delacrétaz Senior Developer, R&D, Day Software, www.day.com Apache Software Foundation Member http://grep.codeconsult.ch - twitter: @bdelacretaz - [email protected] Logica Geneva monthly developer meeting, February 2010 slides revision: 2010-02-25 1 cq5 and Sling overview

CQ5 and Sling overview

Embed Size (px)

DESCRIPTION

Quick overview of CQ5 and Sling for an informal developers meeting

Citation preview

Page 1: CQ5 and Sling overview

CQ5 and Slingoverview Bertrand Delacrétaz

Bertrand DelacrétazSenior Developer, R&D, Day Software, www.day.com

Apache Software Foundation Memberhttp://grep.codeconsult.ch - twitter: @bdelacretaz - [email protected]

Logica Geneva monthly developer meeting, February 2010

slides revision: 2010-02-25

1

cq5 and Slingoverview

Page 2: CQ5 and Sling overview

Basel, Switzerland headquarters(~80 people, ~150 worldwide)

Munich

London

NewportBeach, CA

Toronto

Survived tough times (SWX:DAYN)Roy T. Fielding and David Nuescheler,

“Mr. REST” and “Mr. JCR”

“Day allows us to quickly and reliably deliver content to our entire McFamily, helping us to be flexible and drive new opportunities.”

Steve Wilson, Senior Director of Web Communications, McDonald’s

Strong ties to the Apache Software Foundation

(everything is content)

content-centricproducts

www.day.comnote the 3-letter domain name: we’ve been doing this for a while...

Swiss open sourceaward / business / 2008

2001

2009

2001

Page 3: CQ5 and Sling overview

CQ5 and Slingoverview

Whatis cq5?

content management system

JCR repository

OSGi applications framework

everything is contentno database? No SQL?fun to use

Marketing dept. loves IT dept.?

digital assets

Page 4: CQ5 and Sling overview

cq5: welcome

Page 5: CQ5 and Sling overview

cq5: content tree

Page 6: CQ5 and Sling overview

cq5: page editing

Page 7: CQ5 and Sling overview

cq5: visual workflow

Page 8: CQ5 and Sling overview

cq5: multivariate testing

User provides 3 (N) possiblebanner designs (drag & drop)

cq5 provides statistics on impressions and click-through rates -> helps selecting the best banner.

Page 9: CQ5 and Sling overview

cq5: zero-install IDE

Page 10: CQ5 and Sling overview

CQ5 and Slingoverview

contentstructures

JCR repository

everything is contentno database? No SQL?

Page 11: CQ5 and Sling overview

geometrixx page content /content /geometrixx /en /company /jcr:content /par /title

Page 12: CQ5 and Sling overview

blog design content

/etc/designs/blog/kubrick/jcr:content

Page 13: CQ5 and Sling overview

code content!

/libs /cq /code /install /xyz.jar

Page 14: CQ5 and Sling overview

dynamic java modules (OSGi)

Page 15: CQ5 and Sling overview

ApacheSling

Applications layer for JCR repositories

open sourceApache Software Foundation

open developmentscript == servletOSGi-based

Page 16: CQ5 and Sling overview

storagecomponents

OSGi framework(Apache Felix)

JCRcontent

repository

javascript

JSPRuby

Velocityetc..

debugger

WebDAVserver

Sling OSGiconsole

browserfilesystem

JSR-170 API

HTTP

resource resolution

custom servletsand components

JSR 223 scripting

servlet/script resolution

standardservlets

content administration UI

CQ5/Slingarchitecture

Apache Sling framework

Page 17: CQ5 and Sling overview

OSGi framework(Apache Felix)

JCRrepository

javascript

JSPRuby

Velocityetc..

debugger

WebDAVserver

Sling OSGiconsole

browserfilesystem

JSR-170 API

resource resolution

JSR 223 scripting

servlet/script resolution

standardservlets

storagecomponents

custom servletsand components

content administration UI

HTTP

open source?you bet!

Page 18: CQ5 and Sling overview

CQ5 and Slingoverview Bertrand Delacrétaz

OSGi is great for modularity

Fosters better structured code

Dynamic services and plugins

Tooling needs to improve, but usable

OSGi skills? - OSGi way of thinking is new...

Asynchronous startup can be problematic if using declarative services

OSGi?

Page 19: CQ5 and Sling overview

Sling blog46 lines of code

Page 20: CQ5 and Sling overview

CQ5 and Slingoverview Bertrand Delacrétaz

Sling POST servlet# POST to Slingcurl -F title=hi http://localhost:8888/foo-> 200 OK

# GET created node in json formatcurl http://localhost:8888/foo.tidy.json{ "jcr:primaryType": "nt:unstructured", "title": "hi"}

POST parameters set

node properties

20

Page 21: CQ5 and Sling overview

CQ5 and Slingoverview Bertrand Delacrétaz

blog step 1: create content<form method="POST">

Title:

<input type="text" name="title"/>

Text:

<textarea name="text"></textarea>

<input type="submit" value="save"/>

<input type="hidden"

name=":redirect" value="*"/>

</form>Form fields

drive the

content model 21

Page 22: CQ5 and Sling overview

CQ5 and Slingoverview Bertrand Delacrétaz

blog step 2: retrieve content<script src="/system/sling.js"></script> <form method="POST"> ...(as in step 1)...</form>

<!-- set form fields to current node values --><script>Sling.wizard();</script>

Instant CRU(D)

22

Page 23: CQ5 and Sling overview

CQ5 and Slingoverview Bertrand Delacrétaz

blog step 3: navigation<ul>

<li>

<a href="/content/blog/*">[Create post]</a> </li>

<script>

var posts = Sling.getContent("/content/blog", 2); for(var post in posts) {

document.write(

"<li><a href=’” + post + "'>"

+ posts[post].title + "</a></li>");}

</script>

</ul>

23

Page 24: CQ5 and Sling overview

we’ve got a blog!html form + Sling wizard() + Sling.getContent()

Page 25: CQ5 and Sling overview

CQ5 and Slingoverview Bertrand Delacrétaz

more info?www.day.com/cq5www.day.com/crx (free download)sling.apache.orgjackrabbit.apache.orgfelix.apache.orgslideshare.net/bdelacretaz

Page 26: CQ5 and Sling overview

This slide deck is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3 license.

Copyright (C) 2010, Bertrand Delacretaz