JCR in Action. Content-based Applications with Apache Jackrabbit. Carsten Ziegeler.

Similar documents
Managing Installations and Provisioning of OSGi Applications. Carsten Ziegeler

APACHE SLING & FRIENDS TECH MEETUP BERLIN, SEPTEMBER APACHE JACKRABBIT: BASIC CONCEPTS Christian Riemath, Igor Sechyn

The State of Apache Sling

J a v a C o n t e n t R e p o s i t o r y. Senior Software Engineer Object Computing, Inc.

Java Content Repository JSR 170. Michal Malohlava

Carsten Ziegeler

Standards and the Portals Project

The Cocoon Portal. A portal solution and framework. Carsten Ziegeler Competence Center Open Source S&N AG, Germany

Adobe Experience Manager

Content Repository API for Java (JCR) & ModeShape. Jozef JBoss Community Team

Toromiro User Guide. Toromiro User Guide This is the Toromiro User Guide which will help you install, setup and work with Toromiro.

November Randall Hauch Project Lead

Rapid JCR applications development with Apache Sling

Nuxeo Roadmap. From Memphis to Chicago Nuxeo Team

Rapid JCR applications development with Apache Sling

JBoss DNA. Randall Hauch Principal Software Engineer JBoss Data Services

Frequently Asked Questions Oracle Content Management Integration. An Oracle White Paper June 2007

Extending JON 2.3 Use cases

What is Liferay and why do we need it? Vy Bui

Oracle Forms and Oracle APEX The Odd Couple

Adobe Experience Manager 6 Lead Developer Adobe Certified Expert Exam Guide. Exam number: 9A0-396

Concept - first iteration DAM 2.0 & CMIS

Oracle Developer Day

Automate to Innovate L EA RN WHAT SCRIPTING CAN DO FOR YOU P U N E E T S I N G H

APACHE SLING & FRIENDS TECH MEETUP BERLIN, SEPTEMBER Rookie Session: JCR & Sling Andres Pegam, Stefan Seifert pro!

A. Add a property called debugclientlibs to the js.txt and set the value to true.

Sunday, May 1,

Programming ArchiTech

Florian Müller Jay Brown Jeff Potts. FOREWORDS BY Richard J. Howarth John Newton MANNING.

White Paper. JSR 170 Overview. Standardizing the Content Repository Interface. Roy T. Fielding, Ph.D. Chief Scientist, Day Software

Combining Doclets with JDBC and JSP Technologies to Deliver the Next-Generation Documentation System for the Java Platform

Script Portlet Installation and Configuration with Websphere Portal v8.5. Adinarayana H

BEAWebLogic. Portal. Overview

Optimizing OAK repository search

OpenECOMP SDC Developer Guide

2 Java Content Repository (JCR)

Not just an App. Server

A Closer Look at XPages in IBM Lotus Domino Designer 8.5 Ray Chan Advisory I/T Specialist Lotus, IBM Software Group

Curriculum Guide. ThingWorx

JavaServer Faces Technology, AJAX, and Portlets: It s Easy if You Know How!

Introducing Apache Tomcat 7

Lotus Quickr 8.0: Technical Architecture

de la session Portal 6.1 Administration

WSRP Web Services for Remote Portlets

open source community experience distilled

Integrating the Progress Rollbase Portal into OpenEdge Applications. Mike Fechner, Director, Consultingwerk Ltd.

Extend EBS Using Applications Express

MarkLogic Server. Information Studio Developer s Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

SAS. Installation Guide Fifth Edition Intelligence Platform

Contents in Detail. Foreword by Xavier Noria

Building JavaServer Faces Applications

IBM Mobile Portal Accelerator Enablement

CMIS CONNECTOR MODULE DOCUMENTATION DIGITAL EXPERIENCE MANAGER 7.2

wcm.io Context-Aware Configuration

Liferay User Management. Kar Joon Chew Oct 2011

Planning the Future with Planets The Planets Interoperability Framework. Presented by Ross King Austrian Research Centers GmbH ARC

A c t i v e w o r k s p a c e f o r e x t e r n a l d a t a a g g r e g a t i o n a n d S e a r c h. 1

