SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
Carsten Ziegeler | Day Management AG


JCR – Java Content
Repositories
cziegeler@apache.org
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
     – Various implementations
     – Several products and solutions
• 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
•   Summary and Questions




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




 5
Content Silos without JCR
• Structured content
     – Usually schema based
• Unstructured content
• Large data (images, movies etc.)
• Different storages for each use case




 6
Content Repository I
• Features of an RDBMS
     – Structure, integrity
     – Query, transactions
• Features of a filesystem
     – Hierarchy, binaries
     – Locking, access control
• All the other good stuff
     – Observation, versioning
     – Unstructured
     – Multi values, sort order, full text
• Single repository for all content!
 7
Content Repository II
• Hierarchical content
     – Nodes and properties
• Structured
     – Nodetypes and typed properties
• And/or unstructured
• Fine and coarse-grained
• Single repository for all content!



 8
Sample Application: Slingshot
• Digital Asset Management
     –   Hierarchical storage of pictures
     –   Upload
     –   Tagging
                                     Poor man's flickr...
     –   Searching
     –   Automatic thumbnail generation




 9
Slingshot Content Structure


                      Travel              Family


                 Europe                            Weddings


     Amsterdam            Basel                         2008


     2007                      City                 Photo      Photo


      Photo                           Photo



10
Facts About Slingshot
• Java web application
• Uses Apache Sling as web framework
• Content repository managed by
    Apache Jackrabbit
• Interaction through the JCR API




11
JSR 170: Content Repository
     for JavaTM 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?



12
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




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!


    14
Nodes and Properties
                                                 Root


                         Travel                   Family


                    Europe        “Images from
                                  Europe“
                                                           Weddings


     Amsterdam               Basel                              2008


     2007                           City                    Photo      Photo


      Photo                                 Photo

              „Once
              upon a
              time..“



                             Properties
                                  Implementation of JCR


15
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)




16
Working with the Repository
• Interaction is session based
     – Assemble credentials
     – Login into workspace
Credentials myCredentials =
        new SimpleCredentials("USERID",
                             "PASSWORD".toCharArray());
Session mySession =
        repository.login(myCredentials, "WORKSPACE");




17
Traversing the Content
• Traverse the repository
      – From the root or any node

Node rootNode = mySession.getRootNode();
Node albumNode = rootNode.getNode("slingshot/albums/travel");
Node europeNode = albumNode.getNode("Europe");




 18
Retrieve a Property
• Various ways to get a property
      – Different methods for each type
      – Type conversion if possible
Property prop = albumNode.getProperty("slingshot:description");
Value value = prop.getValue();
String desc = value.getString();

value.getBoolean();
value.getStream();
value.getLong();
value.getDate();
value.getDouble();




 19
Changing Content
• Change everything you want
     –   Add/Remove nodes
     –   Add/Remove/Change properties
     –   Transient space
     –   Then save
// change
albumNode.addNode("newAlbum");
europeNode.setProperty("slingshot:description", "something");
// save...
mySession.save();

// ... or revert all changes
mySession.refresh(false);


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
CR : Combines Advantages
                                          Single storage for
• Features of an RDBMS                    all content!
     – Structure, integrity
     – Query, transactions
• Features of a filesystem
     – Hierarchy, binaries
     – Locking, access control
• All the other good stuff
     –   Observation, versioning
     –   Unstructured
     –   Multi values, sort order, full text
     –   Import/Export (XML)
22
Apache Jackrabbit                                                               23


•    JSR 170 and 283 reference implementation
•    Apache TLP since 2006
•    Releases
          – 1.6 (JSR 170 based)
          – 2.0 Beta 2 is out
          – 2.0 Final (end of 2009)
•    Components
          – Commons, API
          – RMI, WebDAV, WebApp, JCA
          – OCM
          – And more...


                                                http://jackrabbit.apache.org/




    23
Words of Advice
• Read (or browse) the JCR spec
     – 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


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




    25
Leverage the standard node types
      • Type hierarchy             • Content
                                     hierarchy
      nt:hierarchyNode

                     nt:folder

                         nt:file

                   nt:linkedFile

      nt:unstructured




 26
