µjax in 30 minutes (for Stockholm)

45
μjax in 30 minutes [email protected] weblogs.goshaky.com/weblogs/lars

description

Presentation held at Web Montag Stockholm, March 2008. Introduction of JCR, Sling and the µjax AJAX-based access layer to a content repository. The presentation includes the demo of the µjax Dojo integration.

Transcript of µjax in 30 minutes (for Stockholm)

Page 2: µjax in 30 minutes (for Stockholm)

µjax in 30 minutes

JCR meetsAJAX

[email protected]/weblogs/lars

Page 3: µjax in 30 minutes (for Stockholm)

Lars Trieloff• Product Manager at Day

• Author, Blogger, Open Source Code

• Apache Cocoon

• Mindquarry

• Goshaky

• DAX

Page 4: µjax in 30 minutes (for Stockholm)

µjaxcontent repository vs. ajax

Page 5: µjax in 30 minutes (for Stockholm)

µjaxcontent repository vs. ajax

What’s JCR (elevator pitch)

Introducing µjaxsilver

Page 6: µjax in 30 minutes (for Stockholm)

µjaxcontent repository vs. ajax

What’s JCR (elevator pitch) Introducing µjax

silver

Page 7: µjax in 30 minutes (for Stockholm)
Page 8: µjax in 30 minutes (for Stockholm)

What’s JCR?

Page 9: µjax in 30 minutes (for Stockholm)

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 10: µjax in 30 minutes (for Stockholm)

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 11: µjax in 30 minutes (for Stockholm)

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 12: µjax in 30 minutes (for Stockholm)

Best of both worlds.database filesystem

content repository

Page 13: µjax in 30 minutes (for Stockholm)

Best of both worlds.database filesystem

content repository

read

write

hier-archiesstreams

locking accesscontrol

integrity structure

tx query

un-structured “full-

text” sortorder

versioning

obser-vation

multi-value

Page 14: µjax in 30 minutes (for Stockholm)

Some known JCR Applications

Page 15: µjax in 30 minutes (for Stockholm)

Sourcemix SourcemixPercussion Rhythmix Lutece Portal

QuickWCM WCMS

Jahia Framework

Hippo CMSInfoQ Online CommunityNuxeo ECM

Sakai E-learning

TYPO3 v5.0 WCMGX WebManagerExo ECMS Platform

Liferay Enterprise Portal

Artifactory Maven ProxyIBM 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 OpenPortalInterface 21 Spring Framework

Fast Enterprise SearchOracle PortalBEA Portal

Page 16: µjax in 30 minutes (for Stockholm)

µjaxcontent repository vs. ajax

What’s JCR (elevator pitch) Introducing µjax

silver

Page 17: µjax in 30 minutes (for Stockholm)

µjaxcontent repository vs. ajax

What’s JCRIntroducing µjax

Page 18: µjax in 30 minutes (for Stockholm)

µjaxcontent repository vs. ajax

What’s JCRIntroducing µjax

silver

Page 19: µjax in 30 minutes (for Stockholm)

Introducing µjax

Repository based AJAX

Page 20: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

Page 21: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

Page 22: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

Page 23: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

the o

ther

side

Page 24: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

me (lars)

developer hat

“i want to build webapps” the o

ther

side

Page 25: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

me (lars)

developer hat

“i want to build webapps” the o

ther

side

Page 26: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

me (lars)

developer hat

“i want to build webapps” the o

ther

side

Page 27: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

me (lars)

developer hat

µjax

silver

Page 28: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

me (lars)

developer hat

very simple projection: fits the bill

µjax

silver

Page 29: µjax in 30 minutes (for Stockholm)

Introducing µjax

JCR

me (lars)

developer hat

very simple projection: fits the bill

µjax

“usecase” driven

silver

Page 30: µjax in 30 minutes (for Stockholm)

Introducing µjax

I2

3

Browser

J2EE WebServer

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

UjaxServlet.javatranslating requests to JCR callsJCR CompliantContent Repository

I

2

3

Page 31: µjax in 30 minutes (for Stockholm)

Introducing µjax

I2

3

Browser

J2EE WebServer

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

UjaxServlet.javatranslating requests to JCR callsJCR CompliantContent Repository

I

2

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

Page 32: µjax in 30 minutes (for Stockholm)

Introducing µjax

I2

3

Browser

J2EE WebServer

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

UjaxServlet.javatranslating requests to JCR callsJCR CompliantContent Repository

I

2

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

handles all the heavy lifting, particularly security16 tons

Page 33: µjax in 30 minutes (for Stockholm)

Getting ready...

download and installtest & mount as a drive

Page 35: µjax in 30 minutes (for Stockholm)

simple write example

write me!http://localhost:7402/firstst

eps/1_write.html

<html>

<head><title>µ

jax: simple wr

ite example</t

itle>

</head><body>

<form action="

/mydata" metho

d="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 36: µjax in 30 minutes (for Stockholm)

simple read example

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

<html>

<head><title>µ

jax: simple re

ad example</ti

tle>

</head>

<body>

<script src

="/rjax.js"></

script

<script>

var node=Uj

ax.getContent(

"/mydata");

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 37: µjax in 30 minutes (for Stockholm)

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

add new entry<html>

<head><title>µ

jax: add new e

ntry example</

title>

</head><body>

<form action="

/mydata/entrie

s/*"

method="PO

ST" enctype="m

ultipart/form-

data">

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

<h2>Im

age</h2>

<input

type="file" n

ame="Image"/>

<p><input type

="submit"></p>

</form>

</body>

</html>

Page 38: µjax in 30 minutes (for Stockholm)

list entries

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

<html>

<head><title>r

jax: list entr

ies example</t

itle>

[...]

<script>

var entries=Uj

ax.getContent(

"/mydata/entri

es");

</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>'

);

}

</script>

<a href="3_add

new.html">add

new</a>

</div>

</body>

</html>

Page 40: µjax in 30 minutes (for Stockholm)

views

Page 41: µjax in 30 minutes (for Stockholm)

Dojo Integration

repository browser with less than 50 LOC

Page 42: µjax in 30 minutes (for Stockholm)

µjaxcontent repository vs. ajax

What’s JCRIntroducing µjax

Page 43: µjax in 30 minutes (for Stockholm)

µjaxcontent repository vs. ajax

What’s JCRIntroducing µjax

silver

Page 44: µjax in 30 minutes (for Stockholm)

If you remember only 2 things.

dev.day.com Download CRX and play with µjax. keep an eye on “apache sling”2

I

Page 45: µjax in 30 minutes (for Stockholm)

If you remember only 2 things.

dev.day.com Download CRX and play with µjax. keep an eye on “apache sling”2

I

seriously!