Developing Applications with Java EE 6 on WebLogic Server 12c

Internet Technologies. Lab Introduction

ArcGIS for Server: Administration and Security. Amr Wahba

Efficient Object-Relational Mapping for JAVA and J2EE Applications or the impact of J2EE on RDB. Marc Stampfli Oracle Software (Switzerland) Ltd.

Protect Your Application with Secure Coding Practices. Barrie Dempster & Jason Foy JAM306 February 6, 2013

OSGi. Tales from the Trenches. OSGitales from the trenches

Oracle Audit Vault. Trust-but-Verify for Enterprise Databases. Tammy Bednar Sr. Principal Product Manager Oracle Database Security

INTERNET ENGINEERING. HTTP Protocol. Sadegh Aliakbary

EBS goes social - The triumvirate Liferay, Application Express and EBS

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

Self-Demo Guide. Oracle ilearning and HTML DB

C exam IBM C IBM Digital Experience 8.5 Fundamentals

Migrating traditional Java EE applications to mobile

Certkiller.9A0-327 {92Questions}

Queries in AEM. JCR-SQL2. Pavel Nosau

New Features Summary PowerDesigner 15.2

to-end Solution Using OWB and JDeveloper to Analyze Your Data Warehouse

WebDAV and Apache. Greg Stein.

SFDC - Content Management - Webcast

Tzunami Deployer Oracle WebCenter Interaction Exporter Guide

Introduction to OSGi. Marcel Offermans. luminis

Ing. José A. Mejía Villar M.Sc. Computing Center of the Alfred Wegener Institute for Polar and Marine Research

Portlet Standard JSR 168 / JSR 286

Application Security through a Hacker s Eyes James Walden Northern Kentucky University

BUILDING A WEBSITE FOR THE NUMBER ONE CHILDREN S HOSPITAL IN THE U.S. May 10, 2011

Selenium Testing Training

bbc Content Repository Connector for Adobe LiveCycle ES4 Configure Content Repository Connector APPLIES TO CONTENTS

Tools to Develop New Linux Applications

<Insert Picture Here>

value focused. results driven. MaxEdit Renames Maximo Locations, Assets and other records MaxCompare Compares Maximo Systems

JSR-286: Portlet Specification 2.0

Your Voice is Your Passport: Implementing Voice-driven Applications with Amazon Alexa

Building Web Applications With The Struts Framework

Oracle Fusion Middleware 11g: Build Applications with ADF Accel

Driving Interoperability with CMIS

SQL Developer Oracle Migration Workbench Taking Database Migration to the next level

Integrating Progress Rollbase with OpenEdge the REST of the story. Mike Fechner, Director, Consultingwerk Ltd.

Digital Factory 7 Search and Query API under the hood

Webinar: XPages Goes Relational! November 18th, 2011

Bridging the Gap. Peter Ebell AMIS

Tzunami Deployer Oracle WebCenter Interaction Exporter Guide

Enabling Universal Authorization Models using Sentry

Documentum Client for Siebel User Guide

Transcription:

JCR in Action Content-based Applications with Apache Jackrabbit Carsten Ziegeler cziegeler@apache.org Apache Con US Presentation November 2009 - Oakland

About Member of the ASF Sling, Felix, Cocoon, Portals, Sanselan, Excalibur, Incubator PMC: Felix, Portals, Sling, Incubator, Excalibur (Chair) RnD Team at Day Software Article/Book Author, Technical Reviewer JSR 286 Spec Group (Portlet API 2.0) 2

Motivation Tried and trusted NOSQL solution Standard Java API First spec released in May 2005 Open Source Implementation 1.0 Release in April 2006 Think about your data storage use cases JCR might help 3

Agenda JCR and Apache Jackrabbit Basic Content Modeling References and Search Advanced Features Demo: Sample Application Summary and Questions 4

Content Repository 5

Content Storage Hierarchical content Nodes and properties Structured Nodetypes and typed properties And/or unstructured Fine and coarse-grained 6

