CQ5 and Sling overview

16,573 views

Published on

Quick overview of CQ5 and Sling for an informal developers meeting

Published in: Technology

CQ5 and Sling overview

  1. 1. cq5 and Sling overview Bertrand Delacrétaz Senior Developer, R&D, Day Software, www.day.com Apache Software Foundation Member http://grep.codeconsult.ch - twitter: @bdelacretaz - bdelacretaz@apache.org Logica Geneva monthly developer meeting, February 2010 slides revision: 2010-02-25 CQ5 and Sling 1 overview Bertrand Delacrétaz
  2. 2. Basel, Switzerland headquarters (~80 people, ~150 worldwide) Munich “Day allows us to quickly London and reliably deliver content to our entire McFamily, content-centric helping us to be flexible and drive new opportunities.” products Newport Beach, CA Steve Wilson, Senior Director of Web Toronto Communications, McDonald’s (everything is content) www.day.com Swiss open source award / business / 2008 note the 3-letter domain name: we’ve been doing this for a while... Strong ties to the Apache Software Foundation 2001 2001 2009 Roy T. Fielding and David Nuescheler, Survived tough times (SWX:DAYN) “Mr. REST” and “Mr. JCR”
  3. 3. What is cq5? content management system no database? No SQL? everything is content fun to use digital assets OSGi applications framework JCR repository Marketing dept. loves IT dept.? CQ5 and Sling overview
  4. 4. cq5: welcome
  5. 5. cq5: content tree
  6. 6. cq5: page editing
  7. 7. cq5: visual workflow
  8. 8. cq5: multivariate testing User provides 3 (N) possible banner designs (drag & drop) cq5 provides statistics on impressions and click- through rates -> helps selecting the best banner.
  9. 9. cq5: zero-install IDE
  10. 10. content structures no database? No SQL? everything is content JCR repository CQ5 and Sling overview
  11. 11. geometrixx page content /content /geometrixx /en /company /jcr:content /par /title
  12. 12. blog design content /etc/designs/blog/kubrick/jcr:content
  13. 13. code content! /libs /cq /code /install /xyz.jar
  14. 14. dynamic java modules (OSGi)
  15. 15. Apache Sling Apache Software Foundation open source script == servlet open development Applications layer for JCR repositories OSGi-based
  16. 16. HTTP debugger filesystem browser content administration UI standard custom servlets WebDAV Sling OSGi servlets and components server console javascript JSP resource servlet/script JSR 223 Ruby resolution resolution scripting Velocity etc.. Apache Sling framework OSGi framework (Apache Felix) JSR-170 API JCR content CQ5/Sling repository storage components architecture
  17. 17. HTTP debugger filesystem browser content administration UI standard custom servlets WebDAV Sling OSGi servlets and components server console javascript JSP resource servlet/script JSR 223 Ruby resolution resolution scripting Velocity etc.. OSGi framework (Apache Felix) JSR-170 API JCR open source? repository storage components you bet!
  18. 18. OSGi? 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 CQ5 and Sling overview Bertrand Delacrétaz
  19. 19. Sling blog 46 lines of code
  20. 20. Sling POST servlet # POST to Sling curl -F title=hi http://localhost:8888/foo -> 200 OK # GET created node in json format curl http://localhost:8888/foo.tidy.json { "jcr:primaryType": "nt:unstructured", "title": "hi" } POST ters se t e param operties node pr CQ5 and Sling 20 overview Bertrand Delacrétaz
  21. 21. 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 e fields dri ve th model CQ5 and Sling ontent 21 overview c Bertrand Delacrétaz
  22. 22. 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> t CRU(D) Instan CQ5 and Sling 22 overview Bertrand Delacrétaz
  23. 23. 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> CQ5 and Sling 23 overview Bertrand Delacrétaz
  24. 24. we’ve got a blog! html form + Sling wizard() + Sling.getContent()
  25. 25. more info? www.day.com/cq5 www.day.com/crx (free download) sling.apache.org jackrabbit.apache.org felix.apache.org slideshare.net/bdelacretaz CQ5 and Sling overview Bertrand Delacrétaz
  26. 26. This slide deck is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3 license. Copyright (C) 2010, Bertrand Delacretaz

×