2008-12 OJUG JCR Demo

P
Paul HeaberlinSoftware Developer
JAVA CONTENT REPOSITORY
WITH JACKRABBIT
Omaha Java Users Group
2008-12-09

Paul Heaberlin
paul@heaberlin.net
Overview
• Intro
  What is JCR?
  What can you use JCR for?

• JCR Basic Structure
  Repositories, Workspaces and Nodes Galore!

• JSR-170 Compliance Levels
  Level 1 - Read Only Repository
  Level 2 - Read and Write
  Optional - Versioning, Transactions and More

• Demo!
What is JCR?
• JSR-170 defines the Java Content Repository (JCR) API

• First approved June 17, 2005, last updated March 1, 2006

• JCR is just an API, it is NOT a Content Repository

• Jackrabbit IS a Content Repository, that implements JSR-170

• JCR provides a universal way to access content within a repository

• Similar to what JDBC did for RDBMS, JCR does for content repositories
What can you use JCR for?
• Common access multiple Content Repositories from different Providers

• Other things...
JCR Basic
Structure

• A Repository has Workspaces


• A Workspace is a tree of Items


• An Item is a Node or Property


• A Property can only be a leaf


• Property Values hold the data


• A Session is used to access a
  Workspace in the Repository


• Nodes can have Types
Level 1 Compliance - Read Only Repository
• Access the Repository

• Read Repository Content

• Export Repository Content

• Search the Repository (via XPath)

• Discover configured Node Types

• Remap Namespaces within Session
Level 2 Compliance - Level 1 + Edits
• Add, Remove or Modify Nodes and Properties

• Import Repository Content

• Assign Node Types to Nodes

• Add, Remove or Modify Namespaces
Optional Features
• Can be part of Level 1 or Level 2 compliant implementation

• Transactions: Adhere to JTA Spec, support container & user managed

• Versioning: Allow checkin and checkout of Nodes

• Observation: Applications can “register interest in events that describe
  changes to a workspace, and then monitor and respond” to them

• Locking: Allow temporary locking of Nodes to prevent changes

• Search via SQL: Use SQL to query in addition to XPath
Demo!
• Follow Jackrabbit First Hops

• Add in some Versioning

• Do some Querying
Demo - Jackrabbit Hops
• FirstHop.java
  Access the Repository
  Find and display features of this implementation

• SecondHop.java
  Add Nodes
  Add a Property
  Get a Node and Property
  Navigate over the Repository
JCR Demo - Versioning
• VersionDemo.java
  Try to find a Node
  If not found, add it
  Once have Node, modify a Property

• Execute this with the following arguments to see the Node change
  1: default versioning versionThis quot;this is my first valuequot;
  2: default versioning versionThis quot;I have been changed!quot;

• Look at final line of ouput, should see
  1: versionThis = this is my first value
  2: versionThis = I have been changed!
JCR Demo - Fun with Queries
• QueryDemo.java
  Run an XPath query on a Workspace
  Display the results

• After executing the VersionDemo, the workspace has Nodes to query

• Run this with the following arguments
  1: default quot;//versioningquot;

• This will display 2 results: A table like below, & all properties of the Node
 |      jcr:primaryType ||             jcr:path ||            jcr:score |
 ________________________________________________________________________
 |      nt:unstructured ||          /versioning ||                 1000 |
Other Cool Stuff
• Apache Sling: JCR + REST = something that quot;is almost painfully hip, in
  a way only a dedicated nerd could appreciatequot;
  Home: http://incubator.apache.org/sling/
  Overview: http://www.unc.edu/home/adamc/sling-overview.html

• JCROM/Jackrabbit OCM: Object-content mapping, like JPA for the JCR
  http://jackrabbit.apache.org/jackrabbit-ocm.html
  http://code.google.com/p/jcrom/

• JSR-283: JCR 2.0 - adding enhancements like federation, remoting,
  more standard node types, and better access control.
  Spec: http://jcp.org/en/jsr/detail?id=283
Resources
• JSR-170 Specification: Defines JCR 1.0
  Spec: http://jcp.org/en/jsr/detail?id=170
  API: http://www.day.com/maven/jsr170/javadocs/jcr-1.0/

