44
Technology Presentation 1 WebTuesday: μjax in 30 minutes. Lars Trieloff Product Manager Day Software apache sling (...?!) .... “me” instead

Webtuesday Zurich

Embed Size (px)

DESCRIPTION

content repository, jsr-170, jsr-283, jcr, ajax, apache sling, jackrabbit

Citation preview

Page 1: Webtuesday Zurich

Technology Presentation 1

WebTuesday: µjax in 30 minutes.

Lars TrieloffProduct ManagerDay Software

apache sling(...?!)

.... “me” instead

Page 2: Webtuesday Zurich

Content-Centric Infrastructure

David Nuescheler Chief Technology [email protected]

David NueschelerJackrabbit Committer / [email protected]

David NueschelerJSR-170 Spec [email protected]

2

Page 3: Webtuesday Zurich

obpqof`qba

R håçï=óçìê=eqji=C=g~î~ëÅêáéíe~îÉ=~=î~ÖìÉ=ÅçåÅÉéí=çÑ=~=“`çåíÉåí=oÉéçëáíçêóÒ=~åÇ=“obpqÒ

Page 4: Webtuesday Zurich

WebTuesday: Sling in 30Web Development

What’s JCR (elevator pitch)

REST meets JCR meets Ajax

Building TSS as a Content Appsilver

Page 5: Webtuesday Zurich

WebTuesday: Sling in 30Web Development

What’s JCR (elevator pitch)

REST meets JCR meets Ajax

Building TSS as a Content Appsilver

Page 6: Webtuesday Zurich

What’s JCR?

