SlideShare a Scribd company logo
1 of 57
Rapid JCR applications development
                with Apache Sling
      Bertrand Delacrétaz
      Senior R&D Developer, Day Software, www.day.com
      Member and Director, ASF
      bdelacretaz@apache.org
      blog at http:/
                   /grep.codeconsult.ch
      twitter: @bdelacretaz


      Slides revision: 2009-03- 20
      Slides theme design: David Nuescheler



Wednesday, March 25, 2009
Rapid JCR applications development
                with Apache Sling
      Bertrand Delacrétaz
      Senior R&D Developer, Day Software, www.day.com
      Member and Director, ASF
      bdelacretaz@apache.org
      blog at http:/
                   /grep.codeconsult.ch
      twitter: @bdelacretaz


      Slides revision: 2009-03- 20
      Slides theme design: David Nuescheler

                              is thi
                            busy s slide
                                  enou
                                      gh?
Wednesday, March 25, 2009
Intro to JCR
                        JCR = Java Content Repository API
                        JSR-170 / JSR283
                                     -
                        Everything Is Content - and JCR manages it as
                        trees of Nodes and Properties, using rich data
                        types.




Wednesday, March 25, 2009
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.




Wednesday, March 25, 2009
What’s JCR?
                            JSR-170

                  Content Repository for
                  JavaTM technology API
                  Spec-Lead:
                  Day Software
                  Status:
                  Final Release 17-jun-2005


                  Expert Group:




Wednesday, March 25, 2009
What’s JCR?
                            JSR-170   JSR-283

                  Content Repository for
                  JavaTM technology API v2.0
                  Spec-Lead:
                  Day Software
                  Status:
                  Public Review Closed sep-2007


                  Expert Group:




Wednesday, March 25, 2009
Wednesday, March 25, 2009
What’s JCR?




Wednesday, March 25, 2009
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.”

Wednesday, March 25, 2009
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.” ?

Wednesday, March 25, 2009
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.” ?

Wednesday, March 25, 2009
Best of both worlds.
                                                 data base                   file s ys t e m
                                                                                      hier-
                                                                                    archi
                                     integ
                                          rity                 re                        es
                                                        structu
                                                                      read                    streams


                                     tx                             write                       access
                                                      query                         locking    control



                            multi-
                            value
                                                                                                    ning
                                                                                  obser-      versio
                                      un-structured
                                                      “full-text”   sort          vation
                                                                    order

                                                              content repo sit or y
Wednesday, March 25, 2009
Best of both worlds.
                                                 data base                   file s ys t e m
                                                                                      hier-
                                                                                    archi
                                     integ
                                          rity                 re                        es
                                                        structu
                                                                      read                    streams


                                     tx                             write                       access
                                                      query                         locking    control



                            multi-
                            value
                                                                                                    ning
                                                                                  obser-      versio
                                      un-structured
                                                      “full-text”   sort          vation
                                                                    order

                                                              content repo sit or y
Wednesday, March 25, 2009
Known compliant Repositories




Wednesday, March 25, 2009
Known compliant Repositories
                                                                       * using third party connector

                                                                              *                  *

           Apache                                    Exo          Microsoft          OpenText
         Jackrabbit             Oracle XML DB    ECMS Platform   Sharepoint           Livelink

                                                                                                 *

                                                    Xythos
           Day CRX              IBM FileNet P8    Repository     Alfresco ECM       Vignette V7

                            *                              *
                                                                                             any ors
                                                                                        ow mvendd?
                                                                                       H S e
                                                                 +hun
                                                                      dre              DBMou ne
                                                                                      R do y
         Interwoven                                  EMC            TCKsds of
                                                                 regis
         Repository                IBM CM        Documentum           tered
Wednesday, March 25, 2009
Some known JCR Applications




Wednesday, March 25, 2009
Some known JCR Applications

                                                                                 Fast
                                                                            Enterprise
           BEA Portal     Sun                        Oracle Portal Interface 21Search
                      OpenPortal     JBoss Portal      Day            Spring
                                                 Communique        Framework
                                                      DAM                      Day
           magnolia WCMS        Apache Sling                              Communique
                      Alfresco ECMS             Mindquarry            ApacheCollab
                                              Collaboration          Tapestry
                           QSLabs              Day
           Apache       Compliance       Communiqué                           IBM FileNet
           Cocoon                             WCMS
                                      Artifactory         medic-2-medic WebSiteManage
                                                                                    r
                 Apache James        Maven Proxy         mapofmedicine
                                 Exo
                GX          ECMS Platform            TYPO3
           WebManager                              v5.0 WCM
                                       InfoQ                                      Liferay
                                      Online              Hippo                 Enterprise
                    Nuxeo ECM      Community               CMS                    Portal
                                                  Jahia               Sakai
             Percussion                       Framework            E-learning
              Rhythmix           QuickWCM                                  Sourcemix
                                  WCMS                  Lutece             Sourcemix
                                                        Portal
Wednesday, March 25, 2009
Some known JCR Applications

                                                                                 Fast
                                                                            Enterprise
           BEA Portal     Sun                        Oracle Portal Interface 21Search
                      OpenPortal     JBoss Portal      Day            Spring
                                                 Communique        Framework
                                                      DAM                      Day
           magnolia WCMS        Apache Sling                              Communique
                      Alfresco ECMS             Mindquarry            ApacheCollab
                                              Collaboration          Tapestry
                           QSLabs              Day
           Apache       Compliance       Communiqué                           IBM FileNet
           Cocoon                             WCMS
                                      Artifactory         medic-2-medic WebSiteManage
                                                                                    r
                 Apache James        Maven Proxy         mapofmedicine
                                 Exo
                GX          ECMS Platform            TYPO3
           WebManager                              v5.0 WCM
                                       InfoQ                                      Liferay
                                      Online              Hippo                 Enterprise
                    Nuxeo ECM      Community               CMS                    Portal
                                                  Jahia               Sakai
             Percussion                       Framework            E-learning
              Rhythmix           QuickWCM                                  Sourcemix
                                  WCMS                  Lutece             Sourcemix
                                                        Portal