• Apache Jackrabbit: Reference Implementation for JSR-170
  Home: http://jackrabbit.apache.org/
  API: http://jackrabbit.apache.org/api/1.5/ (as of last night, Dec 8)

• Introducing the Java Content Repository API
  http://www.ibm.com/developerworks/java/library/j-jcr/

• Catch Jackrabbit and the Java Content Repository API
  http://www.artima.com/lejava/articles/contentrepository.html
More Resources
• What is Java Content Repository?
  http://www.onjava.com/pub/a/onjava/2006/10/04/what-is-java-content-
  repository.html

• Advanced Java Content Repository API
  http://www.onjava.com/pub/a/onjava/2006/11/08/advanced-java-
  content-repository.html

• Day Dev Blog: Lead contributors to Jackrabbit, Sling and all things JCR
  http://dev.day.com/

• Post: http://paul.heaberlin.net/2008/12/ojug-presentation-on-jcr.html
  Slides: http://www.slideshare.net/lobsterboy1980
  Demo Code: http://cid-61cb9c642b07d62e.skydrive.live.com/
  browse.aspx/OJUG
1 of 15

Recommended

Mongrel Handlers by
Mongrel HandlersMongrel Handlers
Mongrel HandlersVishnu Gopal
1.1K views29 slides
Workin On The Rails Road by
Workin On The Rails RoadWorkin On The Rails Road
Workin On The Rails RoadRubyOnRails_dude
655 views71 slides
Ugo Cei Presentation by
Ugo Cei PresentationUgo Cei Presentation
Ugo Cei PresentationRubyOnRails_dude
1.8K views36 slides
Till Vollmer Presentation by
Till Vollmer PresentationTill Vollmer Presentation
Till Vollmer PresentationRubyOnRails_dude
968 views30 slides
Ola Bini J Ruby Power On The Jvm by
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvmdeimos
1.1K views42 slides

More Related Content

What's hot

Advance java session 15 by
Advance java session 15Advance java session 15
Advance java session 15Smita B Kumar
83 views14 slides
JCR - Java Content Repositories by
JCR - Java Content RepositoriesJCR - Java Content Repositories
JCR - Java Content RepositoriesCarsten Ziegeler
5.8K views51 slides
Angular JS in 2017 by
Angular JS in 2017Angular JS in 2017
Angular JS in 2017Ayush Sharma
132 views56 slides
20141210 rakuten techtalk by
20141210 rakuten techtalk20141210 rakuten techtalk
20141210 rakuten techtalkHiroshi SHIBATA
3.9K views100 slides
Http programming in play by
Http programming in playHttp programming in play
Http programming in playKnoldus Inc.
4.2K views45 slides
Introduction to Node.js Platform by
Introduction to Node.js PlatformIntroduction to Node.js Platform
Introduction to Node.js PlatformNaresh Chintalcheru
2K views21 slides

What's hot(20)

Http programming in play by Knoldus Inc.
Http programming in playHttp programming in play
Http programming in play
Knoldus Inc.4.2K views
RESTful web service with JBoss Fuse by ejlp12
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
ejlp126.3K views
Faster & Greater Messaging System HornetQ zzz by JBug Italy
Faster & Greater Messaging System HornetQ zzzFaster & Greater Messaging System HornetQ zzz
Faster & Greater Messaging System HornetQ zzz
JBug Italy3.7K views
mruby で mackerel のプラグインを作るはなし by Hiroshi SHIBATA
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなし
Hiroshi SHIBATA12.8K views
Angels And Daemons by Vishnu Gopal
Angels And DaemonsAngels And Daemons
Angels And Daemons
Vishnu Gopal4.3K views
Rails Application Optimization Techniques & Tools by guest05c09d
Rails Application Optimization Techniques & ToolsRails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & Tools
guest05c09d4.9K views
Maven and j unit introduction by Sergii Fesenko
Maven and j unit introductionMaven and j unit introduction
Maven and j unit introduction
Sergii Fesenko209 views
JAXB: Create, Validate XML Message and Edit XML Schema by Sitdhibong Laokok
JAXB: Create, Validate XML Message and Edit XML SchemaJAXB: Create, Validate XML Message and Edit XML Schema
JAXB: Create, Validate XML Message and Edit XML Schema
Sitdhibong Laokok7.8K views
Performance Optimization of Rails Applications by Serge Smetana
Performance Optimization of Rails ApplicationsPerformance Optimization of Rails Applications
Performance Optimization of Rails Applications
Serge Smetana8.8K views
Iurii Antykhovych "Java and performance tools and toys" by LogeekNightUkraine
Iurii Antykhovych "Java and performance tools and toys"Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"
Writing & Using Web Services by Rajarshi Guha
Writing & Using Web ServicesWriting & Using Web Services
Writing & Using Web Services
Rajarshi Guha1.8K views

