SlideShare une entreprise Scribd logo
1  sur  61
Télécharger pour lire hors ligne
JCR in Action

Content-based Applications with
      Apache Jackrabbit
        Carsten Ziegeler       Bertrand Delacreataz
        cziegeler@apache.org   bdelacretaz@apache.org

        Day Software           Day Software
About Bertrand Delacretaz
• Apache Software Foundation Member
  – Cocoon, FOP, Solr, Sling, Tika, Incubator
  – PMC: Cocoon, Tika, Sling
• Senior Developer at Day Software
• Living in Lausanne, Switzerland
About Carsten Ziegeler
• Apache Software Foundation Member
  – Cocoon, Excalibur, Pluto, Felix, Incubator,
    Sling, Sanselan
  – PMC: Cocoon, Incubator, Portals, Felix,
    Excalibur (Chair)
• Senior Developer at Day Software
• Article/Book Author, Technical Reviewer
• JSR 286 spec group (Portlet API 2.0)
and jobs!
                                            infos, discussions
                                            Visit our booth for
                 Agenda
•   JCR and Apache Jackrabbit
    Basic content modeling
•
•   References and search
    Advanced features
•
•   Sample application
    Summary and questions
•


                                      4
Session Planner
• XSLT and Xpath – Without the Pain
  Bertrand Delacretaz – Today 15:00
• Apache Sling (Fast Feather Track)
  Felix Meschberger – Thursday 10:00
• A Little REST and Relaxation
  Roy Fielding – Thursday 14:00
• Apache Sanselan (Fast Feather Track)
  Carsten Ziegeler – Thursday 15:00
• Getting Up to Speed with Apache iBatis
  Carsten Ziegeler – Thursday 16:30
• The Apache Portals Panel
  Carsten Ziegeler – Friday 10:00
Content Repository
•   Generic application data store
    Structured and unstructured content
•
•   Support small and large-scale data
    Locking, transactions, versioning,
•
    observation and searching



                                          6
JSR 170: Content Repository for
    Java technology API
        TM

• (Java) Standard
  – Supported by many vendors
  – Several open source solutions
• How do you connect to a CR?
• How do you interact with a CR?
• How do you query a CR?


                                    7
Content Repository Features
• Hierarchical content
• Structured
  – Nodes and properties (with types)
• And/or unstructured
• Read only or read/write
• Fine and coarse-grained


                                        8
Content Repository Features
•   Query (XPath)
    Export/Import (XML)
•
•   Referential Integrity
    Access Control
•
•   Versioning
    Observation
•
•   Locking and Transactions (JTA)
                                     9
Comparison
• File system
  – Hierarchival, unstructured, read/write
• Database
  – Structured, read/write
  – Referential integrity, transactions
• Content Repository
  – Advantages of a FS and a database
  – Plus observation, versioning etc.
                                             10
The Repository Model
•   Repository = one (or more) workspaces
    Workspace = 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
Nodes & Properties
                                   Root




                                                         W
= Node




                                                          or



                                                                        C
                                                             ks



                                                                        on
                                                              pa



                                                                            te
                                                                  ce



                                                                            nt
= Property




                                                                                 R
                                                                   A



                                                                                 ep
                                                                                     os
                                                                                      ito
                       a




                                                                                          ry
                                                     c
                                       b




                                           g
         d                                               h
               e


                                               „Once
                                               upon a             -25
                                               time..“
 i                 j   k



                           6.02x1023
              true




                              Implementation of JCR
Connecting to the Repository
Working with the Repository
Traverse the Hierarchy
Retrieve a Property
18


                Apache Jackrabbit
– JSR 170 reference implementation
– Apache TLP since 2006
– Looking back
    • 1.0: April 2006
    • 1.1: October 2006
    • 1.2: January 2007
    • 1.3: April 2007
– Looking forward (tentative)
    • 1.4: 2007
    • 2.0: 2008 (JCR 2.0 RI)
    • announce-
      subscribe@jackrabbit.apache.org
– Components
                                            http://jackrabbit.apache.org/
    • Core, API, RMI, WebDAV,webapp, JCA,
      …
Words of advice
• Read (or browse) the JCR specification
  – jcr-1.0.jar included
• Getting started with Jackrabbit
  – jackrabbit-webapp: Drop-in deployment
  – First Hops: Embedded repository
  – Take your time



                                            19
Words of advice
• Resources
  – Mailing lists: Excellent support, but may delay
    you
  – Website: Some good parts, but not complete or
    very well structured
  – Wiki: End user experience
  – FAQ: outdated
  – Issue tracker: Good response time

                                              20
Agenda
•   JCR and Apache Jackrabbit
    Basic content modeling
•
•   References and search
    Advanced features
•
•   Sample application
    Summary and questions
•


                                21
Introducing JCR Tunes
• JCR example application
• “How to implement a music store or library
  with JCR?”
• Designed to showcase JCR features and
  best practices
• Store and manage individual “tunes”
  – optionally organized in albums, etc.

                                           22
Introducing JCR Tunes II
• Support alternative views like
  – predefined genres, or more ad-hoc searches
• Integrated handling of reviews, cover
  images, and other related content