Wednesday, March 25, 2009
JCR code excerpt
          Repository repository = new TransientRepository();
          Session session = repository.login(...);
          / Create content
          /
          Node root = session.getRootNode();
          Node hello = root.addNode(quot;helloquot;);
          Node world = hello.addNode(quot;worldquot;);
          world.setProperty(quot;messagequot;, quot;Hello, World!quot;);
          session.save();
          / Retrieve content
           /
          Node node = root.getNode(quot;hello/worldquot;);
          print(node.getPath());
          print(node.getProperty(quot;messagequot;).getString());
Wednesday, March 25, 2009
On to Sling

Wednesday, March 25, 2009
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

Wednesday, March 25, 2009
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
                                          join t
                                                 he
                                           fun!
Wednesday, March 25, 2009
Sling == REST over JCR




Wednesday, March 25, 2009
Sling == 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



Wednesday, March 25, 2009
Reclaiming the web.
                            Sling URL decomposition.
                            /cars/audi/s4.details.html




Wednesday, March 25, 2009
Reclaiming the web.
                            Sling URL decomposition.
                            /cars/audi/s4.details.html

  Repository




Wednesday, March 25, 2009
Reclaiming the web.
                            Sling URL decomposition.
                            /cars/audi/s4.details.html

                Content
  Repository epository Path
           R




Wednesday, March 25, 2009
Reclaiming the web.
                            Sling URL decomposition.
                            /cars/audi/s4.details.html

                Content
  Repository epository Path
           R




Wednesday, March 25, 2009
Reclaiming the web.
                            Sling URL decomposition.
                            /cars/audi/s4.details.html

                Content                      ...selects a
  Repository epository Path
           R                              particular scrip
                                                          t




Wednesday, March 25, 2009
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




Wednesday, March 25, 2009
Sling architecture
                       HTTP      sling.js                         debugger      filesystem      browser
                                  utilit y
        POST,                                                                             V
       json GE
              T                                                                     WebDA
                                                                                     access
                     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              ESP
                                                 de
                                      se r ver-si t
                                                ip       JSR-170 API
                                       javascr


                                                            JCR
                                                         repository




Wednesday, March 25, 2009
A minimalone .esp script blog
                     Consisting of
                                   Sling
                            cat /Volumes/localhost/apps/blog/blog.esp | wc -l
                                                  54




Wednesday, March 25, 2009
from
                                                                              e code :
                                                                       ge t th ay.com
                                                                           dev.d url.com/
                                                                              /tiny 6
                                                                       ht tp:/ gblog4
                                                                             slin



                  A minimalone .esp script blog
                     Consisting of
                                   Sling
                            cat /Volumes/localhost/apps/blog/blog.esp | wc -l
                                                  54




Wednesday, March 25, 2009
Sling POST servlet
                 # POST to Sling
                 curl -F title=hello http://localhost:8888/foo
                 -> 200 OK

                 # GET created node in json format
                 curl http:/ /localhost:8888/foo.tidy.json
                 {
                   quot;jcr:primaryTypequot;: quot;nt:unstructuredquot;,
                   quot;titlequot;: quot;helloquot;
                 }




Wednesday, March 25, 2009
Sling POST servlet
                 # POST to Sling
                 curl -F title=hello http://localhost:8888/foo
                 -> 200 OK
                                                                 POST se t
                                                                    e ters s
                 # GET created node in json format           param opertie
                 curl http:/ /localhost:8888/foo.tidy.json    node pr
                 {
                   quot;jcr:primaryTypequot;: quot;nt:unstructuredquot;,
                   quot;titlequot;: quot;helloquot;
                 }




Wednesday, March 25, 2009
blog step 1: create content
             !        <form method=quot;POSTquot;>
             !          Title:
             !          <input type=quot;textquot; name=quot;titlequot; style=quot;width:100%quot;/>
             !
             !              Text:
             !              <textarea style=quot;width:100%quot; name=quot;textquot;></textarea>
             !
             !              <input type=quot;submitquot; value=quot;savequot;/>
             !
             !          <input type=quot;hiddenquot; name=quot;:redirectquot; value=quot;*quot;/>
             !        </form>




Wednesday, March 25, 2009
blog step 1: create content
             !        <form method=quot;POSTquot;>
             !          Title:
             !          <input type=quot;textquot; name=quot;titlequot; style=quot;width:100%quot;/>
             !
             !              Text:
             !              <textarea style=quot;width:100%quot; name=quot;textquot;></textarea>
             !
             !              <input type=quot;submitquot; value=quot;savequot;/>
             !
             !          <input type=quot;hiddenquot; name=quot;:redirectquot; value=quot;*quot;/>
             !        </form>
                                                                    dri ve
                                                              fields t
                                                         Form onten
                                                            the c el
                                                                mod
Wednesday, March 25, 2009
blog step 2: retrieve content
          <script src=quot;/system/sling.jsquot;></script>!
          <form method=quot;POSTquot;>
          ...
          </form>

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




Wednesday, March 25, 2009
blog step 2: retrieve content
          <script src=quot;/system/sling.jsquot;></script>!
          <form method=quot;POSTquot;>
          ...
          </form>

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




                                                          U(D)
                                               Inst ant CR


