Your SlideShare is downloading. ×
0
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Introduction to JCR and Apache Jackrabbi
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Introduction to JCR and Apache Jackrabbi

5,579

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,579
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
215
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Introduction to JCR and Apache Jackrabbit Jukka Zitting ApacheCon US 2008
  • 2. JCR Crash Course! <ul>import javax.jcr.*; import org.apache.jackrabbit.core.TransientRepository; repository = new TransientRepository (); println repository. getDescriptor (Repository.REP_NAME_DESC); </ul><ul><ul><li>Jackrabbit </li></ul></ul>
  • 3. Sessions and Workspaces <ul>credentials = new SimpleCredentials( “username”, “password”. toCharArray ()); session = repository. login (credentials) workspace = session. getWorkspace () println workspace. getName () </ul><ul><ul><li>default </li></ul></ul><ul>println workspace. getAccessibleWorkspaceNames () </ul><ul><ul><li>{ “default” } </li></ul></ul>
  • 4. Node Hierarchy <ul>root = session. getRootNode (); foo = root. addNode (&quot;foo&quot;); bar = root. addNode (&quot;bar&quot;); baz = bar. addNode (&quot;baz&quot;); println baz. getPath (); </ul><ul><ul><li>/bar/baz </li></ul></ul>
  • 5. Properties <ul>a = foo. setProperty (&quot;A&quot;, &quot;abc&quot;); b = foo. setProperty (&quot;B&quot;, &quot;123&quot;); println b. getPath (); </ul><ul><ul><li>/foo/B </li></ul></ul><ul>println b. getLong () + 321; </ul><ul><ul><li>444 </li></ul></ul>
  • 6. Transient State <ul>other = repository. login (); println other. itemExists (&quot;/foo&quot;); </ul><ul><ul><li>false </li></ul></ul><ul>session. save (); println other. itemExists (&quot;/foo&quot;); </ul><ul><ul><li>true </li></ul></ul>
  • 7. XPath Query <ul>qm = workspace. getQueryManager (); query = qm. createQuery ( &quot;//*[A = 'abc']&quot;, &quot;xpath&quot;); nodes = query. execute (). getNodes (); println nodes. nextNode (). getPath (); </ul><ul><ul><li>/foo </li></ul></ul>
  • 8. SQL Query <ul>query = qm. createQuery ( &quot;SELECT * FROM nt:base” + “ WHERE A = 'abc'&quot;, &quot;sql&quot;); rows = query. execute (). getRows (); println rows. nextRow () . getValue (&quot;jcr:path&quot;). getString () </ul><ul><ul><li>/foo </li></ul></ul>
  • 9. And Remember! <ul>session. logout () other. logout () </ul>
  • 10. Content Modeling nt:hierarchyNode nt:folder nt:file nt:linkedFile nt:resource
  • 11. Bottom-Up Modeling my:resource > nt:resource <ul><li>codec (string)
  • 12. bitrate (long) </li></ul>my:tune > nt:file <ul><li>artist (string)
  • 13. release date (date) </li></ul>my:album > nt:folder <ul><li>artist (string)
  • 14. release date (date) </li></ul>my:review > nt:file <ul><li>author (string)
  • 15. star rating (long) </li></ul>
  • 16. Top-Down Modeling Album Images Tune Band Label Label Tune Album Reviews Label Band Reviews Tune Images
  • 17. Finding Content by Reference Rock tags tunes Tune Tune Classic Top 10 playlists Picks link link link
  • 18. Finding Content by Search Looking for XPath SQL Latest releases /jcr:root/my:tunes//element(*,my:tune) [@released > xs:dateTime(‘…’)] SELECT * FROM my:tune WHERE jcr:path LIKE ‘/my:tunes/%’ AND released > DATE ‘…’ Reviews with keywords /jcr:root/my:tunes//element(*,my:review) /jcr:content[jcr:contains(.,’…’)] SELECT * FROM my:review WHERE jcr:path LIKE ‘/my:tunes/%’ AND CONTAINS(*,‘…’)
  • 19. Versioning and Publishing Version store Live Staging
  • 20. http://jackrabbit.apache.org/

×