a jcr view of the world - adaptto() 2012 berlin

19
APACHE SLING & FRIENDS TECH MEETUP BERLIN, 26-28 SEPTEMBER 2012 A JCR view of the world Alexander Klimetschek, Adobe 1

Upload: alexander-klimetschek

Post on 15-Jan-2015

561 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: A JCR View of the World - adaptTo() 2012 Berlin

APACHE SLING & FRIENDS TECH MEETUPBERLIN, 26-28 SEPTEMBER 2012

A JCR view of the worldAlexander Klimetschek, Adobe

1

Page 2: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

JCR

2

RDBMSFEATURES OF AN

FILESYSTEMFEATURES OF A

YOU ALWAYS WANTED

GOOD STUFFALL THE OTHER+

Transactions, Query, Structure, Integrity Binaries, Hierarchy, Locking, Access Control

Data First, Versioning, Full-text, Multi-Value, Sort-Order, Observation

CONTENT REPOSITORY

Page 3: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

1. Data first, Structure Later

2. Drive the Content Hierarchy

3. Reduce # of Workspaces

4. Beware of Same Name Siblings

5. References Considered Harmful

6. Files are Files are Files

7. ID`s are evil

http://wiki.apache.org/jackrabbit/DavidsModel

David`s Model

3

Page 4: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

1. Data first, Structure Later

2. Drive the Content Hierarchy

3. Reduce # of Workspaces

4. Beware of Same Name Siblings

5. References Considered Harmful

6. Files are Files are Files

7. ID`s are evil

http://wiki.apache.org/jackrabbit/DavidsModel

David`s Model

4

Page 5: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Strict schemas harm evolution Structure is expensive

Constraints only where 100% future proof

Easier to extract patterns from real data allow end users to structure their content

Use nt:unstructured instead of my:Type CQ: use cq:Page

Sling: use sling:Folder

#1 Data first, Structure later

5

Page 6: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Outer hierarchy files & folders

Inner document structure micro tree

separated by jcr:content

nt:hierarchyNode used for replication in CQ

Pages: generic UIs & authoring /etc/replication

Pages / Documents

6

hierarchy

document

Page 7: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Need to store separate information?

But not within original content?

Use shadow paths:/some/path  =>  /alternate/some/path

Samples: /content/usergenerated /var/clientlibs /var/audi/com.day.cq.wcm.core.page

Shadow paths

7

Page 8: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Content hierarchy is valuable

Look at ownership & permissions

Good design: intuitive, understandable & easily explorable

uses less ACLs

like a well-ordered and well-named filesystem

always try to use hierarchy conventions instead of node types

don`t simply „copy“ relational models

#2 Drive the Content Hierarchy

8

Page 9: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Inspiration:Unix filesystem for CMS

/content

/apps over /libs

mess: /etc

Root

9

Page 10: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Structures driven by permissions /public /private

By organizational structure /customers/lufthansa/systems/...  

Access Control

10

Page 11: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

REFERENCEs imply referential integrity

Two documents linked via a reference... cannot be imported/exported separately

create larger transactional boundary

UUID reference is not human readable

WEAKREFERENCE  still relies on UUIDs

Better use soft references STRING with node path

code: handle missing target without failure

#5 References considered harmful

11

Page 12: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Lazy references Scalability

Priviliges: tag librarian vs. content author

Tags under /etc/tags taxonomy, titles, metadata etc.

Tagged resources: cq:tags property

array: [stockphotography:animals/birds]

not automatically updated when tags change

Tagging

12

Page 13: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Fixed structures below a base

Referenced by path

/home (~)

/content/campaigns

/libs/*/* (components)

/etc/packages/day/product/550/...

Flexible hierarchies

13

Page 14: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Overlays: /apps over /libs

projects over product, custom over default

Samples resource types: foundation/components/text

tags: geometrixx:activity/biking

or: /etc/tags/geometrixx-­‐outdoors/activity/biking

Relative paths

14

Page 15: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Files and folder-like elements should use nt:file and nt:folder

Built-in node types maximize re-use HTTP range download, WebDAV

Allows mime-type and meta data

If content needs binary data (eg. an image) add a sub-node of type nt:file

for a list, add a sub-node of nt:folder

#6 Files are Files are Files

15

Page 16: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

Embed in pages

Assets have renditions

Using nt:file

Images

16

Page 17: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

IDs necessary in RDBMS for relations Not required in JCR at all, see #5

Use a proper content hierarchy instead find node names for your content

greatly enhances explorability /mails/38956 vs. /mails/2008/08/14/happy_birthday

Naming title of the object

hierarchy: categories, dates, letter-groups

#7 ID's are evil

17

Page 18: A JCR View of the World - adaptTo() 2012 Berlin

adaptTo() 2012

If nothing works, dates work .../2012/09/26/...

Samples Calendar

Blog /var/statistics/queries ~/activities/foo/2012/09/12/...

Date based structures

18

Page 19: A JCR View of the World - adaptTo() 2012 Berlin

APACHE SLING & FRIENDS TECH MEETUPBERLIN, 26-28 SEPTEMBER 2012

Thank You!Alexander Klimetschek, Adobe

19