Wednesday, March 25, 2009
blog step 3: navigation
                   <ul>
                       <li>
                          <a href=quot;/content/blog/*quot;>
                          [Create new post]</a>
                       </li>
          !          <script>
          !             var posts = Sling.getContent(quot;/content/blogquot;, 2);
          !             for(var post in posts) {
          !             ! document.write(
                            quot;<li><a href=’” + post + quot;'>quot;
                            + posts[post].title + quot;</a></li>quot;);
          !             }
          !          </script>
                   </ul>
Wednesday, March 25, 2009
we got a blog!
                  html form + Sling.wizard() + Sling.getContent()




Wednesday, March 25, 2009
The ESP blog sample
                              ESP scripting + java + javascript
                       OSGi bundle, initial content, WebDAV, observation, RAD




Wednesday, March 25, 2009
The ESP blog sample
                              ESP scripting + java + javascript
                       OSGi bundle, initial content, WebDAV, observation, RAD




                                                                                     mples
                                                                                ng/sa /
                                                                         der sli rl.com
                                                                   de un inyu
                                                                Co
                                                                    ht tp:/ t logesp
                                                                          /
                                                                         slingb
Wednesday, March 25, 2009
ESP blog in action
                                 create



                                 retrieve
                                             thumbnails


                                 update

Wednesday, March 25, 2009
ESPblog demo

Wednesday, March 25, 2009
ESP blog source files
        admin.esp                pom.xml
        edit.esp                 ThumbnailGeneratorService.java
        html.esp                 ThumbnailGeneratorServiceImpl.java
        list.esp
                                 espblog.css
        menu.esp
                                 sling-logo.png
        xml.esp (RSS feed)
        constants.esp
        header.esp


Wednesday, March 25, 2009
ESP blog source files
        admin.esp                pom.xml
        edit.esp                 ThumbnailGeneratorService.java
        html.esp                 ThumbnailGeneratorServiceImpl.java
        list.esp
                                 espblog.css
        menu.esp
                                 sling-logo.png
        xml.esp (RSS feed)
        constants.esp                                source
                                               log re s to
                                          espb oint
        header.esp                          t ype p ripts
                                              those sc

Wednesday, March 25, 2009
ESP blog content structure
                                            JSON dump




                              WebDAV view
Wednesday, March 25, 2009
<%                ESP blog edit script
          pageTitle = currentNode.title; load(quot;header.espquot;);
          %>
          <body>
              <form method=quot;POSTquot; action=quot;<%= currentNode %>quot;>
                <p><label>Title</label>
                <input name=quot;titlequot; type=quot;textquot;
                    value=quot;<%= currentNode.title %>quot;></p>
                ...
                <input type=quot;hiddenquot; name=quot;createdquot;/>
                <input name=quot;:redirectquot; type=quot;hiddenquot;
                    value=quot;/content/espblog/posts.admin.htmlquot;/>
                <input type=quot;submitquot; value=quot;Postquot; class=quot;buttonquot;>
              </form>
          ...

Wednesday, March 25, 2009
ESP blog thumbnails: OSGi service
          /**
           * Observe the espblog content for changes, and generate
           * thumbnails when images are added.
           *
           * maven-scr-plugin uses annotations to generate the OSGi
           * Declarative Services XML configuration files
           * @scr.service
           * @scr.component immediate=quot;truequot;
           *
           */
          public class ThumbnailGeneratorServiceImpl
            implements ThumbnailGeneratorService, EventListener {




Wednesday, March 25, 2009
ESP blog thumbnails: observation
       /** @scr.reference (framework injects it automatically) */
       private SlingRepository repository;

       /** called by framework when service is activated */
       protected void activate(ComponentContext context) {
         Session s = repository.loginAdministrative(null);
         / Listen for nt:file NODE_ADDED repository events
          /
         ObservationManager m =
           s.getWorkspace().getObservationManager();
       ! String[] types = { quot;nt:filequot; };
       ! m.addEventListener(
             this,
             Event.NODE_ADDED,
             contentPath, ...);

Wednesday, March 25, 2009
ESP blog thumbnails: NODE_ADDED
       /** Called by JCR Observation manager for events that this
           * EventListener registered for
           */
       public void onEvent(EventIterator it) {
           while (it.hasNext()) {
            Event event = it.nextEvent();
              if (event.getType() == Event.NODE_ADDED
                && !(event.getPath().contains(quot;thumbnailsquot;)))
                {
                  String p = event.getPath();
                  Node n = session.getRootNode().getNode(p);
                  createThumbnails(addedNode);
                }
              }
       ...
Wednesday, March 25, 2009
We got a typical Sling application!
          JCR features: WebDAV,
          observation, nt:unstructured.

          Sling goodies: simple script
          mappings (BYOL), POST servlet, RESTful
          interface.

          OSGi bundle, code + initial
          content, Maven plugins.

Wednesday, March 25, 2009
We got a typical Sling application!
          JCR features: WebDAV,
          observation, nt:unstructured.

          Sling goodies: simple script
          mappings (BYOL), POST servlet, RESTful
          interface.
                                                           ource
                                                     blog s under
                                                 ESP
                                                       found es
                                                ode is ampl
          OSGi bundle, code + initial          c
                                                   sling/s
          content, Maven plugins.

Wednesday, March 25, 2009
Where is Sling going?




Wednesday, March 25, 2009
Where is Sling going? (aka conclusion)
              First web framework designed for JCR.
              Embrace the web, act like a very clever
              web server!
              Intelligent HTTP/JSON storage?
              OSGi, organic app growth.

              Growing community, graduate
              in 2009?
                            http://incubator.apache.org/sling
                            http://dev.day.com
                            http://contentcentric.org/

Wednesday, March 25, 2009
Where is Sling going? (aka conclusion)
              First web framework designed for JCR.
              Embrace the web, act like a very clever
              web server!
              Intelligent HTTP/JSON storage?
                                                          not a web
              OSGi, organic app growth.         “Sling is       s         ation a
                                                                    applic k, it’s
                                                                  fram e wor
              Growing community, graduate                                  ame work”
              in 2009?                                            w  eb f r
                                     http://incubator.apache.org/sling
                                     http://dev.day.com
                            join t
                                   hehttp://contentcentric.org/
                             fun!
Wednesday, March 25, 2009

More Related Content

What's hot

Presentation Spring, Spring MVC
Presentation Spring, Spring MVCPresentation Spring, Spring MVC
Presentation Spring, Spring MVC
Nathaniel Richand
 
Content Management With Apache Jackrabbit
Content Management With Apache JackrabbitContent Management With Apache Jackrabbit
Content Management With Apache Jackrabbit
Jukka Zitting
 

What's hot (20)

Polyglot payloads in practice by avlidienbrunn at HackPra
Polyglot payloads in practice by avlidienbrunn at HackPraPolyglot payloads in practice by avlidienbrunn at HackPra
Polyglot payloads in practice by avlidienbrunn at HackPra
 
PostgreSQL Materialized Views with Active Record
PostgreSQL Materialized Views with Active RecordPostgreSQL Materialized Views with Active Record
PostgreSQL Materialized Views with Active Record
 
What should a hacker know about WebDav?
What should a hacker know about WebDav?What should a hacker know about WebDav?
What should a hacker know about WebDav?
 
HTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versionsHTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versions
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
Presentation Spring, Spring MVC
Presentation Spring, Spring MVCPresentation Spring, Spring MVC
Presentation Spring, Spring MVC
 
Attacking thru HTTP Host header
Attacking thru HTTP Host headerAttacking thru HTTP Host header
Attacking thru HTTP Host header
 
Same Origin Method Execution (BlackHat EU2014)
Same Origin Method Execution (BlackHat EU2014)Same Origin Method Execution (BlackHat EU2014)
Same Origin Method Execution (BlackHat EU2014)
 
Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservices
 
REST API 설계
REST API 설계REST API 설계
REST API 설계
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
 
HTTP HOST header attacks
HTTP HOST header attacksHTTP HOST header attacks
HTTP HOST header attacks
 
Vue Vuex 101
Vue Vuex 101Vue Vuex 101
Vue Vuex 101
 
Content Management With Apache Jackrabbit
Content Management With Apache JackrabbitContent Management With Apache Jackrabbit
Content Management With Apache Jackrabbit
 
Frans Rosén Keynote at BSides Ahmedabad
Frans Rosén Keynote at BSides AhmedabadFrans Rosén Keynote at BSides Ahmedabad
Frans Rosén Keynote at BSides Ahmedabad
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webapps
 
CORS and (in)security
CORS and (in)securityCORS and (in)security
CORS and (in)security
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
 

Viewers also liked

Apache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and RESTApache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and REST
Carsten Ziegeler
 

Viewers also liked (18)

JCR In 10 Minutes
JCR In 10 MinutesJCR In 10 Minutes
JCR In 10 Minutes
 
Oak, the architecture of Apache Jackrabbit 3
Oak, the architecture of Apache Jackrabbit 3Oak, the architecture of Apache Jackrabbit 3
Oak, the architecture of Apache Jackrabbit 3
 
Togu CMS
Togu CMSTogu CMS
Togu CMS
 
TDWI Solution Summit San Diego 2014 Advanced Analytics at Macys.com
TDWI Solution Summit San Diego 2014 Advanced Analytics at Macys.comTDWI Solution Summit San Diego 2014 Advanced Analytics at Macys.com
TDWI Solution Summit San Diego 2014 Advanced Analytics at Macys.com
 
Shooting rabbits with sling
Shooting rabbits with slingShooting rabbits with sling
Shooting rabbits with sling
 
Using MapReduce for Large–scale Medical Image Analysis
Using MapReduce for Large–scale Medical Image AnalysisUsing MapReduce for Large–scale Medical Image Analysis
Using MapReduce for Large–scale Medical Image Analysis
 
Effective Web Application Development with Apache Sling
Effective Web Application Development with Apache SlingEffective Web Application Development with Apache Sling
Effective Web Application Development with Apache Sling
 
Distilling Hadoop Patterns of Use and How You Can Use Them for Your Big Data ...
Distilling Hadoop Patterns of Use and How You Can Use Them for Your Big Data ...Distilling Hadoop Patterns of Use and How You Can Use Them for Your Big Data ...
Distilling Hadoop Patterns of Use and How You Can Use Them for Your Big Data ...
 
Integrating Apache Wookie with AEM by Rima Mittal and Ankit Gubrani
Integrating Apache Wookie with AEM by Rima Mittal and Ankit GubraniIntegrating Apache Wookie with AEM by Rima Mittal and Ankit Gubrani
Integrating Apache Wookie with AEM by Rima Mittal and Ankit Gubrani
 
AEM (CQ) Dispatcher Caching Webinar 2013
AEM (CQ) Dispatcher Caching Webinar 2013AEM (CQ) Dispatcher Caching Webinar 2013
AEM (CQ) Dispatcher Caching Webinar 2013
 
Microservices for AEM by Maciej Majchrzak
Microservices for AEM by Maciej MajchrzakMicroservices for AEM by Maciej Majchrzak
Microservices for AEM by Maciej Majchrzak
 
Apache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and RESTApache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and REST
 
Introduction to JCR
Introduction to JCR Introduction to JCR
Introduction to JCR
 
The Zero Bullshit Architecture
The Zero Bullshit ArchitectureThe Zero Bullshit Architecture
The Zero Bullshit Architecture
 
REST: From GET to HATEOAS
REST: From GET to HATEOASREST: From GET to HATEOAS
REST: From GET to HATEOAS
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser Caching
 
Responsive Websites and Grid-Based Layouts by Gabriel Walt
Responsive Websites and Grid-Based Layouts by Gabriel Walt Responsive Websites and Grid-Based Layouts by Gabriel Walt
Responsive Websites and Grid-Based Layouts by Gabriel Walt
 
Introduction to Information Architecture
Introduction to Information ArchitectureIntroduction to Information Architecture
Introduction to Information Architecture
 

Similar to Rapid JCR applications development with Sling

Kuldeep presentation ppt
Kuldeep presentation pptKuldeep presentation ppt
Kuldeep presentation ppt
kuldeep khichar
 
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVCUpgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
FPGA Central
 
Wc Mand Connectors2
Wc Mand Connectors2Wc Mand Connectors2
Wc Mand Connectors2
day
 
Session 49 Practical Semantic Sticky Note
Session 49 Practical Semantic Sticky NoteSession 49 Practical Semantic Sticky Note
Session 49 Practical Semantic Sticky Note
ISSGC Summer School
 
Session 49 - Semantic metadata management practical
Session 49 - Semantic metadata management practical Session 49 - Semantic metadata management practical
Session 49 - Semantic metadata management practical
ISSGC Summer School
 
Web standards, why care?
Web standards, why care?Web standards, why care?
Web standards, why care?
Thomas Roessler
 
Millions quotes per second in pure java
Millions quotes per second in pure javaMillions quotes per second in pure java
Millions quotes per second in pure java
Roman Elizarov
 

Similar to Rapid JCR applications development with Sling (20)

Taming Jcr With Sling
Taming Jcr With SlingTaming Jcr With Sling
Taming Jcr With Sling
 
Jazoon 2009
Jazoon 2009Jazoon 2009
Jazoon 2009
 
µjax in 30 minutes (for Stockholm)
µjax in 30 minutes (for Stockholm)µjax in 30 minutes (for Stockholm)
µjax in 30 minutes (for Stockholm)
 
µjax in 30 minutes (for Stockholm)
µjax in 30 minutes (for Stockholm)µjax in 30 minutes (for Stockholm)
µjax in 30 minutes (for Stockholm)
 
µjax in 30 minutes
µjax in 30 minutesµjax in 30 minutes
µjax in 30 minutes
 
Kuldeep presentation ppt
Kuldeep presentation pptKuldeep presentation ppt
Kuldeep presentation ppt
 
Closing the DevOps gaps
Closing the DevOps gapsClosing the DevOps gaps
Closing the DevOps gaps
 
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVCUpgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
 
Wc Mand Connectors2
Wc Mand Connectors2Wc Mand Connectors2
Wc Mand Connectors2
 
Session 49 Practical Semantic Sticky Note
Session 49 Practical Semantic Sticky NoteSession 49 Practical Semantic Sticky Note
Session 49 Practical Semantic Sticky Note
 
Implementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPImplementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHP
 
Session 49 - Semantic metadata management practical
Session 49 - Semantic metadata management practical Session 49 - Semantic metadata management practical
Session 49 - Semantic metadata management practical
 
Web standards, why care?
Web standards, why care?Web standards, why care?
Web standards, why care?
 
Millions quotes per second in pure java
Millions quotes per second in pure javaMillions quotes per second in pure java
Millions quotes per second in pure java
 
UTHOC2 - Under The Hood of Oracle Clusterware 2.0 - Grid Infrastructure by Al...
UTHOC2 - Under The Hood of Oracle Clusterware 2.0 - Grid Infrastructure by Al...UTHOC2 - Under The Hood of Oracle Clusterware 2.0 - Grid Infrastructure by Al...
UTHOC2 - Under The Hood of Oracle Clusterware 2.0 - Grid Infrastructure by Al...
 
Upgrading to SystemVerilog for FPGA Designs - FPGA Camp Bangalore, 2010
Upgrading to SystemVerilog for FPGA Designs - FPGA Camp Bangalore, 2010Upgrading to SystemVerilog for FPGA Designs - FPGA Camp Bangalore, 2010
Upgrading to SystemVerilog for FPGA Designs - FPGA Camp Bangalore, 2010
 
Valtech Days 2009 Paris Presentation: WCM in 2010 and an intro to CQ5
Valtech Days 2009 Paris Presentation: WCM in 2010 and an intro to CQ5Valtech Days 2009 Paris Presentation: WCM in 2010 and an intro to CQ5
Valtech Days 2009 Paris Presentation: WCM in 2010 and an intro to CQ5
 
Web Content Management And Agile
Web Content Management And AgileWeb Content Management And Agile
Web Content Management And Agile
 
Agile Edge Valtech
Agile Edge ValtechAgile Edge Valtech
Agile Edge Valtech
 
tree-sitter-objc-slides.pptx
tree-sitter-objc-slides.pptxtree-sitter-objc-slides.pptx
tree-sitter-objc-slides.pptx
 

More from Bertrand Delacretaz

More from Bertrand Delacretaz (20)

VanillaJS & the Web Platform, a match made in heaven?
VanillaJS & the Web Platform, a match made in heaven?VanillaJS & the Web Platform, a match made in heaven?
VanillaJS & the Web Platform, a match made in heaven?
 
Surviving large online communities with conciseness and clarity
Surviving large online communities with conciseness and clarity Surviving large online communities with conciseness and clarity
Surviving large online communities with conciseness and clarity
 
Repoinit: a mini-language for content repository initialization
Repoinit: a mini-language for content repository initializationRepoinit: a mini-language for content repository initialization
Repoinit: a mini-language for content repository initialization
 
The Moving House Model, adhocracy and remote collaboration
The Moving House Model, adhocracy and remote collaborationThe Moving House Model, adhocracy and remote collaboration
The Moving House Model, adhocracy and remote collaboration
 
GraphQL in Apache Sling - but isn't it the opposite of REST?
GraphQL in Apache Sling - but isn't it the opposite of REST?GraphQL in Apache Sling - but isn't it the opposite of REST?
GraphQL in Apache Sling - but isn't it the opposite of REST?
 
Open Source Changes the World!
Open Source Changes the World!Open Source Changes the World!
Open Source Changes the World!
 
How to convince your left brain (or manager) to follow the Open Source path t...
How to convince your left brain (or manager) to follow the Open Source path t...How to convince your left brain (or manager) to follow the Open Source path t...
How to convince your left brain (or manager) to follow the Open Source path t...
 
L'Open Source change le Monde - BlendWebMix 2019
L'Open Source change le Monde - BlendWebMix 2019L'Open Source change le Monde - BlendWebMix 2019
L'Open Source change le Monde - BlendWebMix 2019
 
Shared Neurons - the Secret Sauce of Open Source communities?
Shared Neurons - the Secret Sauce of Open Source communities?Shared Neurons - the Secret Sauce of Open Source communities?
Shared Neurons - the Secret Sauce of Open Source communities?
 
Sling and Serverless, Best Friends Forever?
Sling and Serverless, Best Friends Forever?Sling and Serverless, Best Friends Forever?
Sling and Serverless, Best Friends Forever?
 
Serverless - introduction et perspectives concrètes
Serverless - introduction et perspectives concrètesServerless - introduction et perspectives concrètes
Serverless - introduction et perspectives concrètes
 
State of the Feather - ApacheCon North America 2018
State of the Feather - ApacheCon North America 2018State of the Feather - ApacheCon North America 2018
State of the Feather - ApacheCon North America 2018
 
Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?
 
Open Source at Scale: the Apache Software Foundation (2018)
Open Source at Scale: the Apache Software Foundation (2018)Open Source at Scale: the Apache Software Foundation (2018)
Open Source at Scale: the Apache Software Foundation (2018)
 
They don't understand me! Tales from the multi-cultural trenches
They don't understand me! Tales from the multi-cultural trenchesThey don't understand me! Tales from the multi-cultural trenches
They don't understand me! Tales from the multi-cultural trenches
 
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
 
Project and Community Services the Apache Way
Project and Community Services the Apache WayProject and Community Services the Apache Way
Project and Community Services the Apache Way
 
La Fondation Apache - keynote au Paris Open Source Summit 2017
La Fondation Apache - keynote au Paris Open Source Summit 2017La Fondation Apache - keynote au Paris Open Source Summit 2017
La Fondation Apache - keynote au Paris Open Source Summit 2017
 
Asynchronous Decision Making - FOSS Backstage 2017
Asynchronous Decision Making - FOSS Backstage 2017Asynchronous Decision Making - FOSS Backstage 2017
Asynchronous Decision Making - FOSS Backstage 2017
 
Building an Apache Sling Rendering Farm
Building an Apache Sling Rendering FarmBuilding an Apache Sling Rendering Farm
Building an Apache Sling Rendering Farm
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Rapid JCR applications development with Sling

  • 1. Rapid JCR applications development with Apache Sling Bertrand Delacrétaz Senior R&D Developer, Day Software, www.day.com Member and Director, ASF bdelacretaz@apache.org blog at http:/ /grep.codeconsult.ch twitter: @bdelacretaz Slides revision: 2009-03- 20 Slides theme design: David Nuescheler Wednesday, March 25, 2009
  • 2. Rapid JCR applications development with Apache Sling Bertrand Delacrétaz Senior R&D Developer, Day Software, www.day.com Member and Director, ASF bdelacretaz@apache.org blog at http:/ /grep.codeconsult.ch twitter: @bdelacretaz Slides revision: 2009-03- 20 Slides theme design: David Nuescheler is thi busy s slide enou gh? Wednesday, March 25, 2009
  • 3. Intro to JCR JCR = Java Content Repository API JSR-170 / JSR283 - Everything Is Content - and JCR manages it as trees of Nodes and Properties, using rich data types. Wednesday, March 25, 2009
  • 4. 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. Wednesday, March 25, 2009
  • 5. What’s JCR? JSR-170 Content Repository for JavaTM technology API Spec-Lead: Day Software Status: Final Release 17-jun-2005 Expert Group: Wednesday, March 25, 2009
  • 6. What’s JCR? JSR-170 JSR-283 Content Repository for JavaTM technology API v2.0 Spec-Lead: Day Software Status: Public Review Closed sep-2007 Expert Group: Wednesday, March 25, 2009
  • 9. 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.” Wednesday, March 25, 2009
  • 10. 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.” ? Wednesday, March 25, 2009
  • 11. 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.” ? Wednesday, March 25, 2009
  • 12. Best of both worlds. data base file s ys t e m hier- archi integ rity re es structu read streams tx write access query locking control multi- value ning obser- versio un-structured “full-text” sort vation order content repo sit or y Wednesday, March 25, 2009
  • 13. Best of both worlds. data base file s ys t e m hier- archi integ rity re es structu read streams tx write access query locking control multi- value ning obser- versio un-structured “full-text” sort vation order content repo sit or y Wednesday, March 25, 2009
  • 15. Known compliant Repositories * using third party connector * * Apache Exo Microsoft OpenText Jackrabbit Oracle XML DB ECMS Platform Sharepoint Livelink * Xythos Day CRX IBM FileNet P8 Repository Alfresco ECM Vignette V7 * * any ors ow mvendd? H S e +hun dre DBMou ne R do y Interwoven EMC TCKsds of regis Repository IBM CM Documentum tered Wednesday, March 25, 2009
  • 16. Some known JCR Applications Wednesday, March 25, 2009
  • 17. Some known JCR Applications Fast Enterprise BEA Portal Sun Oracle Portal Interface 21Search OpenPortal JBoss Portal Day Spring Communique Framework DAM Day magnolia WCMS Apache Sling Communique Alfresco ECMS Mindquarry ApacheCollab Collaboration Tapestry QSLabs Day Apache Compliance Communiqué IBM FileNet Cocoon WCMS Artifactory medic-2-medic WebSiteManage r Apache James Maven Proxy mapofmedicine Exo GX ECMS Platform TYPO3 WebManager v5.0 WCM InfoQ Liferay Online Hippo Enterprise Nuxeo ECM Community CMS Portal Jahia Sakai Percussion Framework E-learning Rhythmix QuickWCM Sourcemix WCMS Lutece Sourcemix Portal Wednesday, March 25, 2009
  • 18. Some known JCR Applications Fast Enterprise BEA Portal Sun Oracle Portal Interface 21Search OpenPortal JBoss Portal Day Spring Communique Framework DAM Day magnolia WCMS Apache Sling Communique Alfresco ECMS Mindquarry ApacheCollab Collaboration Tapestry QSLabs Day Apache Compliance Communiqué IBM FileNet Cocoon WCMS Artifactory medic-2-medic WebSiteManage r Apache James Maven Proxy mapofmedicine Exo GX ECMS Platform TYPO3 WebManager v5.0 WCM InfoQ Liferay Online Hippo Enterprise Nuxeo ECM Community CMS Portal Jahia Sakai Percussion Framework E-learning Rhythmix QuickWCM Sourcemix WCMS Lutece Sourcemix Portal Wednesday, March 25, 2009
  • 19. JCR code excerpt Repository repository = new TransientRepository(); Session session = repository.login(...); / Create content / Node root = session.getRootNode(); Node hello = root.addNode(quot;helloquot;); Node world = hello.addNode(quot;worldquot;); world.setProperty(quot;messagequot;, quot;Hello, World!quot;); session.save(); / Retrieve content / Node node = root.getNode(quot;hello/worldquot;); print(node.getPath()); print(node.getProperty(quot;messagequot;).getString()); Wednesday, March 25, 2009
  • 20. On to Sling Wednesday, March 25, 2009
  • 21. 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 Wednesday, March 25, 2009
  • 22. 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 join t he fun! Wednesday, March 25, 2009
  • 23. Sling == REST over JCR Wednesday, March 25, 2009
  • 24. Sling == 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 Wednesday, March 25, 2009
  • 25. Reclaiming the web. Sling URL decomposition. /cars/audi/s4.details.html Wednesday, March 25, 2009
  • 26. Reclaiming the web. Sling URL decomposition. /cars/audi/s4.details.html Repository Wednesday, March 25, 2009
  • 27. Reclaiming the web. Sling URL decomposition. /cars/audi/s4.details.html Content Repository epository Path R Wednesday, March 25, 2009
  • 28. Reclaiming the web. Sling URL decomposition. /cars/audi/s4.details.html Content Repository epository Path R Wednesday, March 25, 2009
  • 29. Reclaiming the web. Sling URL decomposition. /cars/audi/s4.details.html Content ...selects a Repository epository Path R particular scrip t Wednesday, March 25, 2009
  • 30. 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 Wednesday, March 25, 2009
  • 31. Sling architecture HTTP sling.js debugger filesystem browser utilit y POST, V json GE T WebDA access 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 ESP de se r ver-si t ip JSR-170 API javascr JCR repository Wednesday, March 25, 2009
  • 32. A minimalone .esp script blog Consisting of Sling cat /Volumes/localhost/apps/blog/blog.esp | wc -l 54 Wednesday, March 25, 2009
  • 33. from e code : ge t th ay.com dev.d url.com/ /tiny 6 ht tp:/ gblog4 slin A minimalone .esp script blog Consisting of Sling cat /Volumes/localhost/apps/blog/blog.esp | wc -l 54 Wednesday, March 25, 2009
  • 34. Sling POST servlet # POST to Sling curl -F title=hello http://localhost:8888/foo -> 200 OK # GET created node in json format curl http:/ /localhost:8888/foo.tidy.json { quot;jcr:primaryTypequot;: quot;nt:unstructuredquot;, quot;titlequot;: quot;helloquot; } Wednesday, March 25, 2009
  • 35. Sling POST servlet # POST to Sling curl -F title=hello http://localhost:8888/foo -> 200 OK POST se t e ters s # GET created node in json format param opertie curl http:/ /localhost:8888/foo.tidy.json node pr { quot;jcr:primaryTypequot;: quot;nt:unstructuredquot;, quot;titlequot;: quot;helloquot; } Wednesday, March 25, 2009
  • 36. blog step 1: create content ! <form method=quot;POSTquot;> ! Title: ! <input type=quot;textquot; name=quot;titlequot; style=quot;width:100%quot;/> ! ! Text: ! <textarea style=quot;width:100%quot; name=quot;textquot;></textarea> ! ! <input type=quot;submitquot; value=quot;savequot;/> ! ! <input type=quot;hiddenquot; name=quot;:redirectquot; value=quot;*quot;/> ! </form> Wednesday, March 25, 2009
  • 37. blog step 1: create content ! <form method=quot;POSTquot;> ! Title: ! <input type=quot;textquot; name=quot;titlequot; style=quot;width:100%quot;/> ! ! Text: ! <textarea style=quot;width:100%quot; name=quot;textquot;></textarea> ! ! <input type=quot;submitquot; value=quot;savequot;/> ! ! <input type=quot;hiddenquot; name=quot;:redirectquot; value=quot;*quot;/> ! </form> dri ve fields t Form onten the c el mod Wednesday, March 25, 2009
  • 38. blog step 2: retrieve content <script src=quot;/system/sling.jsquot;></script>! <form method=quot;POSTquot;> ... </form> <!-- initialize form fields from current node values --> <script>Sling.wizard();</script> Wednesday, March 25, 2009
  • 39. blog step 2: retrieve content <script src=quot;/system/sling.jsquot;></script>! <form method=quot;POSTquot;> ... </form> <!-- initialize form fields from current node values --> <script>Sling.wizard();</script> U(D) Inst ant CR Wednesday, March 25, 2009
  • 40. blog step 3: navigation <ul> <li> <a href=quot;/content/blog/*quot;> [Create new post]</a> </li> ! <script> ! var posts = Sling.getContent(quot;/content/blogquot;, 2); ! for(var post in posts) { ! ! document.write( quot;<li><a href=’” + post + quot;'>quot; + posts[post].title + quot;</a></li>quot;); ! } ! </script> </ul> Wednesday, March 25, 2009
  • 41. we got a blog! html form + Sling.wizard() + Sling.getContent() Wednesday, March 25, 2009
  • 42. The ESP blog sample ESP scripting + java + javascript OSGi bundle, initial content, WebDAV, observation, RAD Wednesday, March 25, 2009
  • 43. The ESP blog sample ESP scripting + java + javascript OSGi bundle, initial content, WebDAV, observation, RAD mples ng/sa / der sli rl.com de un inyu Co ht tp:/ t logesp / slingb Wednesday, March 25, 2009
  • 44. ESP blog in action create retrieve thumbnails update Wednesday, March 25, 2009
  • 46. ESP blog source files admin.esp pom.xml edit.esp ThumbnailGeneratorService.java html.esp ThumbnailGeneratorServiceImpl.java list.esp espblog.css menu.esp sling-logo.png xml.esp (RSS feed) constants.esp header.esp Wednesday, March 25, 2009
  • 47. ESP blog source files admin.esp pom.xml edit.esp ThumbnailGeneratorService.java html.esp ThumbnailGeneratorServiceImpl.java list.esp espblog.css menu.esp sling-logo.png xml.esp (RSS feed) constants.esp source log re s to espb oint header.esp t ype p ripts those sc Wednesday, March 25, 2009
  • 48. ESP blog content structure JSON dump WebDAV view Wednesday, March 25, 2009
  • 49. <% ESP blog edit script pageTitle = currentNode.title; load(quot;header.espquot;); %> <body> <form method=quot;POSTquot; action=quot;<%= currentNode %>quot;> <p><label>Title</label> <input name=quot;titlequot; type=quot;textquot; value=quot;<%= currentNode.title %>quot;></p> ... <input type=quot;hiddenquot; name=quot;createdquot;/> <input name=quot;:redirectquot; type=quot;hiddenquot; value=quot;/content/espblog/posts.admin.htmlquot;/> <input type=quot;submitquot; value=quot;Postquot; class=quot;buttonquot;> </form> ... Wednesday, March 25, 2009
  • 50. ESP blog thumbnails: OSGi service /** * Observe the espblog content for changes, and generate * thumbnails when images are added. * * maven-scr-plugin uses annotations to generate the OSGi * Declarative Services XML configuration files * @scr.service * @scr.component immediate=quot;truequot; * */ public class ThumbnailGeneratorServiceImpl implements ThumbnailGeneratorService, EventListener { Wednesday, March 25, 2009
  • 51. ESP blog thumbnails: observation /** @scr.reference (framework injects it automatically) */ private SlingRepository repository; /** called by framework when service is activated */ protected void activate(ComponentContext context) { Session s = repository.loginAdministrative(null); / Listen for nt:file NODE_ADDED repository events / ObservationManager m = s.getWorkspace().getObservationManager(); ! String[] types = { quot;nt:filequot; }; ! m.addEventListener( this, Event.NODE_ADDED, contentPath, ...); Wednesday, March 25, 2009
  • 52. ESP blog thumbnails: NODE_ADDED /** Called by JCR Observation manager for events that this * EventListener registered for */ public void onEvent(EventIterator it) { while (it.hasNext()) { Event event = it.nextEvent(); if (event.getType() == Event.NODE_ADDED && !(event.getPath().contains(quot;thumbnailsquot;))) { String p = event.getPath(); Node n = session.getRootNode().getNode(p); createThumbnails(addedNode); } } ... Wednesday, March 25, 2009
  • 53. We got a typical Sling application! JCR features: WebDAV, observation, nt:unstructured. Sling goodies: simple script mappings (BYOL), POST servlet, RESTful interface. OSGi bundle, code + initial content, Maven plugins. Wednesday, March 25, 2009
  • 54. We got a typical Sling application! JCR features: WebDAV, observation, nt:unstructured. Sling goodies: simple script mappings (BYOL), POST servlet, RESTful interface. ource blog s under ESP found es ode is ampl OSGi bundle, code + initial c sling/s content, Maven plugins. Wednesday, March 25, 2009
  • 55. Where is Sling going? Wednesday, March 25, 2009
  • 56. Where is Sling going? (aka conclusion) First web framework designed for JCR. Embrace the web, act like a very clever web server! Intelligent HTTP/JSON storage? OSGi, organic app growth. Growing community, graduate in 2009? http://incubator.apache.org/sling http://dev.day.com http://contentcentric.org/ Wednesday, March 25, 2009
  • 57. Where is Sling going? (aka conclusion) First web framework designed for JCR. Embrace the web, act like a very clever web server! Intelligent HTTP/JSON storage? not a web OSGi, organic app growth. “Sling is s ation a applic k, it’s fram e wor Growing community, graduate ame work” in 2009? w eb f r http://incubator.apache.org/sling http://dev.day.com join t hehttp://contentcentric.org/ fun! Wednesday, March 25, 2009

Editor's Notes