`çåíÉåí=oÉéçëáíçêó=Ñçê=g~î~qj=íÉÅÜåçäçÖó=^mfpéÉÅJiÉ~ÇWa~ó=pçÑíï~êÉpí~íìëW=cáå~ä=oÉäÉ~ëÉ=NTJàìåJOMMR

gpoJNTM

bñéÉêí=dêçìéW

Page 7: Webtuesday Zurich

bñéÉêí=dêçìéW

gpoJNTM gpoJOUP

`çåíÉåí=oÉéçëáíçêó=Ñçê=g~î~qj=íÉÅÜåçäçÖó=^mf=îOKMpéÉÅJiÉ~ÇWa~ó=pçÑíï~êÉpí~íìëW=mìÄäáÅ=oÉîáÉï=`äçëÉÇ=ëÉéJOMMT

What’s JCR?

Page 8: Webtuesday Zurich

What’s JCR?

“The API should be a standard, implementation independent, way to access content bi-directionally on a granular level to a content repository.” ?

Page 9: Webtuesday Zurich

Best of both worlds.

data base filesystem

content repository

read

write

hier-archiesstreams

locking accesscontrol

integrity structure

tx query

un-structured“full-text” sort

orderversion

ingobser-vation

multi-value

Page 10: Webtuesday Zurich

- Reality Check -

Task: Write a JSP snippet that lists “documents” in a “folder”.”

What’s JCR?

Page 11: Webtuesday Zurich

What’s JCR?- Reality Check -

Task: Write a JSP snippet that lists “documents” in a “folder”.”

<%childCount = node.getContentCount();for(int i=0;i<childCount;i++) { IContent child = node.getContent(i); Property title = child.getPropertyByName("Title"); %><%= title.getValue() %><br/><%}%>

<%LAPI_DOCUMENTS documents

= new LAPI_DOCUMENTS(session);

LLValue childTable = new LLValue();

documents.ListObjects(volumeID, folderID,

null, null, LAPI_DOCUMENTS.PERM_SEE, chi

ldTable);

Enumeration children = childTable.enumerateValue

s();

while(children.hasMoreElements()) {

LLValue child = (LLValue)e.nextElement()

;

String title = child.toString("Name");

%><%= title %><br/><%

}%>

<%fndocs = new IFnObjSetDualProxy( fnfolder.getContents(idmFolderContent.idmFolderContentDocument));

int numDocs = fndocs.getCount();for (int i = 1; i <= numDocs; i++) {

IFnDocumentDual fndoc = new IFnDocumentDualProxy(fndocs.getItem(new Integer(i)));

IFnPropertiesDual propset = fndoc.getProperties();

IFnPropertyDual idmTitleProp = propset.getItem("Title");

String title = idmTitleProp.getValue();

%><%= title %><br/><% if (comCleanup) { cleaner.release(fndoc); }}%>

<%IDocuments documents =

new IDocumentsProxy(binder.getDocuments());

documents.cache();

int documentCount = documents.getCount();

for (int i = 0; i<documentCount; i++) {

document = new IDocumentProxy(docume

nts.getItemByIndex(i));

String title = document.getTitle()

%><%= title %><br/><%

}%>

<%PageIterator children = page.getPages();while (children.hasNext()) { Page child = children.nextPage(); Container toplevel = child.getContent(); Atom title = toplevel.getAtom("Title"); %><%= title %><br /><%}%>

+800

<%NodeIterator children = node.getNodes();while (children.hasNext()) { Node child = children.nextNode(); Property title = child.getProperty("Title"); %><%= title %><br /><%}%>

JCR API

Page 12: Webtuesday Zurich

- Functional Elevator Pitch -What’s JCR?

level 1

level 2

read, export, query

write, import, accesscontrol

sql locking obser-vation tx versioning

optional

Page 13: Webtuesday Zurich

JSR-283 Public Review Ballot

approved

Java Standardization

Page 14: Webtuesday Zurich

Java Standardization

Page 15: Webtuesday Zurich

Known compliant Repositories

Apache Jackrabbit Oracle XML DBExo

ECMS PlatformMicrosoft

Sharepoint OpenText Livelink

Day CRX IBM FileNet P8 Xythos Repository Alfresco ECM Vignette V7

Interwoven Repository IBM CM EMC Documentum

How many

RDBMS vendors

do you need?+hundreds of TCKsregistered

* *

*

*

* using third party connector

*

Page 16: Webtuesday Zurich

Sourcemix Sourcemix

Percussion Rhythmix Lutece

Portal

QuickWCM WCMS

Jahia Framework

Hippo CMS

InfoQ Online CommunityNuxeo ECM

Sakai E-learning

TYPO3 v5.0 WCMGX WebManager

Exo ECMS Platform

Liferay Enterprise Portal

Artifactory Maven Proxy

IBM FileNet WebSiteManagerApache James

medic-2-medic mapofmedicine

Day Communiqué WCMS

Apache Tapestry

Day Communique Collab

QSLabs ComplianceApache

Cocoon

Alfresco ECMSApache Sling

Mindquarry Collaboration

Day Communique DAMmagnolia WCMS

JBoss Portal

Some known JCR Applications

Sun OpenPortal Interface 21

Spring Framework

Fast Enterprise SearchOracle PortalBEA Portal

Page 17: Webtuesday Zurich

JCR - Weatherforcast-5°

2008 2009-8°

2010-12°

Page 18: Webtuesday Zurich

WebTuesday: Sling in 30Web Development

What’s JCR (elevator pitch)

REST meets JCR meets Ajax

Building TSS as a Content Appsilver

Page 19: Webtuesday Zurich

WebTuesday: Sling in 30Web Development

What’s JCR (elevator pitch)

REST meets JCR meets Ajax

Building TSS as a Content Appsilver

Page 20: Webtuesday Zurich

JCR: Yours truly

REST over JCR

REST -> Roy T. Fielding

released y2k162 pages

v1.0 released 2005

+300 pages

Page 21: Webtuesday Zurich

JCR

functionally broad

well designedlong term

strategicheavy duty16 tons

stable & durable

The Problem:

Page 22: Webtuesday Zurich

JCR

me

short-sighted...easily confused

developer hat

hacklazy

“i want to build webapps” the o

ther

side

functionally broad

well designedlong term

strategicheavy duty16 tons

stable & durable

The Problem:

Page 23: Webtuesday Zurich

The Silver bullet:

JCR

me (david)

developer hat

very simple projection: fits the bill

sling

silver

Page 24: Webtuesday Zurich

Apache Sling

sling.js & .jst“the artist formerly

known as”:

jax

JCR backed ReST-Webkit(OSGI, OCM , ...)

contains

jsprubyscala

groovyesp...

Page 25: Webtuesday Zurich

I2

3

Browser

J2EE WebServer

browser & sling.jsreading: json & resource GET’swriting: form-POSTs & GETs

Sling Servletstranslating requests to JCR calls

JCR CompliantContent Repository

I

2

3very simple js API to read content, Forms to write content

handles all the heavy lifting, particularly security16 tons

Page 26: Webtuesday Zurich

It’s the web, baby!URLs matter.

.../product.jsp?id=12346

Mistake 1:Addressing the “Script”Mistake 2:.jsp? What the heck?

Mistake 3:Passing in “this”

Page 27: Webtuesday Zurich

Repository

Reclaiming the web.Sling URL decomposition.

/cars/audi/s4.details.html

Content Repository Path...selects a particular script

Page 28: Webtuesday Zurich

“Data First!”JCR supports “structure first” aswell. (but that’s missing point)

Page 29: Webtuesday Zurich

Getting ready...

download and installtest & mount as a drive

Page 31: Webtuesday Zurich

simple write example

write me!http://localhost:7402/apps/firs

tsteps/1_write.html

<html>

<head><title>s

ling: simple w

rite example</

title>

</head><body>

<form action="

/content/first

steps" method=

"POST">

<!-- title -->

<h2>Title</h2>

<input type="t

ext" name="Tit

le" />

<!-- descripti

on -->

<h2>Descriptio

n</h2>

<textarea rows

="5" name="Des

cription">

</te

xtarea>

<!-- color -->

<h2>Color</h2>

<select name="

Color">

<option value=

"red">red

<option value=

"green">green

</select>

</form>

</body>

</html>

Page 32: Webtuesday Zurich

simple read example

read me!http://localhost:7402/apps/firststeps/2_read.html

<html>

<head><title>s

ling: simple r

ead example</t

itle>

</head>

<body>

<script src

="/system/slin

g.js"></script

<script>

var node=Sl

ing.getContent

("/content/fir

ststeps");

var div='<d

iv style="back

ground-color:'

+node.Color+'"

>';

document.wr

ite(div);

</script>

<h2><script>

document.write

(node.Title);

</script></h2>

<p><script>

document.write

(node.Descript

ion);

</script></p>

</div>

</body>

</html>

Page 33: Webtuesday Zurich

add newhttp://localhost:7402/apps/firststeps/3_addnew.html

add new entry

<html>

<head><title>s

ling: add new

entry example<

/title>

</head><body>

<form action="

/content/first

steps/entries/

*"

method="PO

ST" >

<h2>Title</h2>

<input type="t

ext" name="Tit

le" />

<h2>Descriptio

n</h2>

<textarea rows

="5" name="Des

cription"></te

xtarea>

<h2>Color</h2>

<select name="

Color">

<option value=

"red">red

<option value=

"green">green

</select>

<p><input type

="submit"></p>

</form>

</body>

</html>

Page 34: Webtuesday Zurich

list entries

list entrieshttp://localhost:7402/apps/firststeps/4_list.html

<html>

<head><title>s

ling: list ent

ries example</

title>

[...]

<script>

var entries=Sl

ing.getContent

("/content/fir

ststeps/entrie

s", 2);

</script>

<div>

<script>

for (var a i

n entries) {

var entry=ent

ries[a];

document.

write('<div st

yle="backgroun

d-color:'+entr

y.Color+'">');

document.

write('<h2>'+e

ntry.Title+'</

h3>');

document.

write(entry.De

scription);

if(entry.

Image) {

[...]

}

document.

write('</div>'

);

document.

write('<a href

="4_list.html"

onclick=

”ujax.removeCo

ntent(\'/mydat

a/entries/\'+a

+'\'">

remove</

a>');

}

</script>

<a href="3_add

new.html">add

new</a>

</div>

</body>

Page 36: Webtuesday Zurich

WebTuesday: Sling in 30Web Development

What’s JCR (elevator pitch)

REST meets JCR meets Ajax

Building TSS as a Content Appsilver

Page 37: Webtuesday Zurich

WebTuesday: Sling in 30Web Development

What’s JCR (elevator pitch)

REST meets JCR meets Ajax

Building TSS as a Content Appsilver

Page 38: Webtuesday Zurich

Essentially:

Re-build “TSS++” as a content app.

Page 39: Webtuesday Zurich

Transform “TheServerSide.com” into a jax and JCR backed Content App.

TheServerSide.com as a content Application.

- goals -

»»NO TOOLS!

(well texteditor &

browser ;) )

Page 40: Webtuesday Zurich

Buddy coding:

Beer for

Bug.

Page 41: Webtuesday Zurich

Content-Centric Infrastructure

DEMO

Page 42: Webtuesday Zurich

If you remember only 2 things.visit us: dev.day.comregister for JCR Cup 2008Make your next Application a Content Application

2

I booth &

fireside chat

Page 43: Webtuesday Zurich

Content-Centric Infrastructure

Q&A

Page 44: Webtuesday Zurich

Content-Centric Infrastructure

Thank you for your attention