Bottom-up modeling: Node types
slingshot:album > nt:folder        slingshot:tag
- slingshot:description (string)   - slingshot:description (string)
- slingshot:date (date)



slingshot:photo > nt:file
- slingshot:description (string)
- slingshot:location (string)
- slingshot:tags (string[])




27
Top-down modeling: Hierarchy


                      Travel              Family


                 Europe                            Weddings


     Amsterdam            Basel                         2008


     2007                      City                 Photo      Photo


      Photo                           Photo



28
Namespaces
• Namespaces can be used for
         – Node types
         – Node and property names
•    Single namespace per company or app
•    Reasonably unique namespace prefix
•    Prefixed names for structured content
•    Default namespace for unstructured
       content


    29
Content Modeling Advice I
• Use an application root node
     – Examples: my:content or slingshot
     – Good for searching, backup, and migration
• Avoid flat hierarchies
     – User interface complexity
• Content-driven design
     – Design your content before your appl




30
Content Modeling Advice II
• Look at existing node types (JSR 2.0)
• Make use of mixin node types
• Checkout Apache Jackrabbit wiki and
  mailing lists
     – "Davids Model"




31
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/Dav
  idsModel


32
Agenda
•    JCR and Apache Jackrabbit
•    Basic Content Modeling
•    References and Search
•    Advanced Features
•    Summary and Questions




    33
References with JCR



        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)

34
Alternative References I
• Reference by name


     slingshot:photo > nt:file
     - slingshot:description (string)   slingshot:tag
     - slingshot:location (string)      - slingshot:description (string)
     - slingshot:tags (string[])




35
Alternative References II
• Reference by path
                                                      /

     slingshot:photo > nt:file
     - slingshot:description (string)
                                                     Tags
     - slingshot:location (string)
     - slingshot:tags (string[])
                                        /Tags/bird
                                                      bird




36
Searching
• Query API
        – Java Query Object Model
        – SQL queries
• Examples
        – SELECT * FROM slingshot:photo
             WHERE jcr:path LIKE ‘/slingshot/%’
        – ..AND slingshot:description CONTAINS
            'munich'
     API:
     Session.getWorkspace().getQueryManager():QueryManager
     QueryManager.createQuery(String stmt, String
     language):Query;
     Query.execute():QueryResult
37
Agenda
•    JCR and Apache Jackrabbit
•    Basic Content Modeling
•    References and Search
•    Advanced Features
•    Summary and Questions




    38
Observation
• Enables applications to register
  interest in events
• Monitor changes
• Act on changes

        API:
        ObservationManager:
        addEventListener(EventListener listener,
          int eventTypes,
          java.lang.String absPath, boolean isDeep,
          java.lang.String[] uuid,
          java.lang.String[] nodeTypeName, boolean noLocal)



39
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


40
Event Types
• Five different types
     –   Node added
     –   Node removed
     –   Property added
     –   Property removed
     –   Property changed




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);




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



43
Staged Publishing: Versioning

                  Version store




        Staging                   Live




44
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



45
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

    46
Agenda
•    JCR and Apache Jackrabbit
•    Basic Content Modeling
•    References and Search
•    Advanced Features
•    Summary and Questions




    47
And remember...
• (Nearly) everything is content
     – Application Domain Specific Content
     – Presentation Support (HTML, CSS,
        JavaScript, Images)
     – Documentation, Translations
     –…
• With observation, versioning, search...




48
Conclusion
• Content Repositories
     – Combine advantages from FS and DB
     – Add important features
     – Structure/Access your data the way
        your domain requires it
     – Single repository for all your content!
• JCR – The Java API
• Apache Jackrabbit – Implementation


49
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




    50
Thanks for your attention!



                Q&A




51

Weitere ähnliche Inhalte

Was ist angesagt?

Get Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAMGet Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAM
Jonathan Katz
 
Content Management With Apache Jackrabbit
Content Management With Apache JackrabbitContent Management With Apache Jackrabbit
Content Management With Apache Jackrabbit
Jukka Zitting
 