Sample Application Digital Asset Management Hierarchical storage of pictures Upload Tagging Searching Automatic thumbnail generation Poor man's flickr... 7

Sample Content Structure Travel Family Europe Weddings Amsterdam Basel 2008 2007 City Photo Photo Photo Photo 8

Sample Application Java web application Uses Apache Sling as web framework Content repository managed by Apache Jackrabbit Interaction through the JCR API 9

JSR 170: Content Repository for Java TM technology API (Java) Standard Version 1.0 Supported by many vendors Used by many products and projects Several open source solutions How do you connect to a CR? How do you interact with a CR? 10

JSR 283 : JCR 2.0 is final New features Improved specification Cleaned up API (deprecation) Revised specification document Binary compatible JSR 170 apps run without modification More later... 11

CR : Combines Advantages 12

Content Repository Features Query (XPath, SQL) Export/Import (XML) Referential Integrity Authentication Access Control Versioning Observation Locking and Transactions (JTA) 13

The Repository Model Repository: one (or more) workspaces Workspace contains a tree of items Item: Node or property Nodes provide the content structure May have children Actual data is stored as values of properties Types and namespaces! Implementation of JCR 14

Nodes and Properties = Node Root Workspace A Content Repository = Property a b c d e g h Once upon a time.. -25 i j k true 6.02x10 23 Implementation of JCR 15

Connecting to the Repository JCR 1.0 16

Connecting to the Repository JCR 2.0 provides RepositoryFactory Uses Service Provider Mechanism META-INF/services/javax.jcr.RepositoryFactory Just use RepositoryFactory.getRepository(null) Or specify connection parameters RepositoryFactory.getRepository(Map) 17

Working with the Repository 18

Traverse the Hierarchy 19

Retrieve a Property 20

Interaction Summary Get the repository Login to a workspace Provides a session Use the session to Access nodes and their properties Change and save them 21

22 Apache Jackrabbit JSR 170 and 283 reference implementation Apache TLP since 2006 Releases 1.6 (JSR 170 based) 2.0 Beta 2 is out (nearly) 2.0 Final (end of 2009) announcesubscribe@jackrabbit.apache.org Components Commons, API RMI, WebDAV, WebApp, JCA OCM And more... http://jackrabbit.apache.org/ 22

Words of Advice Read (or browse) the JCR specification jcr-1.0.jar/jcr-2.0.jar included Getting started with Jackrabbit jackrabbit-webapp: Drop-in deployment First Hops: Embedded repository Take your time Think about your use cases Have a look at Apache Sling 23

Agenda JCR and Apache Jackrabbit Basic Content Modeling References and Search Advanced Features Demo: Sample Application Summary and Questions 24

Starting point: Leverage the standard node types Type hierarchy Content hierarchy nt:hierarchynode nt:folder nt:file nt:linkedfile nt:unstructured 25

Bottom-up modeling: Content types my:album > nt:folder - description (string) - date (date) my:tag - name (string) - description (string) my:photo > nt:file - description (string) - location (string) - tags (string[]) my:resource > nt:resource - width, height (long) - format (string) 26

Top-down modeling: Content hierarchies Travel Family Europe Weddings Amsterdam Basel 2008 2007 City Photo Photo Photo Photo 27

Content Modeling: Words of advice Namespaces Use a single namespace per company or application Use a reasonably unique namespace prefix Prefixed names for structured content Default namespace for unstructured content 28

Content Modeling: Words of advice Use an application root node /my:content Good for searching, backup, and migration Avoid flat hierarchies User interface complexity Content-driven design Design your content before your application 29

Content Modeling: Words of advice Checkout Apache Jackrabbit wiki and mailing lists "Davids Model" Look at existing node types Mixin node types possible 30

David s Model Rule #1: Data First, Structure Later. Maybe Rule #2: Drive the content hierarchy, don t let it happen Rule #6: Files are Files are Files Look at http://wiki.apache.org/jackrabbit/ DavidsModel 31

Agenda JCR and Apache Jackrabbit Basic Content Modeling References and Search Advanced Features Demo: Sample Application Summary and Questions 32

