Introduction to JCR and Apache Jackrabbi

50 %
50 %
Information about Introduction to JCR and Apache Jackrabbi

Published on November 20, 2008

Author: jukka


Introduction to JCR and Apache Jackrabbit Jukka Zitting ApacheCon US 2008

JCR Crash Course! import javax.jcr.*; import org.apache.jackrabbit.core.TransientRepository; repository = new TransientRepository (); println repository. getDescriptor (Repository.REP_NAME_DESC); Jackrabbit


Sessions and Workspaces credentials = new SimpleCredentials( “username”, “password”. toCharArray ()); session = repository. login (credentials) workspace = session. getWorkspace () println workspace. getName () default println workspace. getAccessibleWorkspaceNames () { “default” }


{ “default” }

Node Hierarchy root = session. getRootNode (); foo = root. addNode ("foo"); bar = root. addNode ("bar"); baz = bar. addNode ("baz"); println baz. getPath (); /bar/baz


Properties a = foo. setProperty ("A", "abc"); b = foo. setProperty ("B", "123"); println b. getPath (); /foo/B println b. getLong () + 321; 444



Transient State other = repository. login (); println other. itemExists ("/foo"); false session. save (); println other. itemExists ("/foo"); true



XPath Query qm = workspace. getQueryManager (); query = qm. createQuery ( "//*[A = 'abc']", "xpath"); nodes = query. execute (). getNodes (); println nodes. nextNode (). getPath (); /foo


SQL Query query = qm. createQuery ( "SELECT * FROM nt:base” + “ WHERE A = 'abc'", "sql"); rows = query. execute (). getRows (); println rows. nextRow () . getValue ("jcr:path"). getString () /foo


And Remember! session. logout () other. logout ()

Content Modeling nt:hierarchyNode nt:folder nt:file nt:linkedFile nt:resource

Bottom-Up Modeling my:resource > nt:resource codec (string) bitrate (long) my:tune > nt:file artist (string) release date (date) my:album > nt:folder artist (string) release date (date) my:review > nt:file author (string) star rating (long)

codec (string)

bitrate (long)

artist (string)

release date (date)

artist (string)

release date (date)

author (string)

star rating (long)

Top-Down Modeling Album Images Tune Band Label Label Tune Album Reviews Label Band Reviews Tune Images

Finding Content by Reference Rock tags tunes Tune Tune Classic Top 10 playlists Picks link link link

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(*,‘…’)

Versioning and Publishing Version store Live Staging

Add a comment

Related presentations

Related pages

Setting up a Jackrabbit persistence manager - Community ...

Introduction. Apache Jackrabbit is a fully featured content repository that implements the entire JCR API (JCR is the acronym of the Content Repository for ...
Read more

Jcr | LinkedIn

... Resource Resolver Factory Vanities Apache ... Introduction to JCR and Apache Jackrabbi. 6,843 Views. bdelacretaz. Taming Jcr With Sling. 6,203 Views.
Read more

When to use JCR (content repository) over other options?

Introduction to JCR and Apache Jackrabbit [6] by Jukka Zitting; Overview of ModeShape [7] by Randall Hauch; Java Content Repository: The Best Of Both ...
Read more

JCR ENGINEERING | California, Riverside

★ Jcr Engineering ★ 1473 W Linden St, ... JSR 170: The Key to Unlocking Content Repositories; Introduction to JCR and Apache Jackrabbi; ...
Read more

[Jackrabbit-Commits] Svn commit: r1706422 - in /jackrabbit ...

... 1706422 URL: ... jcr-client/ Jackrabbit-jcr-commons/ Jackrabbit-jcr-rmi/ Jackrabbit-jcr-server/ Jackrabbi ...
Read more

[Jackrabbit-Commits] Svn commit: r1710553 - in /jackrabbit ...

... 1710553 URL: ... jcr-client/ Jackrabbit-jcr-commons/ Jackrabbit-jcr-rmi/ Jackrabbit-jcr-server/ Jackrabbi ...
Read more

Jackrabbit | UNISK;ウニークスオフィシャルブログ

Apache Slingはコンテンツの保存先としてJavaコンテンツリポジトリ(JCR)を ... jar org.apache. sling ... Introduction to Node.js ...
Read more