• Staged publishing and timed releases of
  tunes or albums


                                             23
Introducing JCR Tunes III
• Personalization for things like settings,
  favorites, personal play-lists, etc.
• Extensibility and flexibility 




                                              24
Starting point: Leverage the
        standard node types
• Type hierarchy                • Content hierarchy
   nt:hierarchyNode

                   nt:folder

                      nt:file

               nt:linkedFile

     nt:resource




                                                      25
Bottom-up modeling: Content
           types

my:album > nt:folder                     my:review > nt:file
- artist (string)                        - author (string)
- release date (date)                    - star rating (long)


      my:tune > nt:file
      - artist (string)
      - release date (date)


             my:resource > nt:resource
             - codec (string)
             - bitrate (long)


                                                                26
Top-down modeling: Content
       hierarchies

                    Label           Label


             Band                            Label


     Album           Album                       Band


 Reviews      Tune          Tune            Images      Tune


                    Reviews    Images


                                                          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
  – Jackrabbit performance
• Content-driven design
  – Design your content before your application
                                             29
Content Modeling: Words of
            advice
• Checkout Jackrabbit wiki and mailing lists
  – quot;Davids Modelquot;
• 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
Agenda
•   JCR and Apache Jackrabbit
    Basic content modeling
•
•   References and search
    Advanced features
•
•   Sample application
    Summary and questions
•


                                32
Alternative Views: References

       tags                       tunes                     playlists


Rock      Classic          Tune                       Top 10          Picks


                                                   link        link            link
                                    Tune

                    API:
                    Node.getReferences():PropertyIterator
                    Property.getNode():Node
                    Node.setProperty(String name, Node)

                                                                          33
Alternative Views: Search
Looking     XPath                                   SQL
for
Latest      /jcr:root/my:tunes//element(*,my:tune SELECT * FROM my:tune
releases    )                                     WHERE
            [@released > xs:dateTime(‘…’)]        jcr:path LIKE ‘/my:tunes/%’
                                                  AND released > DATE ‘…’

Reviews     /jcr:root/my:tunes//element(*,my:revi   SELECT * FROM my:review
with        ew)                                     WHERE
keywords    /jcr:content[jcr:contains(.,’…’)]       jcr:path LIKE ‘/my:tunes/%’
                                                    AND CONTAINS(*,‘…’)


           API:
           Session.getWorkspace().getQueryManager():QueryManager
           QueryManager.createQuery(String stmt, String language):Query;
           Query.execute():QueryResult
                                                                           34
Alternative Views: Words of
              advice
• Moderate use of references
  – Circular references only within a subtree
  – Plan for backup and content migration
  – Jackrabbit performance: max 10k references to
    a single node
• Best search performance when selecting a
  small subset of content
• References, path or name property
                                             35
Alternative Views: Words of
              advice
• No joins or aggregate searches
• Full text indexing of binary properties only
  for jcr:data in nt:resource nodes
• Formatting date queries
  – ISO 8601 as the string format
  – session.getValueFactory().createValue(Calendar
    .getInstance()).getString()


                                            36
Agenda
•   JCR and Apache Jackrabbit
    Basic content modeling
•
•   References and search
    Advanced features
•
•   Sample application
    Summary and questions
•


                                37
Staged Publishing: Versioning
              Version store




    Staging                   Live




                                     38
Personalization

       tunes                           users


Tune                               John          Jane


                           tunes           favorites playlists
         Tune

                    link            link




                                                                 39
Authentication and Authorization
• Java Authentication and Authorization
  Services (JAAS)
  – Mostly the authentication part is currently used
    by Jackrabbit
  – Pluggable authentication components
  – Support for single sing-on



                                               40
Authentication and Authorization
• Custom AccessManager interface in
  Jackrabbit
  – Pluggable authorization components
  – The default implementation supports only
    global read, write, and admin access
  – More advanced implementations are
    proprietary


                                               41
Authentication and Authorization
• Repository-level authentication and
  authorization applies to all clients
  – Better than application-level authorization




                                                  42
Jackrabbit Configuration
• Workspace configuration
  –   XML configuration
  –   Persistence Managers
  –   Query index configuration (Lucene)
  –   File system configuration
• Check out the documentation
Observation
• Optional feature of the JCR specification
• Enables applications to register interest in
  events
• Monitoring events
• Responding 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
Event Types
• Events can be of 5 different types
  –   NODE_ADDED
  –   NODE_REMOVED
  –   PROPERTY_ADDED
  –   PROPERTY_REMOVED
  –   PROPERTY_CHANGED



              Advanced JCR Features
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


               Advanced JCR Features
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
Agenda
•   JCR and Apache Jackrabbit
    Basic content modeling
•
•   References and search
    Advanced features
•
•   Sample application
    Summary and questions
•


                                48
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



                                       49
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
                                  50