Rest and Sling Resolution
Rest and Sling ResolutionRest and Sling Resolution
Rest and Sling Resolution
DEEPAK KHETAWAT
 
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
SANG WON PARK
 

Was ist angesagt? (20)

Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
 
High Performance Weibo QCon Beijing 2011
High Performance Weibo QCon Beijing 2011High Performance Weibo QCon Beijing 2011
High Performance Weibo QCon Beijing 2011
 
Get Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAMGet Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAM
 
Content Management With Apache Jackrabbit
Content Management With Apache JackrabbitContent Management With Apache Jackrabbit
Content Management With Apache Jackrabbit
 
Rest and Sling Resolution
Rest and Sling ResolutionRest and Sling Resolution
Rest and Sling Resolution
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
 
Apache kafka performance(latency)_benchmark_v0.3
Apache kafka performance(latency)_benchmark_v0.3Apache kafka performance(latency)_benchmark_v0.3
Apache kafka performance(latency)_benchmark_v0.3
 
톰캣 운영 노하우
톰캣 운영 노하우톰캣 운영 노하우
톰캣 운영 노하우
 
Streaming Data Lakes using Kafka Connect + Apache Hudi | Vinoth Chandar, Apac...
Streaming Data Lakes using Kafka Connect + Apache Hudi | Vinoth Chandar, Apac...Streaming Data Lakes using Kafka Connect + Apache Hudi | Vinoth Chandar, Apac...
Streaming Data Lakes using Kafka Connect + Apache Hudi | Vinoth Chandar, Apac...
 
카프카, 산전수전 노하우
카프카, 산전수전 노하우카프카, 산전수전 노하우
카프카, 산전수전 노하우
 
Apache Kafka Security
Apache Kafka Security Apache Kafka Security
Apache Kafka Security
 
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
Introducing KRaft: Kafka Without Zookeeper With Colin McCabe | Current 2022
 
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
 
Apache Knox Gateway "Single Sign On" expands the reach of the Enterprise Users
Apache Knox Gateway "Single Sign On" expands the reach of the Enterprise UsersApache Knox Gateway "Single Sign On" expands the reach of the Enterprise Users
Apache Knox Gateway "Single Sign On" expands the reach of the Enterprise Users
 
[2018] NHN 모니터링의 현재와 미래 for 인프라 엔지니어
[2018] NHN 모니터링의 현재와 미래 for 인프라 엔지니어[2018] NHN 모니터링의 현재와 미래 for 인프라 엔지니어
[2018] NHN 모니터링의 현재와 미래 for 인프라 엔지니어
 
Introduction to Node JS.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdf
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
 
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화
 

Andere mochten auch

Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
Bob Paulin
 
Presentation thomas simlinger
Presentation thomas simlingerPresentation thomas simlinger
Presentation thomas simlinger
connectwebex
 
Hippo get together workshop automatic export
Hippo get together   workshop automatic exportHippo get together   workshop automatic export
Hippo get together workshop automatic export
Hippo
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
nobby
 
Hippo gettogether april 2012 faceted navigation a tale of daemons
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
Hippo
 

Andere mochten auch (20)

Introduction to JCR
Introduction to JCR Introduction to JCR
Introduction to JCR
 
JCR In 10 Minutes
JCR In 10 MinutesJCR In 10 Minutes
JCR In 10 Minutes
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
 
Java Content Repository avec Jackrabbit
Java Content Repository avec JackrabbitJava Content Repository avec Jackrabbit
Java Content Repository avec Jackrabbit
 
Presentation thomas simlinger
Presentation thomas simlingerPresentation thomas simlinger
Presentation thomas simlinger
 
Hippo Presentation Jboye Study tour
Hippo Presentation Jboye Study tourHippo Presentation Jboye Study tour
Hippo Presentation Jboye Study tour
 
Hippo get together workshop automatic export
Hippo get together   workshop automatic exportHippo get together   workshop automatic export
Hippo get together workshop automatic export
 