Viewers also liked

Introducing Apricot, The Eclipse Content Management Platform by
Introducing Apricot, The Eclipse Content Management PlatformIntroducing Apricot, The Eclipse Content Management Platform
Introducing Apricot, The Eclipse Content Management PlatformNuxeo
690 views36 slides
The Java Content Repository by
The Java Content RepositoryThe Java Content Repository
The Java Content Repositorynobby
908 views35 slides
Cms integration of apache solr how we did it. by
Cms integration of apache solr   how we did it.Cms integration of apache solr   how we did it.
Cms integration of apache solr how we did it.lucenerevolution
2.9K views22 slides
Hippo get together presentation solr integration by
Hippo get together presentation   solr integrationHippo get together presentation   solr integration
Hippo get together presentation solr integrationHippo
1.8K views113 slides
Hippo CMS at OpenCo Amsterdam 2014 by
Hippo CMS at OpenCo Amsterdam 2014Hippo CMS at OpenCo Amsterdam 2014
Hippo CMS at OpenCo Amsterdam 2014Tjeerd Brenninkmeijer
816 views26 slides
Web Applications Development by
Web Applications DevelopmentWeb Applications Development
Web Applications Developmentriround
500 views23 slides

Viewers also liked(20)

Introducing Apricot, The Eclipse Content Management Platform by Nuxeo
Introducing Apricot, The Eclipse Content Management PlatformIntroducing Apricot, The Eclipse Content Management Platform
Introducing Apricot, The Eclipse Content Management Platform
Nuxeo690 views
The Java Content Repository by nobby
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
nobby908 views
Cms integration of apache solr how we did it. by lucenerevolution
Cms integration of apache solr   how we did it.Cms integration of apache solr   how we did it.
Cms integration of apache solr how we did it.
lucenerevolution2.9K views
Hippo get together presentation solr integration by Hippo
Hippo get together presentation   solr integrationHippo get together presentation   solr integration
Hippo get together presentation solr integration
Hippo1.8K views
Web Applications Development by riround
Web Applications DevelopmentWeb Applications Development
Web Applications Development
riround500 views
Hippo get together workshop automatic export by Hippo
Hippo get together   workshop automatic exportHippo get together   workshop automatic export
Hippo get together workshop automatic export
Hippo847 views
JCR In Action (ApacheCon US 2009) by Carsten Ziegeler
JCR In Action (ApacheCon US 2009)JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)
Carsten Ziegeler4.5K views
Rapid JCR Applications Development with Sling by Felix Meschberger
Rapid JCR Applications Development with SlingRapid JCR Applications Development with Sling
Rapid JCR Applications Development with Sling
Felix Meschberger4.2K views
App and web with Hippo CMS and AngularJS by Peter Broekroelofs
App and web with Hippo CMS and AngularJS App and web with Hippo CMS and AngularJS
App and web with Hippo CMS and AngularJS
Peter Broekroelofs1.4K views
Introducing Hippo CMS 10.2 by Hippo
Introducing Hippo CMS 10.2Introducing Hippo CMS 10.2
Introducing Hippo CMS 10.2
Hippo 1.1K views
Build Your Own CMS with Apache Sling by Bob Paulin
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
Bob Paulin15.8K views
Hippo gettogether april 2012 faceted navigation a tale of daemons by Hippo
Hippo gettogether april 2012 faceted navigation   a tale of daemonsHippo gettogether april 2012 faceted navigation   a tale of daemons
Hippo gettogether april 2012 faceted navigation a tale of daemons
Hippo861 views
The Zero Bullshit Architecture by Lars Trieloff
The Zero Bullshit ArchitectureThe Zero Bullshit Architecture
The Zero Bullshit Architecture
Lars Trieloff6K views
Hippo CMS Integration Patterns by Jeroen Reijn
Hippo CMS Integration PatternsHippo CMS Integration Patterns
Hippo CMS Integration Patterns
Jeroen Reijn2.8K views