SMS Sample Application
SMS Sample: Observation
observationSession
  .getWorkspace()
   .getObservationManager()
    .addEventListener(
      this,
      javax.jcr.observation.Event.PROPERTY_CHANGED |
      javax.jcr.observation.Event.NODE_ADDED,
      SMS_EVENT_ROOT, true, null,
      new String[] { SMS_EVENT }, true
);
SMS Sample: Event Handling
public void onEvent(EventIterator events) {
...
case javax.jcr.observation.Event.NODE_ADDED:

 Node newEvent = (Node) observationSession.getItem(path);

 String date = newEvent.getProperty(EVENT_DATE).getString();
 DateFormat formater = new SimpleDateFormat(quot;dd.MM.yyyy
hh:mm:ssquot;);
 Date pdate = formater.parse(date);

 addScheduledEvent(pdate, path);

 break;
SMS Sample: Event Processing
 private void sendSms(Node event) throws RepositoryException {

     String topicPath = event.getProperty(TOPIC_PATH).getString();
     String text = event.getProperty(TEXT).getString();
     String smsSubscribers[] = getSmsSubscribers(topicPath);

     send(text, smsSubscribers);
 }
SMS Sample: Event Processing
private String[] getSmsSubscribers(String topicPath) {

    Node topic = (Node) session.getItem(topicPath);
    Node subscriberNode = topic.getNode(quot;subscribers“);

    NodeIterator subscribers = subscriberNode.getNodes();

    while (subscribers.hasNext()) {
     Node subscriber = subscribers.nextNode();

        String path= subscriber.getProperty(SMS_USER_PATH).getString();
        Node user = (Node) session.getItem(path);
        String mobileNumber =
        user.getProperty(SmsUserContent.MOBILE_NUMBER).getString();

    }
}
Advanced Development
• Apache Jackrabbit OCM
  – Map content to Java objects and vice versa
  – Similar to database ORMs
• Apache Sling
  – New project in incubation
  – REST based web framework
  – Leverages OSGi


                                                 56
Agenda
•   JCR and Apache Jackrabbit
    Basic content modeling
•
•   References and search
    Advanced features
•
•   Sample application
    Summary and questions
•


                                57
Conclusion
• (Nearly) Everything is content
  – Application content
  – HTML pages, CSS and JavaScript files, static
    images
  – Documentation, resource bundles, etc.
  – With versioning, export/import, full text search,
    etc.


                                               58
Conclusion
• Web-friendly
  – Trivial URI mapping
  – WebDAV access for free
  – Dispatch on node type, not on URI path
• In your application?
• Look at Jackrabbit OCM and Apache Sling


                                             59
Session Planner
• XSLT and Xpath – Without the Pain
  Bertrand Delacretaz – Today 15:00
• Apache Sling (Fast Feather Track)
  Felix Meschberger – Thursday 10:00
• A Little REST and Relaxation
  Roy Fielding – Thursday 14:00
• Apache Sanselan (Fast Feather Track)
  Carsten Ziegeler – Thursday 15:00
• Getting Up to Speed with Apache iBatis
  Carsten Ziegeler – Thursday 16:30
• The Apache Portals Panel
  Carsten Ziegeler – Friday 10:00
Visit our booth for
infos, discussions
and jobs!



  Q&A


                      61

Contenu connexe

Tendances

How to collect Big Data into Hadoop
How to collect Big Data into HadoopHow to collect Big Data into Hadoop
How to collect Big Data into HadoopSadayuki Furuhashi
 
Querying Trust in RDF Data with tSPARQL
Querying Trust in RDF Data with tSPARQLQuerying Trust in RDF Data with tSPARQL
Querying Trust in RDF Data with tSPARQLOlaf Hartig
 
Standards for Semantic Mashups
Standards for Semantic MashupsStandards for Semantic Mashups
Standards for Semantic MashupsLaurent Lefort
 
Spark and Shark: Lightning-Fast Analytics over Hadoop and Hive Data
Spark and Shark: Lightning-Fast Analytics over Hadoop and Hive DataSpark and Shark: Lightning-Fast Analytics over Hadoop and Hive Data
Spark and Shark: Lightning-Fast Analytics over Hadoop and Hive DataJetlore
 
What is new and cool j2se & java
What is new and cool j2se & javaWhat is new and cool j2se & java
What is new and cool j2se & javaEugene Bogaart
 
Hadoop Summit 2012 | HBase Consistency and Performance Improvements
Hadoop Summit 2012 | HBase Consistency and Performance ImprovementsHadoop Summit 2012 | HBase Consistency and Performance Improvements
Hadoop Summit 2012 | HBase Consistency and Performance ImprovementsCloudera, Inc.
 
Sparse Content Map Storage System
Sparse Content Map Storage SystemSparse Content Map Storage System
Sparse Content Map Storage Systemianeboston
 
Distributed Key-Value Stores- Featuring Riak
Distributed Key-Value Stores- Featuring RiakDistributed Key-Value Stores- Featuring Riak
Distributed Key-Value Stores- Featuring Riaksamof76
 
Tokyo Cabinet & Tokyo Tyrant
Tokyo Cabinet & Tokyo TyrantTokyo Cabinet & Tokyo Tyrant
Tokyo Cabinet & Tokyo Tyrant輝 子安
 
Analyzing Real-World Data with Apache Drill
Analyzing Real-World Data with Apache DrillAnalyzing Real-World Data with Apache Drill
Analyzing Real-World Data with Apache Drilltshiran
 
Extend starfish to Support the Growing Hadoop Ecosystem
Extend starfish to Support the Growing Hadoop EcosystemExtend starfish to Support the Growing Hadoop Ecosystem
Extend starfish to Support the Growing Hadoop EcosystemFei Dong
 
Improve extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionImprove extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionKouhei Sutou
 
Integrate Hive and R
Integrate Hive and RIntegrate Hive and R
Integrate Hive and RJunHo Cho
 
Introduction to Tokyo Products
Introduction to Tokyo ProductsIntroduction to Tokyo Products
Introduction to Tokyo ProductsMikio Hirabayashi
 
Granularity in linked open data
Granularity in linked open dataGranularity in linked open data
Granularity in linked open dataGordon Dunsire
 

Tendances (20)

How to collect Big Data into Hadoop
How to collect Big Data into HadoopHow to collect Big Data into Hadoop
How to collect Big Data into Hadoop
 
The djatoka Image Server
The djatoka Image ServerThe djatoka Image Server
The djatoka Image Server
 
Querying Trust in RDF Data with tSPARQL
Querying Trust in RDF Data with tSPARQLQuerying Trust in RDF Data with tSPARQL
Querying Trust in RDF Data with tSPARQL
 
Standards for Semantic Mashups
Standards for Semantic MashupsStandards for Semantic Mashups
Standards for Semantic Mashups
 
Spark and Shark: Lightning-Fast Analytics over Hadoop and Hive Data
Spark and Shark: Lightning-Fast Analytics over Hadoop and Hive DataSpark and Shark: Lightning-Fast Analytics over Hadoop and Hive Data
Spark and Shark: Lightning-Fast Analytics over Hadoop and Hive Data
 
Running R on Hadoop - CHUG - 20120815
Running R on Hadoop - CHUG - 20120815Running R on Hadoop - CHUG - 20120815
Running R on Hadoop - CHUG - 20120815
 
What is new and cool j2se & java
What is new and cool j2se & javaWhat is new and cool j2se & java
What is new and cool j2se & java
 
Hadoop Summit 2012 | HBase Consistency and Performance Improvements
Hadoop Summit 2012 | HBase Consistency and Performance ImprovementsHadoop Summit 2012 | HBase Consistency and Performance Improvements
Hadoop Summit 2012 | HBase Consistency and Performance Improvements
 
Sparse Content Map Storage System
Sparse Content Map Storage SystemSparse Content Map Storage System
Sparse Content Map Storage System
 
Distributed Key-Value Stores- Featuring Riak
Distributed Key-Value Stores- Featuring RiakDistributed Key-Value Stores- Featuring Riak
Distributed Key-Value Stores- Featuring Riak
 
Tokyo Cabinet & Tokyo Tyrant
Tokyo Cabinet & Tokyo TyrantTokyo Cabinet & Tokyo Tyrant
Tokyo Cabinet & Tokyo Tyrant
 
Analyzing Real-World Data with Apache Drill
Analyzing Real-World Data with Apache DrillAnalyzing Real-World Data with Apache Drill
Analyzing Real-World Data with Apache Drill
 
Gremlin
Gremlin Gremlin
Gremlin
 
Drill dchug-29 nov2012
Drill dchug-29 nov2012Drill dchug-29 nov2012
Drill dchug-29 nov2012
 
Fluentd meetup at Slideshare
Fluentd meetup at SlideshareFluentd meetup at Slideshare
Fluentd meetup at Slideshare
 
Extend starfish to Support the Growing Hadoop Ecosystem
Extend starfish to Support the Growing Hadoop EcosystemExtend starfish to Support the Growing Hadoop Ecosystem
Extend starfish to Support the Growing Hadoop Ecosystem
 
Improve extension API: C++ as better language for extension
Improve extension API: C++ as better language for extensionImprove extension API: C++ as better language for extension
Improve extension API: C++ as better language for extension
 
Integrate Hive and R
Integrate Hive and RIntegrate Hive and R
Integrate Hive and R
 
Introduction to Tokyo Products
Introduction to Tokyo ProductsIntroduction to Tokyo Products
Introduction to Tokyo Products
 
Granularity in linked open data
Granularity in linked open dataGranularity in linked open data
Granularity in linked open data
 

Similaire à Apache Con Us2007 Jcr In Action

JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)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 RESTCarsten Ziegeler
 
