2. Chad Davis
● Java Software Engineer
● Colorado Springs Open Source Meetup
● Blackdog Software, Inc.
● Author
– Struts 2 in Action
– Sun Certified Mobile Application Developer Exam Guide
● Corporate Trainer – Struts 2
● Content Management System
● Am I a DBA?
3. Development without Constraint
( or Integrity? )
An Introduction to the Content Repository API for Java (JCR)
&
“RDBMS v. Object Storage” Discussion
4. Our Itinerary
● Introduction to the Content Repository API
for Java ( JCR )
● Development without Constraint ( or
Integrity? )
● “Is my project a match for the JCR?”
5. The Java Content Repository
( JCR )
● Java Specification
● JSR 170 ( 1.x )
● JSR 268 ( 2.x )
● How did this come to be a part of Java?
6. Jackrabbit
● Open Source (Apache Project)
● Reference Implementation
● “A content repository is a hierarchical content
store . . .”
● For “content-oriented” applications
● Anybody want to take a stab at defining “content-
oriented”?
7. Content?
● Blame the Web
● Blame the Scope Creep of IT
● Documents
● Binaries / Digital Assets
● Unpredictable Structure
● Meta-data
8. Bells and Whistles
● Version Control
● Full Text Search
● Observation (Event Handling)
● Unstructured / Structured Content
● Transactions
● Workspaces
● And more . . .
9. Data Model
● Hierarchical
● Unstructured
● Or Structured
10. Hierarchical Data is Natural
● File Systems
● XML
● DNS
● DOM
● Biology
● Taxonomy
11.
12.
13. The Hierachy
● Full Paths are ID's
● Hiearchy is Semantic
● Fast Navigation/Location
● Human Readable
23. API Tour: Navigation
● Iterator Over Child Nodes
NodeIterator personalContactsItty = personal.getNodes();
● Iterator Over Properties
PropertyIterator propItty = bobNode.getProperties;
24. API Tour: Creating
● Create Node and Properties
chadNode = personalContactsNode.addNode(“Chad Davis”);
chadNode.setProperty ( “email”, “chad@mail.com”);
//binaries
Binary picBinary = valueFactory.createBinary(picInputStream);
Value fileValue = valueFactory.createValue(picBinary);
contentNode.setProperty("jcr:data", fileValue);
25. API Tour: Query
● SQL, XPath, JQOM
● Full Text Search
xpathExp = “/contacts/personal/element(*,nt:unstructured[jcr:contains(.,'hotmail')]";
queryMng = session.getWorkspace().getQueryManager();
query = QueryMng.createQuery(xpathExp, Query.XPATH);
results = query.execute();
● All Properties and Node Names Included in Full Text Search
● Binaries Too!
26. API Tour: Query
● Saving Queries to Repo
query.storeAsNode(“/queries/chad/query1”);
27. API Tour: Version Control
● Labels
● Merge
● Check In New Version
versionMngr = session.getWorkspace().getVersionManager();
newVersion = versionManager.checkin( nodeToCommit.getPath() );
versionHist = versionMngr.getVersionHistory( nodeToCommit.getPath() );
versionHistory.addVersionLabel( newVersion.getName(), label, false );
28. API Tour: Version Control
● Restore to Other Version
versionMngr = session.getWorkspace().getVersionManager();
VersionHistory = versionMngr.getVersionHistory( targetNode.getPath());
targetVersion = versionHistory.getVersionByLabel(versionLabel);
versionManager.restore(targetVersion, false);
29. End of JCR Tour
● Jackrabbit
● Content Management Systems
● Artifact Management
● Operations Management
30. RDBMS v. Object Storage
“Schema-less databases and document-oriented databases are a
paradigm shift, and it provides bigger programmer challenges than
something like picking up a new language. I would liken it to the
transition from procedural to object oriented programming.”
--Scott Swigart, “How Software is Built”
32. The Relational Model
● Hegemonic Concept
● Mathematical
● Taught in Every DB Course
● 1970's
33. Edgar Frank "Ted" Codd
●
IBM
●
Invented the Relational
Model
●
"A Relational Model of Data
for Large Shared Data Banks"
●
1970
●
“Is Your DBMS Really
Relational?"
●
“Does Your DBMS Run By the
Rules?”
34. Goals of Relational Model
● Mathematical
– Efficiency
– Resource Friendly
– Powerful Operations
● Program-Data Independence
– More than one app can access data
– Consider file based data persistence
35. Goals of Relational Model
● Data Integrity
● Column Constraints
● Referential Integrity
● Normalization
– Insert, Update and Delete Anomalies
– Data redundancy
– 3NF
36. Structure Driven Development
● Database Design
● Upfront Concretization of Data Model
● DDL
● Tables
● Structure Comes Before Data
● Heavy Weight
● Formal
39. Impedance Mismatch
● Object-Relational
– Hibernate
● Data Types
– 1970 – No Web
– 2010 – Content, Documents, Tweets
– JSON As Storage Format?
● Structure First
– Data First
– Agile Development
● Program-Data independence
– This architectural imperitive has also shifted, but I can't quite
express it . . .
40. New Stuff
● NoSQL
● Schemaless DB
● Object DB
● Content Repository
● Document-Oriented DB
42. The Case for Jackrabbit
● Coy Data
– Data Driven Development
– Agile
● Naturally Hierarchical Data
● “Content” Oriented Data
● Navigation / Query
● Integrity?
43. The Case for RDBMS
● Interrelated Data
● Lots of Joins
● Flat Data
● Operations