Similar to 2008-12 OJUG JCR Demo

New Features of Java7 SE by
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SEdogangoko
1.2K views56 slides
Java script core by
Java script coreJava script core
Java script coreVaishnu Vaishu
211 views28 slides
Java EE 6 workshop at Dallas Tech Fest 2011 by
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
1.2K views39 slides
LuSql: (Quickly and easily) Getting your data from your DBMS into Lucene by
LuSql: (Quickly and easily) Getting your data from your DBMS into LuceneLuSql: (Quickly and easily) Getting your data from your DBMS into Lucene
LuSql: (Quickly and easily) Getting your data from your DBMS into Luceneeby
2.3K views29 slides
Application Architecture Trends by
Application Architecture TrendsApplication Architecture Trends
Application Architecture TrendsSrini Penchikala
2K views35 slides
Unit testing hippo by
Unit testing hippoUnit testing hippo
Unit testing hippoEbrahim Aharpour
286 views33 slides

Similar to 2008-12 OJUG JCR Demo(20)

New Features of Java7 SE by dogangoko
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SE
dogangoko1.2K views
Java EE 6 workshop at Dallas Tech Fest 2011 by Arun Gupta
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
Arun Gupta1.2K views
LuSql: (Quickly and easily) Getting your data from your DBMS into Lucene by eby
LuSql: (Quickly and easily) Getting your data from your DBMS into LuceneLuSql: (Quickly and easily) Getting your data from your DBMS into Lucene
LuSql: (Quickly and easily) Getting your data from your DBMS into Lucene
eby2.3K views
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010 by Arun Gupta
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Arun Gupta1.7K views
PHPCR - Standard Content Repository for PHP by Henri Bergius
PHPCR - Standard Content Repository for PHPPHPCR - Standard Content Repository for PHP
PHPCR - Standard Content Repository for PHP
Henri Bergius2.4K views
Java Performance and Using Java Flight Recorder by Isuru Perera
Java Performance and Using Java Flight RecorderJava Performance and Using Java Flight Recorder
Java Performance and Using Java Flight Recorder
Isuru Perera2.5K views
JavaScript Library Overview by jeresig
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
jeresig30.7K views
In-memory No SQL- GIDS2014 by Hazelcast
In-memory No SQL- GIDS2014In-memory No SQL- GIDS2014
In-memory No SQL- GIDS2014
Hazelcast602 views
Ajax Tutorial by oscon2007
Ajax TutorialAjax Tutorial
Ajax Tutorial
oscon2007606 views
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat) by OpenBlend society
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Introduction to Java by RatnaJava
Introduction to Java Introduction to Java
Introduction to Java
RatnaJava135 views
Jakarta EE Test Strategies (2022) by Ryan Cuprak
Jakarta EE Test Strategies (2022)Jakarta EE Test Strategies (2022)
Jakarta EE Test Strategies (2022)
Ryan Cuprak13 views
Application Profiling for Memory and Performance by pradeepfn
Application Profiling for Memory and PerformanceApplication Profiling for Memory and Performance
Application Profiling for Memory and Performance
pradeepfn1.7K views
Automated Performance Testing With J Meter And Maven by PerconaPerformance
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
PerconaPerformance5.2K views
Content Storage With Apache Jackrabbit by Jukka Zitting
Content Storage With Apache JackrabbitContent Storage With Apache Jackrabbit
Content Storage With Apache Jackrabbit
Jukka Zitting21.7K views
DPC2007 PHP And Oracle (Kuassi Mensah) by dpc
DPC2007 PHP And Oracle (Kuassi Mensah)DPC2007 PHP And Oracle (Kuassi Mensah)
DPC2007 PHP And Oracle (Kuassi Mensah)
dpc849 views