Wrapper induction construct wrappers automatically to extract information f...
Wrapper induction   construct wrappers automatically to extract information f...Wrapper induction   construct wrappers automatically to extract information f...
Wrapper induction construct wrappers automatically to extract information f...George Ang
 
ログ収集プラットフォーム開発におけるElasticsearchの運用
ログ収集プラットフォーム開発におけるElasticsearchの運用ログ収集プラットフォーム開発におけるElasticsearchの運用
ログ収集プラットフォーム開発におけるElasticsearchの運用LINE Corporation
 
Adding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of TricksAdding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of Trickssiculars
 
Text indexing and search libraries for PHP - Zoë Slattery - Barcelona PHP Con...
Text indexing and search libraries for PHP - Zoë Slattery - Barcelona PHP Con...Text indexing and search libraries for PHP - Zoë Slattery - Barcelona PHP Con...
Text indexing and search libraries for PHP - Zoë Slattery - Barcelona PHP Con...phpbarcelona
 
Practical project automation
Practical project automationPractical project automation
Practical project automationReinout van Rees
 
Lightweight Grids With Terracotta
Lightweight Grids With TerracottaLightweight Grids With Terracotta
Lightweight Grids With TerracottaPT.JUG
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing RiakKevin Smith
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing RiakKevin Smith
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Coursepeter_marklund
 
