Taming Jcr With Sling

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites

    Taming Jcr With Sling - Presentation Transcript

    1. Taming content repositories with Apache Sling Bertrand Delacrétaz, Senior R&D Developer Michael Marth, Technology Evangelist Day Software, www.day.com OpenExpo 2008, Winterthur, September 25th Slides revision: 2008-09-24 Slides design: David Nuescheler Technology Presentation 1 mercredi, 24 septembre 2008 1
    2. Taming Content Repositories Web Development The Web vs. JCR - Intro Blog in 15 minutes silve r So what? mercredi, 24 septembre 2008 2
    3. Intro to JCR JCR = Java Content Repository API JSR-170 / JSR283 - silve r Everything Is Content - and JCR manages it as trees of Nodes and Properties, using rich data types. mercredi, 24 septembre 2008 3
    4. What’s JCR? gpoJNTM `çåíÉåí=oÉéçëáíçêó=Ñçê= g~î~qj=íÉÅÜåçäçÖó=^mf péÉÅJiÉ~ÇW a~ó=pçÑíï~êÉ pí~íìëW= cáå~ä=oÉäÉ~ëÉ=NTJàìåJOMMR bñéÉêí=dêçìéW mercredi, 24 septembre 2008 4
    5. What’s JCR? gpoJNTM gpoJOUP `çåíÉåí=oÉéçëáíçêó=Ñçê= g~î~qj=íÉÅÜåçäçÖó=^mf=îOKM péÉÅJiÉ~ÇW a~ó=pçÑíï~êÉ pí~íìëW= mìÄäáÅ=oÉîáÉï=`äçëÉÇ=ëÉéJOMMT bñéÉêí=dêçìéW mercredi, 24 septembre 2008 5
    6. What’s JCR? “The API should be a standard, implementation independent, way to access content bi-directionally on a granular level to a content repository.” ? mercredi, 24 septembre 2008 6
    7. Best of both worlds. data base file s ys t e m hier- integ archi rity structu re es read streams tx write access query locking control multi- value un-structured obser- versioning “full-text” sort vation order content repo sit or y mercredi, 24 septembre 2008 7
    8. Known compliant Repositories * using third party connector * * Exo Microsoft Apache Jackrabbit Oracle XML DB ECMS Platform Sharepoint OpenText Livelink * Day CRX IBM FileNet P8 Xythos Repository Alfresco ECM Vignette V7 * * any ors ow mvendd? H S e Interwoven +hund DBMou ne R do y r s Repository IBM CM EMC Documentum regiede of TCKs st red mercredi, 24 septembre 2008 8
    9. Some known JCR Applications Fast BEA Portal Sun Oracle Portal Enterprise Search JBoss Portal Interface 21 OpenPortal Day Communique Spring Framework magnolia WCMS DAM Apache Sling Day Communique Alfresco ECMS Mindquarry Collab Collaboration Apache Tapestry QSLabs Apache Compliance Day Communiqué Cocoon WCMS IBM FileNet Artifactory medic-2-medic WebSiteManager Apache James Maven Proxy mapofmedicine Exo ECMS Platform TYPO3 GX WebManager v5.0 WCM InfoQ Hippo Liferay Nuxeo ECM Online Community CMS Enterprise Portal Jahia Sakai Percussion Framework E-learning Rhythmix QuickWCM Sourcemix WCMS Lutece Sourcemix mercredi, 24 septembre 2008 Portal 9
    10. JCR code excerpt Repository repository = new TransientRepository(); Session session = repository.login(...); / Create content / Node root = session.getRootNode(); Node hello = root.addNode(\"hello\"); Node world = hello.addNode(\"world\"); world.setProperty(\"message\", \"Hello, World!\"); session.save(); / Retrieve content / Node node = root.getNode(\"hello/world\"); print(node.getPath()); print(node.getProperty(\"message\").getString()); mercredi, 24 septembre 2008 10
    11. Sling builds on top of JCR Scriptable applications layer on top of JCR OSGi-based industrial-strength framework Simple, powerful, JCR inside Runs on Apache Jackrabbit by default http:/ /incubator.apache.org/sling mercredi, 24 septembre 2008 11
    12. REST over JCR REST -> Roy T. Fielding scheler JCR: David Nue 2005 rele a 1.0 r v ele ased sed y 162 p 2k +300 pages ages mercredi, 24 septembre 2008 12
    13. Reclaiming the web. Sling URL decomposition. /cars/audi/s4.details.html Content ...selects a Repository epository Path R particular scrip t mercredi, 24 septembre 2008 13
    14. Sling architecture HTTP debugger filesystem browser standard custom servlets WebDAV Sling OSGi servlets and components server console javascript resource servlet/script OSGi bundles JSR 223 JSP Ruby resolution resolution scripting OSGi framework Velocity etc.. (Apache Felix) OSGi webapp JSR-170 API JCR repository mercredi, 24 septembre 2008 14
    15. A Sling-based blog 282 lines of code 100% scripted, no tools required besides Sling Simple, modular code structure Promotes RESTful thinking mercredi, 24 septembre 2008 15
    16. Sling blog scripts admin.esp 56 lines - admin page (.admin.html) header.esp 7 lines - <head> generation (sling.include) html.esp 75 lines - html rendering of a post (.html) list.esp 60 lines - list of posts (.list.html) menu.esp 18 lines - home/admin/new (sling.include) post.esp 39 lines - “new post” page (.post.html) xml.esp 27 lines - RSS feed (.xml) TOTAL 282 lines (including whitespace/comments) mercredi, 24 septembre 2008 16
    17. Creating content (post.esp) <form method=\"POST\" action=\"/content/myblog/posts/*\"> <p><label>Title</label> <input name=\"title\" type=\"text\"/></p> <p><p><label>Body</label> <textarea name=\"posttext\" cols=\"40\" rows=\"5\"> <input name=\":redirect\" type=\"hidden\" value=\"/content/myblog/posts.admin.html\"/> <input type=\"submit\" value=\"Post\"> </form> mercredi, 24 septembre 2008 17
    18. Rendering content (html.esp) <html> <% sling.include(\"/content/myblog.header.html\") %> <body> <h2> <%=currentNode.title %> </h2> <% var a = currentNode.getNode(\"attachments\").getNodes() ; for(i in a) { var attachmentNode = a[i]; ... %> } </body> </html> mercredi, 24 septembre 2008 18
    19. Sling blog demo mercredi, 24 septembre 2008 19
    20. Can I have fries with that? How do we add functionality that is not easily scriptable? Example: thumbnails generated in Java code, by observing the repository for new files. mercredi, 24 septembre 2008 20
    21. JCR observation String[] nodeTypes = { \"nt:file\" }; boolean isDeep = true; observationManager.addEventListener( this, Event.NODE_ADDED | Event.NODE_REMOVED, \"/content/myblog/posts\", isDeep, ...types); ... public void onEvent( EventIterator eventIterator) { ... } mercredi, 24 septembre 2008 21
    22. Thumbnails bundle demo mercredi, 24 septembre 2008 22
    23. Conclusions JCR rocks - and everything is content! Sling makes JCR easy and fun. A good JCR content model is key. Join the fun at incubator.apache.org/sling! mercredi, 24 septembre 2008 23

    + bdelacretazbdelacretaz, 2 years ago

    custom

    2901 views, 2 favs, 3 embeds more stats

    Slides of our talk at http://www.openexpo.ch, Septe more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 2901
      • 2671 on SlideShare
      • 230 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 36
    Most viewed embeds
    • 223 views on http://dev.day.com
    • 5 views on http://grep.codeconsult.ch
    • 2 views on http://alm.handysoft.co.kr

    more

    All embeds
    • 223 views on http://dev.day.com
    • 5 views on http://grep.codeconsult.ch
    • 2 views on http://alm.handysoft.co.kr

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags