Building Content Applications with JCR and OSGi

2,975 views

Published on

A mostly demo session of JCR + OSGi + Sling at JAX Conf 2011 in San Jose (CA)

Published in: Technology

Building Content Applications with JCR and OSGi

  1. 1. Building Content Applications with JCR and OSGi Cédric Hüsler | Enterprise Platform Evangelist© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential.
  2. 2. Yours truly §  from Basel, Switzerland §  Enterprise Platform Evangelist at Adobe §  Open web technologies and scaling architecture / infrastructure. §  Twi er: @keepthebyte© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 2
  3. 3. A few questions… §  Played around with JCR API in the past? §  Using the JCR API today? §  Develops OSGi-based apps? §  Develop RESTful web applications?© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 3
  4. 4. Agenda §  Ge ing to know JSR-283 - the Content Repository API §  Usage of JCR in the wild §  3 in 1: Jackrabbit + Felix + Sling [Hands-on] §  Supported protocols and APIs §  Server-side OSGi with Apache Felix [Hands-on] §  Develop RESTful web application on JCR [Hands-on] §  Having fun with the Apache Sling Script Engine [Hands-on] §  Future outlook: JCR 333 and Jackrabbit 3© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 4
  5. 5. Everything is Content© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 5
  6. 6. Roy Fielding / Principal Scientist - Chief Scientist Roy T. Fielding Apache Apache Apache SoftwareWebServer Foundation License REST HTTP URL© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 6
  7. 7. Content Repository Structure (simpli ed) parent node type nt:folder nt: le nt:unstructured rep:User rep:ACL nt:nodeType … mixins mix:versionable mix:lockable sling:VanityPath cq:Taggable …. key = value string long date path binary …. key = values[] string long date path binary … nodes© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 7
  8. 8. On the Java Content Repository API “It’s a database that looks like a javax.jcr le system and features all the - Node good stuff like unstructured, - Property versioning, observation, access - Repository control…” - Workspace javax.jcr.lock javax.jcr.nodetype javax.jcr.observation javax.jcr.query javax.jcr.query.qom javax.jcr.retentionJSR-170 (2002-2005) javax.jcr.securityJSR-283 (2005-2009) javax.jcr.utilJSR-333 (2010-....) javax.jcr.version© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 8
  9. 9. Open Source Implementations in the Wild© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 9
  10. 10. 3 in 1: Content Application Platform •  Application layer for JCR repositories •  OSGi-based •  script=servlet •  Powerful default servlets h p://sling.apache.org •  “any” scripting language thanks to JSR-223 •  Implements OSGi Service Platform - Version 4.2 h p://felix.apache.org •  Reference Implementation of JSR 170 and JSR 283 •  WebDAV built-in •  Remoting via RIM and HTTP h p://jackrabbit.apache.org© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 10
  11. 11. Content Repository – Built-in Protocols/APIs Add, consume, managed content with these interfaces: §  Java Content Repository API – complete JCR 2.0 implementation §  Content Management Interoperability Services - CMIS 1.0 §  WebDAV – with versioning, access control and search §  Windows Network File Share – CIFS/SMB §  RESTful Web API for JavaScript and Flash/Flex §  Java Remoting with RMI and HTTP §  LDAP and any JAAS plug-in §  Native repository interface via Virtual Repository – e.g. Microso SharePoint© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 11
  12. 12. Play with it now? •  Download Sling Standalone Application (the 100% Open Source distribution) h p://bit.ly/apachesling •  Download CRX from Adobe (commercial package with web-based IDE and DB-less persistence) h p://bit.ly/crxdownload© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 12
  13. 13. RESTful Content Rendering Example (with Apache Sling) GET /products/english/18846.html Repository Path Render Code Resource Type Resolution© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 13
  14. 14. RESTful Content Editing Example (with Apache Sling) POST /products/english/18846/comments/* Repository Path Title as node name© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 14
  15. 15. Managed Java services in OSGi Container Security Bundle B V2.1.0 Services Bundle A Bundle B V1.1.0 V2.0.0 Bundle A Bundle B Bundle C Service Registry V1.0.0 V1.0.0 V1.0.0 Life Cycle Class Loading OSGi Container in Content Repository© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 15
  16. 16. Sling and Scripting Language Support (JSR 233) Add language support via OSGi bundle §  JavaScript & JSP included by default §  Scala: h ps://cwiki.apache.org/SLING/using-scala-with-sling.html §  Groovy: h p://sling.apache.org/site/groovy-support.html & h p://groovy.codehaus.org/Download §  Python §  Ruby §  more see Sling SVN© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 16
  17. 17. Typical Developer Setup with Content Repository QA PROD Sub- App Packages App version CR CR Load BalancerPackage & Share HTTP Accelerator App App CR CR CRXDE LDAP, CRM, Billing, ECM Repositories Any IDE Vault DEV © 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 17
  18. 18. Content Repository Clustering (Share Nothing vs. Share DataStore) Node 1 Node 2 Your Application Your Application Content Repository Open connection for 2-way Content Repository [Master] communication to fetch changes from master & get noti cations. Index Data Data Index TarPM Forward writes TarPM Store Store Read/write Binaries Read Binaries DataStore Shared FS / S3 Install Content Repository on Amazon EC2 – check out: h p://dev.day.com/installcrxonec2© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 18
  19. 19. What up next? §  Jackrabbit 3 §  h p://wiki.apache.org/jackrabbit/RoadMap §  Join the discussion on the mailing list §  JSR 333 §  h p://www.jcp.org/en/jsr/detail?id=333 1.  Ease of API use: Make simple, things simple. 2.  Lower entry barriers for implementers and application developers. 3.  Scripting support of the API. 4.  Client-server awareness. 5.  Protocol and SPI bindings. Binding and liaison to OASIS / CMIS. 6.  Maintenance and feedback container for implementers, users and non-users. Gauge real-world interoperability. 7.  Node type library. 8.  Internationalization.© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 19
  20. 20. © 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential.

×