A Re-Introduction to JavaScript
A Re-Introduction to JavaScriptA Re-Introduction to JavaScript
A Re-Introduction to JavaScriptSimon Willison
 
Web development basics (Part-3)
Web development basics (Part-3)Web development basics (Part-3)
Web development basics (Part-3)Rajat Pratap Singh
 
Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Jean-Michel Garnier
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Ryan Cuprak
 
Modern Webdevelopment With Ruby On Rails
Modern Webdevelopment With Ruby On RailsModern Webdevelopment With Ruby On Rails
Modern Webdevelopment With Ruby On RailsRobert Glaser
 

Similaire à Apache Con Us2007 Jcr In Action (20)

JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)JCR In Action (ApacheCon US 2009)
JCR In Action (ApacheCon US 2009)
 
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
 
Wrapper induction construct wrappers automatically to extract information f...
Wrapper induction   construct wrappers automatically to extract information f...Wrapper induction   construct wrappers automatically to extract information f...
Wrapper induction construct wrappers automatically to extract information f...
 
sysprog2 Part2
sysprog2 Part2sysprog2 Part2
sysprog2 Part2
 
ログ収集プラットフォーム開発におけるElasticsearchの運用
ログ収集プラットフォーム開発におけるElasticsearchの運用ログ収集プラットフォーム開発におけるElasticsearchの運用
ログ収集プラットフォーム開発におけるElasticsearchの運用
 
Adding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of TricksAdding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of Tricks
 
Text indexing and search libraries for PHP - Zoë Slattery - Barcelona PHP Con...
Text indexing and search libraries for PHP - Zoë Slattery - Barcelona PHP Con...Text indexing and search libraries for PHP - Zoë Slattery - Barcelona PHP Con...
Text indexing and search libraries for PHP - Zoë Slattery - Barcelona PHP Con...
 
Practical project automation
Practical project automationPractical project automation
Practical project automation
 
Lightweight Grids With Terracotta
Lightweight Grids With TerracottaLightweight Grids With Terracotta
Lightweight Grids With Terracotta
 
Let's Get to the Rapids
Let's Get to the RapidsLet's Get to the Rapids
Let's Get to the Rapids
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
A Re-Introduction to JavaScript
A Re-Introduction to JavaScriptA Re-Introduction to JavaScript
A Re-Introduction to JavaScript
 
Rails For Legacy Apps
Rails For Legacy AppsRails For Legacy Apps
Rails For Legacy Apps
 
20080611accel
20080611accel20080611accel
20080611accel
 
Web development basics (Part-3)
Web development basics (Part-3)Web development basics (Part-3)
Web development basics (Part-3)
 
Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)Les Tests avec Ruby on Rails et RSpec (in French)
Les Tests avec Ruby on Rails et RSpec (in French)
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
 
Modern Webdevelopment With Ruby On Rails
Modern Webdevelopment With Ruby On RailsModern Webdevelopment With Ruby On Rails
Modern Webdevelopment With Ruby On Rails
 

Plus de day

Performance Pack
Performance PackPerformance Pack
Performance Packday
 
Scala for scripting
Scala for scriptingScala for scripting
Scala for scriptingday
 
Scala4sling
Scala4slingScala4sling
Scala4slingday
 
Testing Zen
Testing ZenTesting Zen
Testing Zenday
 
Java Persistence Frameworks
Java Persistence FrameworksJava Persistence Frameworks
Java Persistence Frameworksday
 
Embrace OSGi Apache Con Europe2009
Embrace OSGi Apache Con Europe2009Embrace OSGi Apache Con Europe2009
Embrace OSGi Apache Con Europe2009day
 
Scripting Yor Java Application with BSF3
Scripting Yor Java Application with BSF3Scripting Yor Java Application with BSF3
Scripting Yor Java Application with BSF3day
 
Tarpm Clustering
Tarpm ClusteringTarpm Clustering
Tarpm Clusteringday
 
Tech Summit 08 Support Initiative
Tech Summit 08 Support InitiativeTech Summit 08 Support Initiative
Tech Summit 08 Support Initiativeday
 
Non Cms For Web Apps
Non Cms For Web AppsNon Cms For Web Apps
Non Cms For Web Appsday
 
Getting Into The Flow With Cq Dam
Getting Into The Flow With Cq DamGetting Into The Flow With Cq Dam
Getting Into The Flow With Cq Damday
 
Dispatcher Oom
Dispatcher OomDispatcher Oom
Dispatcher Oomday
 