Hippo CMS at OpenCo Amsterdam 2014
Hippo CMS at OpenCo Amsterdam 2014Hippo CMS at OpenCo Amsterdam 2014
Hippo CMS at OpenCo Amsterdam 2014
 
Web Applications Development
Web Applications DevelopmentWeb Applications Development
Web Applications Development
 
JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)
 
What's new in JSR-283?
What's new in JSR-283?What's new in JSR-283?
What's new in JSR-283?
 
2008-12 OJUG JCR Demo
2008-12 OJUG JCR Demo2008-12 OJUG JCR Demo
2008-12 OJUG JCR Demo
 
Introducing Apricot, The Eclipse Content Management Platform
Introducing Apricot, The Eclipse Content Management PlatformIntroducing Apricot, The Eclipse Content Management Platform
Introducing Apricot, The Eclipse Content Management Platform
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
Effective Web Application Development with Apache Sling
Effective Web Application Development with Apache SlingEffective Web Application Development with Apache Sling
Effective Web Application Development with Apache Sling
 
App and web with Hippo CMS and AngularJS
App and web with Hippo CMS and AngularJS App and web with Hippo CMS and AngularJS
App and web with Hippo CMS and AngularJS
 
JCR and ModeShape
JCR and ModeShapeJCR and ModeShape
JCR and ModeShape
 
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.
Cms integration of apache solr how we did it.
 
Introducing Hippo CMS 10.2
Introducing Hippo CMS 10.2Introducing Hippo CMS 10.2
Introducing Hippo CMS 10.2
 
Hippo gettogether april 2012 faceted navigation a tale of daemons
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
 

Ähnlich wie JCR - Java Content Repositories

Rubyonrails 090715105949-phpapp01
Rubyonrails 090715105949-phpapp01Rubyonrails 090715105949-phpapp01
Rubyonrails 090715105949-phpapp01
sagaroceanic11
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Nilesh Panchal
 
Spider进化论
Spider进化论Spider进化论
Spider进化论
cjhacker
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
kevinvw
 
Linked Data Publishing with Drupal (SWIB13 workshop)
Linked Data Publishing with Drupal (SWIB13 workshop)Linked Data Publishing with Drupal (SWIB13 workshop)
Linked Data Publishing with Drupal (SWIB13 workshop)
Joachim Neubert
 
Writing DSL's in Scala
Writing DSL's in ScalaWriting DSL's in Scala
Writing DSL's in Scala
Abhijit Sharma
 
Hibernate in XPages
Hibernate in XPagesHibernate in XPages
Hibernate in XPages
Toby Samples
 

Ähnlich wie JCR - Java Content Repositories (20)

Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Introduction to CQ5
Introduction to CQ5Introduction to CQ5
Introduction to CQ5
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Rubyonrails 090715105949-phpapp01
Rubyonrails 090715105949-phpapp01Rubyonrails 090715105949-phpapp01
Rubyonrails 090715105949-phpapp01
 
Melbourne User Group OAK and MongoDB
Melbourne User Group OAK and MongoDBMelbourne User Group OAK and MongoDB
Melbourne User Group OAK and MongoDB
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
 
Spider进化论
Spider进化论Spider进化论
Spider进化论
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure Data
 
Spark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir Volk
 
Drupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for YouDrupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for You
 
2010 05-21, object-relational mapping using hibernate v2
2010 05-21, object-relational mapping using hibernate v22010 05-21, object-relational mapping using hibernate v2
2010 05-21, object-relational mapping using hibernate v2
 
The CoFX Data Model
The CoFX Data ModelThe CoFX Data Model
The CoFX Data Model
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
Eclipse Enterprise Content Repository (ECR)
Eclipse Enterprise Content Repository (ECR)Eclipse Enterprise Content Repository (ECR)
Eclipse Enterprise Content Repository (ECR)
 
Linked Data Publishing with Drupal (SWIB13 workshop)
Linked Data Publishing with Drupal (SWIB13 workshop)Linked Data Publishing with Drupal (SWIB13 workshop)
Linked Data Publishing with Drupal (SWIB13 workshop)
 