Recently uploaded

Innovation & Entrepreneurship strategies in Dairy Industry by
Innovation & Entrepreneurship strategies in Dairy IndustryInnovation & Entrepreneurship strategies in Dairy Industry
Innovation & Entrepreneurship strategies in Dairy IndustryPervaizDar1
39 views26 slides
This talk was not generated with ChatGPT: how AI is changing science by
This talk was not generated with ChatGPT: how AI is changing scienceThis talk was not generated with ChatGPT: how AI is changing science
This talk was not generated with ChatGPT: how AI is changing scienceElena Simperl
34 views13 slides
Cencora Executive Symposium by
Cencora Executive SymposiumCencora Executive Symposium
Cencora Executive Symposiummarketingcommunicati21
174 views14 slides
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」 by
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」PC Cluster Consortium
27 views12 slides
NTGapps NTG LowCode Platform by
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform Mustafa Kuğu
474 views30 slides
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell by
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M SnellFwdays
14 views30 slides

Recently uploaded(20)

Innovation & Entrepreneurship strategies in Dairy Industry by PervaizDar1
Innovation & Entrepreneurship strategies in Dairy IndustryInnovation & Entrepreneurship strategies in Dairy Industry
Innovation & Entrepreneurship strategies in Dairy Industry
PervaizDar139 views
This talk was not generated with ChatGPT: how AI is changing science by Elena Simperl
This talk was not generated with ChatGPT: how AI is changing scienceThis talk was not generated with ChatGPT: how AI is changing science
This talk was not generated with ChatGPT: how AI is changing science
Elena Simperl34 views
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」 by PC Cluster Consortium
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu474 views
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell by Fwdays
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
Fwdays14 views
"Package management in monorepos", Zoltan Kochan by Fwdays
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan Kochan
Fwdays37 views
What is Authentication Active Directory_.pptx by HeenaMehta35
What is Authentication Active Directory_.pptxWhat is Authentication Active Directory_.pptx
What is Authentication Active Directory_.pptx
HeenaMehta3515 views
Mobile Core Solutions & Successful Cases.pdf by IPLOOK Networks
Mobile Core Solutions & Successful Cases.pdfMobile Core Solutions & Successful Cases.pdf
Mobile Core Solutions & Successful Cases.pdf
IPLOOK Networks16 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
GDSC GLAU Info Session.pptx by gauriverrma4
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptx
gauriverrma415 views
"Node.js Development in 2024: trends and tools", Nikita Galkin by Fwdays
"Node.js Development in 2024: trends and tools", Nikita Galkin "Node.js Development in 2024: trends and tools", Nikita Galkin
"Node.js Development in 2024: trends and tools", Nikita Galkin
Fwdays37 views
Initiating and Advancing Your Strategic GIS Governance Strategy by Safe Software
Initiating and Advancing Your Strategic GIS Governance StrategyInitiating and Advancing Your Strategic GIS Governance Strategy
Initiating and Advancing Your Strategic GIS Governance Strategy
Safe Software198 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li104 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue209 views