Advanced Collaboration And Beyond
Advanced Collaboration And BeyondAdvanced Collaboration And Beyond
Advanced Collaboration And Beyondday
 
Wc Mand Connectors2
Wc Mand Connectors2Wc Mand Connectors2
Wc Mand Connectors2day
 
Jackrabbit Roadmap
Jackrabbit RoadmapJackrabbit Roadmap
Jackrabbit Roadmapday
 
Doc Book Vs Dita
Doc Book Vs DitaDoc Book Vs Dita
Doc Book Vs Ditaday
 
Doc Book Vs Dita Teresa
Doc Book Vs Dita TeresaDoc Book Vs Dita Teresa
Doc Book Vs Dita Teresaday
 
862
862862
862day
 
Apache Con Us2007 Sanselan
Apache Con Us2007 SanselanApache Con Us2007 Sanselan
Apache Con Us2007 Sanselanday
 
Apache Con Us2007 Apachei Batis
Apache Con Us2007 Apachei BatisApache Con Us2007 Apachei Batis
Apache Con Us2007 Apachei Batisday
 

Plus de day (20)

Performance Pack
Performance PackPerformance Pack
Performance Pack
 
Scala for scripting
Scala for scriptingScala for scripting
Scala for scripting
 
Scala4sling
Scala4slingScala4sling
Scala4sling
 
Testing Zen
Testing ZenTesting Zen
Testing Zen
 
Java Persistence Frameworks
Java Persistence FrameworksJava Persistence Frameworks
Java Persistence Frameworks
 
Embrace OSGi Apache Con Europe2009
Embrace OSGi Apache Con Europe2009Embrace OSGi Apache Con Europe2009
Embrace OSGi Apache Con Europe2009
 
Scripting Yor Java Application with BSF3
Scripting Yor Java Application with BSF3Scripting Yor Java Application with BSF3
Scripting Yor Java Application with BSF3
 
Tarpm Clustering
Tarpm ClusteringTarpm Clustering
Tarpm Clustering
 
Tech Summit 08 Support Initiative
Tech Summit 08 Support InitiativeTech Summit 08 Support Initiative
Tech Summit 08 Support Initiative
 
Non Cms For Web Apps
Non Cms For Web AppsNon Cms For Web Apps
Non Cms For Web Apps
 
Getting Into The Flow With Cq Dam
Getting Into The Flow With Cq DamGetting Into The Flow With Cq Dam
Getting Into The Flow With Cq Dam
 
Dispatcher Oom
Dispatcher OomDispatcher Oom
Dispatcher Oom
 
Advanced Collaboration And Beyond
Advanced Collaboration And BeyondAdvanced Collaboration And Beyond
Advanced Collaboration And Beyond
 
Wc Mand Connectors2
Wc Mand Connectors2Wc Mand Connectors2
Wc Mand Connectors2
 
Jackrabbit Roadmap
Jackrabbit RoadmapJackrabbit Roadmap
Jackrabbit Roadmap
 
Doc Book Vs Dita
Doc Book Vs DitaDoc Book Vs Dita
Doc Book Vs Dita
 
Doc Book Vs Dita Teresa
Doc Book Vs Dita TeresaDoc Book Vs Dita Teresa
Doc Book Vs Dita Teresa
 
862
862862
862
 
Apache Con Us2007 Sanselan
Apache Con Us2007 SanselanApache Con Us2007 Sanselan
Apache Con Us2007 Sanselan
 
Apache Con Us2007 Apachei Batis
Apache Con Us2007 Apachei BatisApache Con Us2007 Apachei Batis
Apache Con Us2007 Apachei Batis
 

Dernier

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 