Writing DSL's in Scala
Writing DSL's in ScalaWriting DSL's in Scala
Writing DSL's in Scala
 
Hibernate in XPages
Hibernate in XPagesHibernate in XPages
Hibernate in XPages
 
Eurydike: Schemaless Object Relational SQL Mapper
Eurydike: Schemaless Object Relational SQL MapperEurydike: Schemaless Object Relational SQL Mapper
Eurydike: Schemaless Object Relational SQL Mapper
 
Publishing Linked Data from RDB
Publishing Linked Data from RDBPublishing Linked Data from RDB
Publishing Linked Data from RDB
 

Mehr von Carsten Ziegeler

Apache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and RESTApache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and REST
Carsten Ziegeler
 

Mehr von Carsten Ziegeler (17)

Service oriented web development with OSGi
Service oriented web development with OSGiService oriented web development with OSGi
Service oriented web development with OSGi
 
Use Case: Building OSGi Enterprise Applications (QCon 14)
Use Case: Building OSGi Enterprise Applications (QCon 14)Use Case: Building OSGi Enterprise Applications (QCon 14)
Use Case: Building OSGi Enterprise Applications (QCon 14)
 
What's cool in the new and updated OSGi Specs
What's cool in the new and updated OSGi SpecsWhat's cool in the new and updated OSGi Specs
What's cool in the new and updated OSGi Specs
 
What's cool in the new and updated OSGi specs
What's cool in the new and updated OSGi specsWhat's cool in the new and updated OSGi specs
What's cool in the new and updated OSGi specs
 
Monitoring OSGi Applications with the Web Console
Monitoring OSGi Applications with the Web ConsoleMonitoring OSGi Applications with the Web Console
Monitoring OSGi Applications with the Web Console
 
Distributed Eventing in OSGi
Distributed Eventing in OSGiDistributed Eventing in OSGi
Distributed Eventing in OSGi
 
Apache Sling - Distributed Eventing, Discovery, and Jobs (adaptTo 2013)
Apache Sling - Distributed Eventing, Discovery, and Jobs (adaptTo 2013)Apache Sling - Distributed Eventing, Discovery, and Jobs (adaptTo 2013)
Apache Sling - Distributed Eventing, Discovery, and Jobs (adaptTo 2013)
 
Adobe AEM - From Eventing to Job Processing
Adobe AEM - From Eventing to Job ProcessingAdobe AEM - From Eventing to Job Processing
Adobe AEM - From Eventing to Job Processing
 
Embrace Change - Embrace OSGi
Embrace Change - Embrace OSGiEmbrace Change - Embrace OSGi
Embrace Change - Embrace OSGi
 
Apache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and RESTApache Sling : JCR, OSGi, Scripting and REST
Apache Sling : JCR, OSGi, Scripting and REST
 
Embrace OSGi
Embrace OSGiEmbrace OSGi
Embrace OSGi
 
Apache Sanselan (ApacheCon US 2007 FFT)
Apache Sanselan (ApacheCon US 2007 FFT)Apache Sanselan (ApacheCon US 2007 FFT)
Apache Sanselan (ApacheCon US 2007 FFT)
 
Apache iBatis (ApacheCon US 2007)
Apache iBatis (ApacheCon US 2007)Apache iBatis (ApacheCon US 2007)
Apache iBatis (ApacheCon US 2007)
 
JCR In Action (ApacheCon US 2007)
JCR In Action (ApacheCon US 2007)JCR In Action (ApacheCon US 2007)
JCR In Action (ApacheCon US 2007)
 
Apache Portals Panel (ApacheCon US 2007)
Apache Portals Panel (ApacheCon US 2007)Apache Portals Panel (ApacheCon US 2007)
Apache Portals Panel (ApacheCon US 2007)
 
JCR In Action (ApacheCon EU 2008)
JCR In Action (ApacheCon EU 2008)JCR In Action (ApacheCon EU 2008)
JCR In Action (ApacheCon EU 2008)
 
