©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR & Sling quick dive
Paolo Mottadelli | Senio...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Background
■ The WWW design approach:
■ Single,...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Content-centric vs Control-centric interfaces
■...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Content Repository
■ A Content Repository suppo...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR
■ The JCR specification defines an abstract...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR: The Repository Model
■ Workspaces
■ Hierar...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JSON representation of a node
7
http://localhos...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR code sample
Repository repository = new Tra...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR: Repository Functionalities
■ Level 1
■ Log...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR: Observation
■ Observation enables an appli...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR: Content Modelling
■ 2 use cases:
■ Structu...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR: node types & mixin types
■ predefined node...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JCR Ecosystem
■ Open Standard
■ Java Community ...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Sling
■ OSGI-based scriptable application layer...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The Sling style
■ If you happen to hear this se...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
CRX Architecture
16
OSGIframework (felix)
JCRre...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Sling Architecture
17
felix
jackrabbit
JCR api
...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Sling examples using cURL
■ Create a node
■ cur...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Sling URL decomposition
19
/geometrixx/en/produ...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Sling URL decomposition
20
/geometrixx/en/produ...
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Where to go from here
■ JSR 283 spec: http://jc...
Upcoming SlideShare
Loading in...5
×

JCR and Sling Quick Dive

5,789

Published on

When getting in first touch with CQ5 and CRX, shipped by Day Software, now part of Adobe, the stakeholders need to understand the basic concept of the Open Architecture embraced by those systems.
This is an easy to understand introduction to JCR and Sling architecture.

Published in: Technology, Business
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,789
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
220
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

