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

878 views
761 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
878
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
29
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

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

  1. 1. APACHE SLING & FRIENDS TECH MEETUP BERLIN, 26-28 SEPTEMBER 2012 A JCR view of the worldAlexander Klimetschek, Adobe 1
  2. 2. JCR CONTENT REPOSITORY FEATURES OF AN FEATURES OF A RDBMS FILESYSTEM Transactions, Query, Structure, Integrity Binaries, Hierarchy, Locking, Access Control + ALL THE OTHER GOOD STUFF YOU ALWAYS WANTED Data First, Versioning, Full-text, Multi-Value, Sort-Order, ObservationadaptTo() 2012 2
  3. 3. David`s Model 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/DavidsModeladaptTo() 2012 3
  4. 4. David`s Model 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/DavidsModeladaptTo() 2012 4
  5. 5. #1 Data first, Structure later  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:FolderadaptTo() 2012 5
  6. 6. Pages / Documents Outer hierarchy hierarchy  files & folders Inner document structure  micro tree  separated by jcr:content nt:hierarchyNode document  used for replication in CQ Pages: generic UIs & authoring  /etc/replication adaptTo() 2012 6
  7. 7. Shadow paths  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.pageadaptTo() 2012 7
  8. 8. #2 Drive the Content Hierarchy  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 modelsadaptTo() 2012 8
  9. 9. Root  Inspiration: Unix filesystem  for CMS  /content  /apps over /libs  mess: /etcadaptTo() 2012 9
  10. 10. Access Control  Structures driven by permissions  /public  /private  By organizational structure  /customers/lufthansa/systems/...  adaptTo() 2012 10
  11. 11. #5 References considered harmful  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 failureadaptTo() 2012 11
  12. 12. Tagging 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 adaptTo() 2012 12
  13. 13. Flexible hierarchies  Fixed structures below a base  Referenced by path  /home (~)  /content/campaigns  /libs/*/* (components)  /etc/packages/day/product/550/...adaptTo() 2012 13
  14. 14. Relative paths  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/bikingadaptTo() 2012 14
  15. 15. #6 Files are Files are Files  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:folderadaptTo() 2012 15
  16. 16. Images Embed in pages Assets have renditions Using nt:fileadaptTo() 2012 16
  17. 17. #7 IDs are evil  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-groupsadaptTo() 2012 17
  18. 18. Date based structures  If nothing works, dates work  .../2012/09/26/...  Samples  Calendar  Blog  /var/statistics/queries  ~/activities/foo/2012/09/12/...adaptTo() 2012 18
  19. 19. APACHE SLING & FRIENDS TECH MEETUP BERLIN, 26-28 SEPTEMBER 2012 Thank You!Alexander Klimetschek, Adobe 19

×