Dernier (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 

Apache Con Us2007 Jcr In Action

  • 1. JCR in Action Content-based Applications with Apache Jackrabbit Carsten Ziegeler Bertrand Delacreataz cziegeler@apache.org bdelacretaz@apache.org Day Software Day Software
  • 2. About Bertrand Delacretaz • Apache Software Foundation Member – Cocoon, FOP, Solr, Sling, Tika, Incubator – PMC: Cocoon, Tika, Sling • Senior Developer at Day Software • Living in Lausanne, Switzerland
  • 3. About Carsten Ziegeler • Apache Software Foundation Member – Cocoon, Excalibur, Pluto, Felix, Incubator, Sling, Sanselan – PMC: Cocoon, Incubator, Portals, Felix, Excalibur (Chair) • Senior Developer at Day Software • Article/Book Author, Technical Reviewer • JSR 286 spec group (Portlet API 2.0)
  • 4. and jobs! infos, discussions Visit our booth for Agenda • JCR and Apache Jackrabbit Basic content modeling • • References and search Advanced features • • Sample application Summary and questions • 4
  • 5. Session Planner • XSLT and Xpath – Without the Pain Bertrand Delacretaz – Today 15:00 • Apache Sling (Fast Feather Track) Felix Meschberger – Thursday 10:00 • A Little REST and Relaxation Roy Fielding – Thursday 14:00 • Apache Sanselan (Fast Feather Track) Carsten Ziegeler – Thursday 15:00 • Getting Up to Speed with Apache iBatis Carsten Ziegeler – Thursday 16:30 • The Apache Portals Panel Carsten Ziegeler – Friday 10:00
  • 6. Content Repository • Generic application data store Structured and unstructured content • • Support small and large-scale data Locking, transactions, versioning, • observation and searching 6
  • 7. JSR 170: Content Repository for Java technology API TM • (Java) Standard – Supported by many vendors – Several open source solutions • How do you connect to a CR? • How do you interact with a CR? • How do you query a CR? 7
  • 8. Content Repository Features • Hierarchical content • Structured – Nodes and properties (with types) • And/or unstructured • Read only or read/write • Fine and coarse-grained 8
  • 9. Content Repository Features • Query (XPath) Export/Import (XML) • • Referential Integrity Access Control • • Versioning Observation • • Locking and Transactions (JTA) 9
  • 10. Comparison • File system – Hierarchival, unstructured, read/write • Database – Structured, read/write – Referential integrity, transactions • Content Repository – Advantages of a FS and a database – Plus observation, versioning etc. 10
  • 11.
  • 12. The Repository Model • Repository = one (or more) workspaces Workspace = 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
  • 13. Nodes & Properties Root W = Node or C ks on pa te ce nt = Property R A ep os ito a ry c b g d h e „Once upon a -25 time..“ i j k 6.02x1023 true Implementation of JCR
  • 14. Connecting to the Repository
  • 15. Working with the Repository
  • 18. 18 Apache Jackrabbit – JSR 170 reference implementation – Apache TLP since 2006 – Looking back • 1.0: April 2006 • 1.1: October 2006 • 1.2: January 2007 • 1.3: April 2007 – Looking forward (tentative) • 1.4: 2007 • 2.0: 2008 (JCR 2.0 RI) • announce- subscribe@jackrabbit.apache.org – Components http://jackrabbit.apache.org/ • Core, API, RMI, WebDAV,webapp, JCA, …
  • 19. Words of advice • Read (or browse) the JCR specification – jcr-1.0.jar included • Getting started with Jackrabbit – jackrabbit-webapp: Drop-in deployment – First Hops: Embedded repository – Take your time 19
  • 20. Words of advice • Resources – Mailing lists: Excellent support, but may delay you – Website: Some good parts, but not complete or very well structured – Wiki: End user experience – FAQ: outdated – Issue tracker: Good response time 20
  • 21. Agenda • JCR and Apache Jackrabbit Basic content modeling • • References and search Advanced features • • Sample application Summary and questions • 21
  • 22. Introducing JCR Tunes • JCR example application • “How to implement a music store or library with JCR?” • Designed to showcase JCR features and best practices • Store and manage individual “tunes” – optionally organized in albums, etc. 22
  • 23. Introducing JCR Tunes II • Support alternative views like – predefined genres, or more ad-hoc searches • Integrated handling of reviews, cover images, and other related content • Staged publishing and timed releases of tunes or albums 23
  • 24. Introducing JCR Tunes III • Personalization for things like settings, favorites, personal play-lists, etc. • Extensibility and flexibility  24
  • 25. Starting point: Leverage the standard node types • Type hierarchy • Content hierarchy nt:hierarchyNode nt:folder nt:file nt:linkedFile nt:resource 25
  • 26. Bottom-up modeling: Content types my:album > nt:folder my:review > nt:file - artist (string) - author (string) - release date (date) - star rating (long) my:tune > nt:file - artist (string) - release date (date) my:resource > nt:resource - codec (string) - bitrate (long) 26
  • 27. Top-down modeling: Content hierarchies Label Label Band Label Album Album Band Reviews Tune Tune Images Tune Reviews Images 27
  • 28. 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
  • 29. Content Modeling: Words of advice • Use an application root node – /my:content – Good for searching, backup, and migration • Avoid flat hierarchies – User interface complexity – Jackrabbit performance • Content-driven design – Design your content before your application 29
  • 30. Content Modeling: Words of advice • Checkout Jackrabbit wiki and mailing lists – quot;Davids Modelquot; • Look at existing node types • Mixin node types possible 30
  • 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/DavidsModel
  • 32. Agenda • JCR and Apache Jackrabbit Basic content modeling • • References and search Advanced features • • Sample application Summary and questions • 32
  • 33. Alternative Views: References tags tunes playlists Rock Classic Tune Top 10 Picks link link link Tune API: Node.getReferences():PropertyIterator Property.getNode():Node Node.setProperty(String name, Node) 33
  • 34. Alternative Views: Search Looking XPath SQL for Latest /jcr:root/my:tunes//element(*,my:tune SELECT * FROM my:tune releases ) WHERE [@released > xs:dateTime(‘…’)] jcr:path LIKE ‘/my:tunes/%’ AND released > DATE ‘…’ Reviews /jcr:root/my:tunes//element(*,my:revi SELECT * FROM my:review with ew) WHERE keywords /jcr:content[jcr:contains(.,’…’)] jcr:path LIKE ‘/my:tunes/%’ AND CONTAINS(*,‘…’) API: Session.getWorkspace().getQueryManager():QueryManager QueryManager.createQuery(String stmt, String language):Query; Query.execute():QueryResult 34
  • 35. Alternative Views: Words of advice • Moderate use of references – Circular references only within a subtree – Plan for backup and content migration – Jackrabbit performance: max 10k references to a single node • Best search performance when selecting a small subset of content • References, path or name property 35
  • 36. Alternative Views: Words of advice • No joins or aggregate searches • Full text indexing of binary properties only for jcr:data in nt:resource nodes • Formatting date queries – ISO 8601 as the string format – session.getValueFactory().createValue(Calendar .getInstance()).getString() 36
  • 37. Agenda • JCR and Apache Jackrabbit Basic content modeling • • References and search Advanced features • • Sample application Summary and questions • 37
  • 38. Staged Publishing: Versioning Version store Staging Live 38
  • 39. Personalization tunes users Tune John Jane tunes favorites playlists Tune link link 39
  • 40. Authentication and Authorization • Java Authentication and Authorization Services (JAAS) – Mostly the authentication part is currently used by Jackrabbit – Pluggable authentication components – Support for single sing-on 40
  • 41. Authentication and Authorization • Custom AccessManager interface in Jackrabbit – Pluggable authorization components – The default implementation supports only global read, write, and admin access – More advanced implementations are proprietary 41
  • 42. Authentication and Authorization • Repository-level authentication and authorization applies to all clients – Better than application-level authorization 42
  • 43. Jackrabbit Configuration • Workspace configuration – XML configuration – Persistence Managers – Query index configuration (Lucene) – File system configuration • Check out the documentation
  • 44. Observation • Optional feature of the JCR specification • Enables applications to register interest in events • Monitoring events • Responding 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
  • 45. Event Types • Events can be of 5 different types – NODE_ADDED – NODE_REMOVED – PROPERTY_ADDED – PROPERTY_REMOVED – PROPERTY_CHANGED Advanced JCR Features
  • 46. 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 Advanced JCR Features
  • 47. 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
  • 48. Agenda • JCR and Apache Jackrabbit Basic content modeling • • References and search Advanced features • • Sample application Summary and questions • 48
  • 49. 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 49
  • 50. 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 50
  • 52. SMS Sample: Observation observationSession .getWorkspace() .getObservationManager() .addEventListener( this, javax.jcr.observation.Event.PROPERTY_CHANGED | javax.jcr.observation.Event.NODE_ADDED, SMS_EVENT_ROOT, true, null, new String[] { SMS_EVENT }, true );
  • 53. SMS Sample: Event Handling public void onEvent(EventIterator events) { ... case javax.jcr.observation.Event.NODE_ADDED: Node newEvent = (Node) observationSession.getItem(path); String date = newEvent.getProperty(EVENT_DATE).getString(); DateFormat formater = new SimpleDateFormat(quot;dd.MM.yyyy hh:mm:ssquot;); Date pdate = formater.parse(date); addScheduledEvent(pdate, path); break;
  • 54. SMS Sample: Event Processing private void sendSms(Node event) throws RepositoryException { String topicPath = event.getProperty(TOPIC_PATH).getString(); String text = event.getProperty(TEXT).getString(); String smsSubscribers[] = getSmsSubscribers(topicPath); send(text, smsSubscribers); }
  • 55. SMS Sample: Event Processing private String[] getSmsSubscribers(String topicPath) { Node topic = (Node) session.getItem(topicPath); Node subscriberNode = topic.getNode(quot;subscribers“); NodeIterator subscribers = subscriberNode.getNodes(); while (subscribers.hasNext()) { Node subscriber = subscribers.nextNode(); String path= subscriber.getProperty(SMS_USER_PATH).getString(); Node user = (Node) session.getItem(path); String mobileNumber = user.getProperty(SmsUserContent.MOBILE_NUMBER).getString(); } }
  • 56. Advanced Development • Apache Jackrabbit OCM – Map content to Java objects and vice versa – Similar to database ORMs • Apache Sling – New project in incubation – REST based web framework – Leverages OSGi 56
  • 57. Agenda • JCR and Apache Jackrabbit Basic content modeling • • References and search Advanced features • • Sample application Summary and questions • 57
  • 58. Conclusion • (Nearly) Everything is content – Application content – HTML pages, CSS and JavaScript files, static images – Documentation, resource bundles, etc. – With versioning, export/import, full text search, etc. 58
  • 59. Conclusion • Web-friendly – Trivial URI mapping – WebDAV access for free – Dispatch on node type, not on URI path • In your application? • Look at Jackrabbit OCM and Apache Sling 59
  • 60. Session Planner • XSLT and Xpath – Without the Pain Bertrand Delacretaz – Today 15:00 • Apache Sling (Fast Feather Track) Felix Meschberger – Thursday 10:00 • A Little REST and Relaxation Roy Fielding – Thursday 14:00 • Apache Sanselan (Fast Feather Track) Carsten Ziegeler – Thursday 15:00 • Getting Up to Speed with Apache iBatis Carsten Ziegeler – Thursday 16:30 • The Apache Portals Panel Carsten Ziegeler – Friday 10:00
  • 61. Visit our booth for infos, discussions and jobs! Q&A 61