Alternative Views: References Tags Album Favorites Bird Tree Photo Top 10 Picks Photo link link link API: Node.getReferences():PropertyIterator Property.getNode():Node Node.setProperty(String name, Node) 33

Sample Alternative Views Reference by name my:photo > nt:file - description (string) - location (string) - tags (string[]) my:tag - name (string) - description (string) 34

Sample - Alternative Views Reference by path / my:photo > nt:file - description (string) - location (string) - tags (string[]) /Tags/bird Tags bird 35

Alternative Views: Search Looking for Latest photos XPath / jcr:root/my:albums//element(*,my:p hoto) [@data > xs:datetime( )] SQL SELECT * FROM my:photo WHERE jcr:path LIKE /my:albums/% AND date > DATE Favorites with keywords / jcr:root/my:albums//element(*,my:f avorite) /jcr:content[jcr:contains(., )] SELECT * FROM my:favorites WHERE jcr:path LIKE /my:albums/% AND CONTAINS(*, ) API: Session.getWorkspace().getQueryManager():QueryManager QueryManager.createQuery(String stmt, String language):query; Query.execute():QueryResult 36

Alternative Views: Words of advice Moderate use of references Circular references only within a subtree Plan for backup and content migration Best search performance when selecting a small subset of content References, path or name property 37

Agenda JCR and Apache Jackrabbit Basic Content Modeling References and Search Advanced Features Demo: Sample Application Summary and Questions 38

Observation Optional feature of the JCR specification Enables applications to register interest in events Monitor events Respond to events API: ObservationManager: addeventlistener(eventlistener listener, int eventtypes, java.lang.string abspath, boolean isdeep, java.lang.string[] uuid, java.lang.string[] nodetypename, boolean nolocal) Advanced JCR Features 39

Event Types Events can be of 5 different types Node added Node removed Property added Property removed Property changed Advanced JCR Features 40

Observation Events Describe changes to a workspace Dispatched on persistent change Provide the path of the item Provide the user ID Only provided to sessions with sufficient access privileges Events may not be complete! Example: removal of a tree of nodes Advanced JCR Features 41

Event Listeners Registered with a workspace Registration with optional filters Like node types, paths Receive events for every change API: public void onevent(eventiterator events); Advanced JCR Features 42

Events Advice Events occur after a save Modification based on events is a new operation Such events can be filtered Events may not tell the complete story Tree removal, copy, move Most common pattern Node added, removed, changed Advanced JCR Features 43

Staged Publishing: Versioning Version store Staging Live 44

Jackrabbit Configuration Workspace configuration XML configuration Persistence Managers Query index configuration (Lucene) File system configuration Check out the documentation 45

Agenda JCR and Apache Jackrabbit Basic Content Modeling References and Search Advanced Features Demo: Sample Application Summary and Questions 46

Getting Content Get the repository Login to a workspace Returns a session Starting with the session Navigate to the desired content Get the query manager and search 47

Writing Content Get the repository Login to a workspace Returns a session Navigate to the correct node To change it To add new nodes/properties To remove nodes/properties Persist changes 48

Advanced Development Apache Sling REST based web framework Powered by OSGi Scripting Inside Apache Jackrabbit OCM Map content to Java objects and vice versa Similar to database ORMs 49

JCR 2.0 Features Abstract Query Model Java Query Object Model / SQL ACL and Access Control Policies Plus Retention Policies and Hold Nodetype Registry New Property Types and Nodetypes Shareable Nodes (Graph) Journalling Observation 50

Agenda JCR and Apache Jackrabbit Basic Content Modeling References and Search Advanced Features Demo: Sample Application Summary and Questions 51

(Nearly) Everthing is Content Application Domain Specific Content Presentation Support (HTML, CSS, JavaScript, Images) Documentation, Translations... 52

Conclusion Content Repositories Combine advantages from FS and DB Add important features Structure/Access your data the way your domain requires it JCR The Java API Apache Jackrabbit The Implementation 53

Famous Last Words Read the specification JCR in your application? Join the Jackrabbit community! Seriously consider Apache Sling for web applications Check for additional stuff like OCM 54

Q&A 55