2008-12 OJUG JCR Demo

  • 1. JAVA CONTENT REPOSITORY WITH JACKRABBIT Omaha Java Users Group 2008-12-09 Paul Heaberlin paul@heaberlin.net
  • 2. Overview • Intro What is JCR? What can you use JCR for? • JCR Basic Structure Repositories, Workspaces and Nodes Galore! • JSR-170 Compliance Levels Level 1 - Read Only Repository Level 2 - Read and Write Optional - Versioning, Transactions and More • Demo!
  • 3. What is JCR? • JSR-170 defines the Java Content Repository (JCR) API • First approved June 17, 2005, last updated March 1, 2006 • JCR is just an API, it is NOT a Content Repository • Jackrabbit IS a Content Repository, that implements JSR-170 • JCR provides a universal way to access content within a repository • Similar to what JDBC did for RDBMS, JCR does for content repositories
  • 4. What can you use JCR for? • Common access multiple Content Repositories from different Providers • Other things...
  • 5. JCR Basic Structure • A Repository has Workspaces • A Workspace is a tree of Items • An Item is a Node or Property • A Property can only be a leaf • Property Values hold the data • A Session is used to access a Workspace in the Repository • Nodes can have Types
  • 6. Level 1 Compliance - Read Only Repository • Access the Repository • Read Repository Content • Export Repository Content • Search the Repository (via XPath) • Discover configured Node Types • Remap Namespaces within Session
  • 7. Level 2 Compliance - Level 1 + Edits • Add, Remove or Modify Nodes and Properties • Import Repository Content • Assign Node Types to Nodes • Add, Remove or Modify Namespaces
  • 8. Optional Features • Can be part of Level 1 or Level 2 compliant implementation • Transactions: Adhere to JTA Spec, support container & user managed • Versioning: Allow checkin and checkout of Nodes • Observation: Applications can “register interest in events that describe changes to a workspace, and then monitor and respond” to them • Locking: Allow temporary locking of Nodes to prevent changes • Search via SQL: Use SQL to query in addition to XPath
  • 9. Demo! • Follow Jackrabbit First Hops • Add in some Versioning • Do some Querying
  • 10. Demo - Jackrabbit Hops • FirstHop.java Access the Repository Find and display features of this implementation • SecondHop.java Add Nodes Add a Property Get a Node and Property Navigate over the Repository
  • 11. JCR Demo - Versioning • VersionDemo.java Try to find a Node If not found, add it Once have Node, modify a Property • Execute this with the following arguments to see the Node change 1: default versioning versionThis quot;this is my first valuequot; 2: default versioning versionThis quot;I have been changed!quot; • Look at final line of ouput, should see 1: versionThis = this is my first value 2: versionThis = I have been changed!
  • 12. JCR Demo - Fun with Queries • QueryDemo.java Run an XPath query on a Workspace Display the results • After executing the VersionDemo, the workspace has Nodes to query • Run this with the following arguments 1: default quot;//versioningquot; • This will display 2 results: A table like below, & all properties of the Node | jcr:primaryType || jcr:path || jcr:score | ________________________________________________________________________ | nt:unstructured || /versioning || 1000 |
  • 13. Other Cool Stuff • Apache Sling: JCR + REST = something that quot;is almost painfully hip, in a way only a dedicated nerd could appreciatequot; Home: http://incubator.apache.org/sling/ Overview: http://www.unc.edu/home/adamc/sling-overview.html • JCROM/Jackrabbit OCM: Object-content mapping, like JPA for the JCR http://jackrabbit.apache.org/jackrabbit-ocm.html http://code.google.com/p/jcrom/ • JSR-283: JCR 2.0 - adding enhancements like federation, remoting, more standard node types, and better access control. Spec: http://jcp.org/en/jsr/detail?id=283
  • 14. Resources • JSR-170 Specification: Defines JCR 1.0 Spec: http://jcp.org/en/jsr/detail?id=170 API: http://www.day.com/maven/jsr170/javadocs/jcr-1.0/ • Apache Jackrabbit: Reference Implementation for JSR-170 Home: http://jackrabbit.apache.org/ API: http://jackrabbit.apache.org/api/1.5/ (as of last night, Dec 8) • Introducing the Java Content Repository API http://www.ibm.com/developerworks/java/library/j-jcr/ • Catch Jackrabbit and the Java Content Repository API http://www.artima.com/lejava/articles/contentrepository.html
  • 15. More Resources • What is Java Content Repository? http://www.onjava.com/pub/a/onjava/2006/10/04/what-is-java-content- repository.html • Advanced Java Content Repository API http://www.onjava.com/pub/a/onjava/2006/11/08/advanced-java- content-repository.html • Day Dev Blog: Lead contributors to Jackrabbit, Sling and all things JCR http://dev.day.com/ • Post: http://paul.heaberlin.net/2008/12/ojug-presentation-on-jcr.html Slides: http://www.slideshare.net/lobsterboy1980 Demo Code: http://cid-61cb9c642b07d62e.skydrive.live.com/ browse.aspx/OJUG