Maven SCR Plugin (ApacheCon EU 2008 - FFT)
Maven SCR Plugin (ApacheCon EU 2008 - FFT)Maven SCR Plugin (ApacheCon EU 2008 - FFT)
Maven SCR Plugin (ApacheCon EU 2008 - FFT)
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

JCR - Java Content Repositories

  • 1. Carsten Ziegeler | Day Management AG JCR – Java Content Repositories cziegeler@apache.org
  • 2. 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
  • 3. Motivation • Tried and trusted NOSQL solution • Standard Java API – First spec released in May 2005 – Various implementations – Several products and solutions • Open Source Implementation – 1.0 Release in April 2006 • Think about your data storage use cases – JCR might help 3
  • 4. Agenda • JCR and Apache Jackrabbit • Basic Content Modeling • References and Search • Advanced Features • Summary and Questions 4
  • 5. (Nearly) Everthing is Content • Application Domain Specific Content • Presentation Support (HTML, CSS, JavaScript, Images) • Documentation, Translations • ... 5
  • 6. Content Silos without JCR • Structured content – Usually schema based • Unstructured content • Large data (images, movies etc.) • Different storages for each use case 6
  • 7. Content Repository I • Features of an RDBMS – Structure, integrity – Query, transactions • Features of a filesystem – Hierarchy, binaries – Locking, access control • All the other good stuff – Observation, versioning – Unstructured – Multi values, sort order, full text • Single repository for all content! 7
  • 8. Content Repository II • Hierarchical content – Nodes and properties • Structured – Nodetypes and typed properties • And/or unstructured • Fine and coarse-grained • Single repository for all content! 8
  • 9. Sample Application: Slingshot • Digital Asset Management – Hierarchical storage of pictures – Upload – Tagging Poor man's flickr... – Searching – Automatic thumbnail generation 9
  • 10. Slingshot Content Structure Travel Family Europe Weddings Amsterdam Basel 2008 2007 City Photo Photo Photo Photo 10
  • 11. Facts About Slingshot • Java web application • Uses Apache Sling as web framework • Content repository managed by Apache Jackrabbit • Interaction through the JCR API 11
  • 12. JSR 170: Content Repository for JavaTM 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? 12
  • 13. 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 13
  • 14. 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! 14
  • 15. Nodes and Properties Root Travel Family Europe “Images from Europe“ Weddings Amsterdam Basel 2008 2007 City Photo Photo Photo Photo „Once upon a time..“ Properties Implementation of JCR 15
  • 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) 16
  • 17. Working with the Repository • Interaction is session based – Assemble credentials – Login into workspace Credentials myCredentials = new SimpleCredentials("USERID", "PASSWORD".toCharArray()); Session mySession = repository.login(myCredentials, "WORKSPACE"); 17
  • 18. Traversing the Content • Traverse the repository – From the root or any node Node rootNode = mySession.getRootNode(); Node albumNode = rootNode.getNode("slingshot/albums/travel"); Node europeNode = albumNode.getNode("Europe"); 18
  • 19. Retrieve a Property • Various ways to get a property – Different methods for each type – Type conversion if possible Property prop = albumNode.getProperty("slingshot:description"); Value value = prop.getValue(); String desc = value.getString(); value.getBoolean(); value.getStream(); value.getLong(); value.getDate(); value.getDouble(); 19
  • 20. Changing Content • Change everything you want – Add/Remove nodes – Add/Remove/Change properties – Transient space – Then save // change albumNode.addNode("newAlbum"); europeNode.setProperty("slingshot:description", "something"); // save... mySession.save(); // ... or revert all changes mySession.refresh(false); 20
  • 21. 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. CR : Combines Advantages Single storage for • Features of an RDBMS all content! – Structure, integrity – Query, transactions • Features of a filesystem – Hierarchy, binaries – Locking, access control • All the other good stuff – Observation, versioning – Unstructured – Multi values, sort order, full text – Import/Export (XML) 22
  • 23. Apache Jackrabbit 23 • JSR 170 and 283 reference implementation • Apache TLP since 2006 • Releases – 1.6 (JSR 170 based) – 2.0 Beta 2 is out – 2.0 Final (end of 2009) • Components – Commons, API – RMI, WebDAV, WebApp, JCA – OCM – And more... http://jackrabbit.apache.org/ 23
  • 24. Words of Advice • Read (or browse) the JCR spec – 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 24
  • 25. Agenda • JCR and Apache Jackrabbit • Basic Content Modeling • References and Search • Advanced Features • Demo: Sample Application • Summary and Questions 25
  • 26. Leverage the standard node types • Type hierarchy • Content hierarchy nt:hierarchyNode nt:folder nt:file nt:linkedFile nt:unstructured 26
  • 27. Bottom-up modeling: Node types slingshot:album > nt:folder slingshot:tag - slingshot:description (string) - slingshot:description (string) - slingshot:date (date) slingshot:photo > nt:file - slingshot:description (string) - slingshot:location (string) - slingshot:tags (string[]) 27
  • 28. Top-down modeling: Hierarchy Travel Family Europe Weddings Amsterdam Basel 2008 2007 City Photo Photo Photo Photo 28
  • 29. Namespaces • Namespaces can be used for – Node types – Node and property names • Single namespace per company or app • Reasonably unique namespace prefix • Prefixed names for structured content • Default namespace for unstructured content 29
  • 30. Content Modeling Advice I • Use an application root node – Examples: my:content or slingshot – Good for searching, backup, and migration • Avoid flat hierarchies – User interface complexity • Content-driven design – Design your content before your appl 30
  • 31. Content Modeling Advice II • Look at existing node types (JSR 2.0) • Make use of mixin node types • Checkout Apache Jackrabbit wiki and mailing lists – "Davids Model" 31
  • 32. 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/Dav idsModel 32
  • 33. Agenda • JCR and Apache Jackrabbit • Basic Content Modeling • References and Search • Advanced Features • Summary and Questions 33
  • 34. References with JCR 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) 34
  • 35. Alternative References I • Reference by name slingshot:photo > nt:file - slingshot:description (string) slingshot:tag - slingshot:location (string) - slingshot:description (string) - slingshot:tags (string[]) 35
  • 36. Alternative References II • Reference by path / slingshot:photo > nt:file - slingshot:description (string) Tags - slingshot:location (string) - slingshot:tags (string[]) /Tags/bird bird 36
  • 37. Searching • Query API – Java Query Object Model – SQL queries • Examples – SELECT * FROM slingshot:photo WHERE jcr:path LIKE ‘/slingshot/%’ – ..AND slingshot:description CONTAINS 'munich' API: Session.getWorkspace().getQueryManager():QueryManager QueryManager.createQuery(String stmt, String language):Query; Query.execute():QueryResult 37
  • 38. Agenda • JCR and Apache Jackrabbit • Basic Content Modeling • References and Search • Advanced Features • Summary and Questions 38
  • 39. Observation • Enables applications to register interest in events • Monitor changes • Act on changes API: ObservationManager: addEventListener(EventListener listener, int eventTypes, java.lang.String absPath, boolean isDeep, java.lang.String[] uuid, java.lang.String[] nodeTypeName, boolean noLocal) 39
  • 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 40
  • 41. Event Types • Five different types – Node added – Node removed – Property added – Property removed – Property changed 41
  • 42. 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); 42
  • 43. 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 43
  • 44. Staged Publishing: Versioning Version store Staging Live 44
  • 45. 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 45
  • 46. 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 46
  • 47. Agenda • JCR and Apache Jackrabbit • Basic Content Modeling • References and Search • Advanced Features • Summary and Questions 47
  • 48. And remember... • (Nearly) everything is content – Application Domain Specific Content – Presentation Support (HTML, CSS, JavaScript, Images) – Documentation, Translations –… • With observation, versioning, search... 48
  • 49. Conclusion • Content Repositories – Combine advantages from FS and DB – Add important features – Structure/Access your data the way your domain requires it – Single repository for all your content! • JCR – The Java API • Apache Jackrabbit – Implementation 49
  • 50. 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 50
  • 51. Thanks for your attention! Q&A 51