Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

2008-12 OJUG JCR Demo

The December 2008 Omaha Java Users Group (OJUG) presentation on the JSR-170 defined Java Content Repository (JCR) API. Presentation by Paul Heaberlin.

  • Login to see the comments

2008-12 OJUG JCR Demo

  1. 1. JAVA CONTENT REPOSITORY WITH JACKRABBIT Omaha Java Users Group 2008-12-09 Paul Heaberlin
  2. 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. 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. 4. What can you use JCR for? • Common access multiple Content Repositories from different Providers • Other things...
  5. 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. 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. 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. 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. 9. Demo! • Follow Jackrabbit First Hops • Add in some Versioning • Do some Querying
  10. 10. Demo - Jackrabbit Hops • Access the Repository Find and display features of this implementation • Add Nodes Add a Property Get a Node and Property Navigate over the Repository
  11. 11. JCR Demo - Versioning • 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. 12. JCR Demo - Fun with Queries • 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. 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: Overview: • JCROM/Jackrabbit OCM: Object-content mapping, like JPA for the JCR • JSR-283: JCR 2.0 - adding enhancements like federation, remoting, more standard node types, and better access control. Spec:
  14. 14. Resources • JSR-170 Specification: Defines JCR 1.0 Spec: API: • Apache Jackrabbit: Reference Implementation for JSR-170 Home: API: (as of last night, Dec 8) • Introducing the Java Content Repository API • Catch Jackrabbit and the Java Content Repository API
  15. 15. More Resources • What is Java Content Repository? repository.html • Advanced Java Content Repository API content-repository.html • Day Dev Blog: Lead contributors to Jackrabbit, Sling and all things JCR • Post: Slides: Demo Code: browse.aspx/OJUG