JCR and Sling Quick Dive

  1. 1. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR & Sling quick dive Paolo Mottadelli | Senior Sales Engineer
  2. 2. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Background ■ The WWW design approach: ■ Single, simple standardize interface ■ Independent from storage/creation ■ Trascends the complexity ■ Same design principles for application development: ■ Commitment to standardization ■ Simple, generic, Content-Centric interface 2
  3. 3. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Content-centric vs Control-centric interfaces ■ Content-centric interfaces principles: ■ Uniform identifiers ■ Standard methods ■ Extensible representation types ■ Simplified application integration (much less interfaces) ■ Content Repository API = Uniform interface 3
  4. 4. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Content Repository ■ A Content Repository supports: ■ Diverse data: ■ small & large, structured & unstructured, binary, metadata & relationships ■ Services: ■ access control, locking, versioning, transactions, observation ■ The Java Content Repository provides: ■ Abstraction of data storage ■ Generalized content services ■ Separation of real storage from application interactions ■ Standard API 4
  5. 5. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR ■ The JCR specification defines an abstract model and a Java API for data storage and related services commonly used by content-oriented applications. ■ Target: any application that must handle both unstructured digital assets and structured or semi-structured information. 5
  6. 6. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR: The Repository Model ■ Workspaces ■ Hierarchy of nodes ■ Properties associated to a node ■ Node types define constraints (properties and child nodes) 6 Repository Workspace Workspace Workspace [root] [root] [root] jcr:title = ‘Hello World’ jcr:lastModifiedBy = ‘admin’
  7. 7. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JSON representation of a node 7 http://localhost:7402/content/firststeps.infinity.json
  8. 8. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR code sample Repository repository = new TransientRepository(); Session session = repository.login(new SimpleCredentials("username", "password".toCharArray())); // Store content 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"); System.out.println(node.getPath()); System.out.println(node.getProperty("message").getString()); // Remove content root.getNode("hello").remove(); session.save(); 8
  9. 9. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR: Repository Functionalities ■ Level 1 ■ Login ■ Read Nodes & properties ■ XML export ■ XPath queries ■ Node types discovery ■ Namespaces remapping 9 ■ Level 2 ■ Write nodes & properties ■ XML Import ■ Assign a node types to nodes ■ Change namespace registry ■ Optional ■ Locking ■ Transactions ■ Versioning ■ SQL search ■ Observation
  10. 10. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR: Observation ■ Observation enables an application to receive notification of persistence changes in the workspace. Base for BPM. ■ NODE_ADDED ■ NODE_MOVED ■ NODE_REMOVED ■ PROPERTY_ADDED ■ PROPERTY_REMOVED ■ PROPERTY_CHANGED ■ Can be asynchronous or journaled 10
  11. 11. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR: Content Modelling ■ 2 use cases: ■ Structured content (e.g. file storage) ■ Needs definition of content models; ■ Needs a stable structure; ■ nt:resource ■ Unstructured content ■ Any properties and child nodes allowed ■ nt:unstructured 11 [nt:resource] > mix:mimeType, mix:lastModified primaryitem jcr:data - jcr:data (BINARY) mandatory
  12. 12. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR: node types & mixin types ■ predefined node types: ■ nt:unstructured ■ nt:file ■ nt:folder ■ nt:resource represents the actual content of a file. ■ nt:version ■ mixin types provide extra characteristics to the node: ■ mix:versionable: allows a node to support versioning ■ mix:lockable: enables locking capabilities ■ mix:referenceable: provides an auto-created jcr:uuid property 12
  13. 13. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. JCR Ecosystem ■ Open Standard ■ Java Community Process (http://jcp.org) ■ Sustainability ■ Reference Implementation & TCK ■ Apache infrastructure ■ license, workspace, information ■ Community ■ open review, testing & collaboration ■ Open adoption 13
  14. 14. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Sling ■ OSGI-based scriptable application layer on top of JCR ■ REST based web framework ■ Content-driven, using a JCR content repository ■ Powered by OSGi ■ Scripting inside, multiple languages (JSP, server-side javascript, Scala, etc.) ■ Apache Open Source project 14
  15. 15. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. The Sling style ■ If you happen to hear this sentence: ■ “Sling is not a web applications framework, it’s a web framework.” ■ It means: ■ Sling is built in a way that embraces the web. ■ Sling design is based on the principles of the WWW. ■ Sling processes HTTP requests in a RESTful way. 15
  16. 16. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. CRX Architecture 16 OSGIframework (felix) JCRrepository (jackrabbit) JCR api Applicationframework (sling) HTTP ‣ manages bundles as app components ‣ provides system services to bundles ‣ stores the content ‣ processes HTTP requests in a RESTful way specification implementation architectural style
  17. 17. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Sling Architecture 17 felix jackrabbit JCR api HTTP standard servlets custom servlets and components resource resolution servlet/script resolution JSR 223 scripting javascript Ruby WedDAV server sling OSGI console sling JSP Scala ...
  18. 18. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Sling examples using cURL ■ Create a node ■ curl -F"sling:resourceType=foo/bar" -F"title=some title" http://admin:admin@localhost:7402/content/mynode ■ Create a node (auto-named) ■ curl -X POST "http://admin:admin@localhost:7402/content/blog" ■ curl -D - -F"title=Adventures with Sling" "http://admin:admin@localhost:7402/content/blog/*" 18
  19. 19. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Sling URL decomposition 19 /geometrixx/en/products/triangle.html /geometrixx/en/products/triangle.teaser.html defines the resource defines the rendition
  20. 20. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Sling URL decomposition 20 /geometrixx/en/products/triangle.teaser.html sling:resourceType geometrixx/components/contentpage
  21. 21. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Where to go from here ■ JSR 283 spec: http://jcp.org/en/jsr/detail?id=283 ■ Apache Jackrabbit: http://jackrabbit.apache.org/ ■ Apache Sling: http://sling.apache.org/ ■ First steps with CRX: ■ http://dev.day.com/docs/en/crx/current/getting_started/first_steps_with_crx.html 21
  1. ¿Le ha llamado la atención una diapositiva en particular?

    Recortar diapositivas es una manera útil de recopilar información importante para consultarla más tarde.

×