If you can't read please download the document
Upload
jozef-chocholacek
View
6.255
Download
0
Embed Size (px)
Citation preview
PowerPoint Presentation
Content Repository API for Java (JCR)&ModeShape
Jozef Chocholek@jchocholJBoss Community Team
Agenda
JCR what is it (good for)
ModeShape beyond JCR
How do we use JCR and ModeShape
JCR
Content Repository API
for Java
Simple answer:
JSR-170, JSR-283 javax.jcr API
OK, few more details:Abstracts where and how the content is stored
Best things from databases and file systems
+ additional features
Typical uses: CMS, portals, knowledge bases, artifact repositories, ...
DB: structure, integrity, queryFS: stream, locking, access control, hierarchyNew: unstructured, versioning, search, events
Typical use: ... test management systems
JCR
Basic Concepts
Repository
Workspace
Node
Property
Node Type
Path / UUID
Session
Namespace registry
Node type manager
Version manager
Lock manager
...
JCR
API Example
JCR
Node Types
Defines the structure of the node
Supertype(s)
Primary node type / mixin node type
Property names and typesSTRING, URI, BOOLEAN, LONG, DOUBLE, DECIMAL, BINARY, DATE, NAME, PATH, REFERENCE, WEAKREFERENCE
Child nodes and their (node) types
In a writable repository a node's primary type is first assigned upon node creation, while mixin types may be assigned on creation or during a node's lifetime. Repository implementations may vary as to how flexible they are in allowing changes to the primary or mixin node types assigned to a node..Primary type ~= Class, Mixin Type ~= Interface.nt:base, jcr:primaryType, .nt:hierarchyNode => nt:file, nt:folder, nt:resource, nt:address, ....mix:referenceable, mix:created, mix:mimeType, mix:language.
JCR
Node Type Example
[mix:mimeType] mixin - jcr:mimeType (STRING) - jcr:encoding (STRING)[mix:created] mixin - jcr:created (DATE) autocreated - jcr:createdBy (STRING) autocreated [nt:base] abstract - jcr:primaryType (NAME) mandatory autocreated protected COMPUTE - jcr:mixinTypes (NAME) protected multiple COMPUTE[mix:lastModified] mixin - jcr:lastModified (DATE) autocreated - jcr:lastModifiedBy (STRING) autocreated[nt:hierarchyNode] > mix:created abstract[nt:folder] > nt:hierarchyNode + * (nt:hierarchyNode) VERSION[nt:file] > nt:hierarchyNode primaryitem jcr:content + jcr:content (nt:base) mandatory[nt:resource] > mix:mimeType, mix:lastModified primaryitem jcr:data - jcr:data (BINARY) mandatory
JCR
Query Languages
XPath
JCR-SQL
JCR-SQL2
JCR-JQOM
SQLJCR-SQL2
tablenode type
columnproperty
rownode
Xpath and JCR-SQL deprecated in JCR 2.0.Nodes appear as rows in those tables that correspond to the nodes types- a node can appear as a row in multiple tables- often a complete picture of a node requires joining multiple tables- other joins are possible, such as ancestors, descendants, equivalent properties.JQOM = Java Query Object Model (mapping of AQM to Java API)javax.jcr.query.qom.*.
JCR
JCR-SQL2 Examples
JCR
JCR-JQOM Example
JCR
Advantages
(Why To Use JCR)
Standard API
Flexible data structure
Hierarchical graph-based storage
Search & query
Versioning
Access control
Referential integrity, locking, events, ...
Search & Query: most implementations automatically indexes the content (Jackrabbit and ModeShape use Lucene)
JCR
Implementations
Jackrabbit (Apache)
CRX (Day Software / Adobe)
ModeShape
Alfresco
eXo Platform (donated to the Jboss Community)
Oracle Beehive
eXo-JCR has been donated to the JBoss Community by eXo Platform
ModeShape
JCR 2.0 implementation (all required & most of the optional features)
Own Graph API
Sequencers
Connectors (storage/access)
Federation
RESTful API
Clustering
...
ModeShape
Storage Options
Multiple
out-of-the-box
connectors
Easy to write
your own connector
JDBC via JPA/Hibernate.Infinispan data grid platform (CLOUD!!!).E.g. transient or filesystem for light-weight apps (or development),Database (JPA) for production
ModeShape
Connectors
Use JCR API to access data
from other systems
(but leave the data where it is)
E.g. filesystem, Subversion,
JBDC metadata, ...
Connectors: other JCR,
ModeShape
Federation
Virtual repository with projected workspaces from real repositories
Use the best data store for each kind of data
Combination of own and external data
Consistent use of JCR API
Mapping (projection) of R1:W1 -> F:Wa, F1:W2 -> F:Wb, R2:W1 -> F:Wc, ...
ModeShape
Sequencers
Extract meaningful data from various file formats
Many out-of-the-box:ZIP, JAR, EAR, WAR files
Java class and source files
DDL files
XML files
Microsoft Office documents
Image metadata (JPEG, GIF, BMP, PCX, PNG, IFF, ...)
MP3
and more
Easy to implement custom sequencers
ZIP (JAR, WAR, EAR): nt:file + nt:folderJava source/class: nt:unstructured for package class name, annotations, constructors, methods, fields class:* namespaceMS Office: structure via POI libraryImage: jcr:mimeType, jcr:encoding, image:formatName, image:width, image:height, image:bitsPerPixel, image:progressive, image:numberOfImages, image:physicalWidthDpi, image:physicalHeightDpi, image:physicalWidthInches, image:physicalHeightInchesNot sure about EXIF data
TEIID sequencers (Teiid = data virtualization)
Text sequencers (delimiter, fixed width)
ModeShape
Extended JCR-SQL2
ModeShape supports complete JCR-SQL2 language as defined in specification, plus:Additional joins (FULL OUTER, CROSS)
Subqueries in criteria
SELECT [DISTINCT]
UNION/INTERSECT/EXCEPT [ALL]
LIMIT and OFFSET
DEPTH and PATH criteria
REFERENCE criteria
IN and NOT IN
BETWEEN val1 [EXCLUSIVE] AND val2 [EXCLUSIVE]
Arithmetic expressions in criteria
ModeShape
Other Features
RESTful service
WebDAV service
JDBC driverConnects to one workspace
jdbc:jcr:http://{hostname}:{port}/modeshape-rest/?repositoryName={name}&user=...
JOPR RHQ plugin
Eclipse plugin (JBoss Tools)
RESTful service: JSON responses (HTML, XML planned), uses RESTEasy.WebDAV: mount repository as network share.JDBC driver it has many limitations, not full JDBC workspace in URL is optional, driver connects to the default workspace if missing.JOPR/RHQ managment tool.
ModeShape
Why Use ModeShape?
Use the data you already have
Leave the data where it is
Sequencers (automatized extraction of content)
Federation
Standard JCR API and beyond
Light-weight, embeddable, clusterable
Fast development process
Backed up by a big open-source company
Imagine the situation:You have to develop search solution for your company data partially in SQL databases, partially in SAP, some data on filesystem (MS Office docs), ...Then you can develop all parsers, connectors etc. on your own or you will use JCR API in your search engine and ModeShape with its connectors, sequencers and federationm for accessing the data.
jboss.org
JCR, ModeShape
and jboss.org
http://www.jboss.org/modeshape
Old name was JBoss DNA
Work in progress on empowering JBoss Community services with the strength of ModeShapedownloads.jboss.org
docs.jboss.org
search.jboss.org
Use in other JBoss projects/products
They fleed to GitHub but the rest of the infrastructure is on jboss.org
jboss.org
Magnolia CMS & ModeShape
JCR based open-source (Java) CMS
By default on Apache Jackrabbit
Modular
From v.4.2.2
supports
ModeShape
Goal: Native
support for
downloads.jboss.org
4.2.2 is considered experimental.Performance issues, to be solved in ModeShape 2.5.
jboss.org
ModeShape & JBoss Projects
Teiid
Drools
SOA Platform
BRMS
...
In SOA-Platform 5.1 to be released in few days.In BRMS 5.1.1 or 5.2 (5.1 to be released as ^^^).
Summary
JCR API is standard, simple and easy-to-use
ModeShape is JCR implementation, and adds important extensions
jboss.org eats its own dogfood ;-)
Links
http://www.jboss.org/modeshape
http://www.jcp.org/en/jsr/detail?id=283
http://www.magnolia-cms.com/
Freenode IRC: #modeshape
Twitter:
@modeshape @magnolia_cms @jbossorg @jchochol
Questions
?
Thank You!
D2 D3A107
9:00-9:45 Perl packaging for developers Marcela Malov MythTV - User view Luk Doktor 9:50-10:35 Java packaging for developers Stanislav Ochotnicky Gnome 3.0 (r)evolution - Tom Batek 10:40-11:25 JCR + ModeShape - Jozef Chocholek Plasma Workspaces 4 by KDE Luk Tinkl, Jaroslav eznk Power management Jaroslav karvada, Jan Velk
11:30-12:30 LunchLunchLunch
12:30-13:15Planning and Scheduling with Drools - Luk Petrovick Spice - Jonathan Blandford Introduction to Qt development Jaroslav eznk
13:20-14:05Teiid - data virtualization system - Boris Belovic Beyond init: systemd - Lennart Poettering Remote Desktop Adam Tk
14:10-14:55PicketLink and PicketBox - Peter kopek Discussion: Bootloader and Dracut Future Plans - Harald Hoyer (session ends 10 minutes sooner) Bug hunting & static analysis Ondej Vak and Petr Muller
15:00-15:45Web Services for Remote Portlets - Michal Vano System vs. Session David Zeuthen
15:50-16:35Infinispan: The future of open source data grids Radoslav Husr, Michal Linhard SysVinit, upstart and systemd in Fedora and RHEL Petr Lautrbach
16:40-17:25Deltacloud API Michal Fojtik Modern Linux Desktop alphabet Tom Batek, Jaroslav eznk
Click to edit the title text format