µjax in 30 minutes

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

description

µjax is a lightweight AJAX library for accessing content in a Java Content Repository (JCR) over the web. This presentation was given at Web Montag in Berlin, 01-21-2008.

Transcript of µjax in 30 minutes

Page 2: µjax in 30 minutes

µjax in 30 minutes

JCR meetsAJAX

[email protected]/weblogs/lars

Page 3: µjax in 30 minutes

µjaxcontent repository vs. ajax

Page 4: µjax in 30 minutes

µjaxcontent repository vs. ajax

What’s JCR (elevator pitch)

Introducing µjaxsilver

Page 5: µjax in 30 minutes

µjaxcontent repository vs. ajax

What’s JCR (elevator pitch) Introducing µjax

silver

Page 6: µjax in 30 minutes
Page 7: µjax in 30 minutes

What’s JCR?

Page 8: µjax in 30 minutes

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: µjax in 30 minutes

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

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

Best of both worlds.database filesystem

content repository

Page 12: µjax in 30 minutes

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 13: µjax in 30 minutes

Some known JCR Applications

Page 14: µjax in 30 minutes

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 15: µjax in 30 minutes

µjaxcontent repository vs. ajax

What’s JCR (elevator pitch) Introducing µjax

silver

Page 16: µjax in 30 minutes

µjaxcontent repository vs. ajax

What’s JCRIntroducing µjax

Page 17: µjax in 30 minutes

µjaxcontent repository vs. ajax

What’s JCRIntroducing µjax

silver

Page 18: µjax in 30 minutes

Introducing µjax

Repository based AJAX

Page 19: µjax in 30 minutes

Introducing µjax

JCR

Page 20: µjax in 30 minutes

Introducing µjax

JCR

Page 21: µjax in 30 minutes

Introducing µjax

JCR

Page 22: µjax in 30 minutes

Introducing µjax

JCR

the o

ther

side

Page 23: µjax in 30 minutes

Introducing µjax

JCR

me (david)

developer hat

“i want to build webapps” the o

ther

side

Page 24: µjax in 30 minutes

Introducing µjax

JCR

me (david)

developer hat

“i want to build webapps” the o

ther

side

Page 25: µjax in 30 minutes

Introducing µjax

JCR

me (david)

developer hat

“i want to build webapps” the o

ther

side

Page 26: µjax in 30 minutes

Introducing µjax

JCR

me (lars)

developer hat

µjax

silver

Page 27: µjax in 30 minutes

Introducing µjax

JCR

me (lars)

developer hat

very simple projection: fits the bill

µjax

silver

Page 28: µjax in 30 minutes

Introducing µjax

JCR

me (lars)

developer hat

very simple projection: fits the bill

µjax

“usecase” driven

silver

Page 29: µjax in 30 minutes

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 30: µjax in 30 minutes

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 31: µjax in 30 minutes

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 32: µjax in 30 minutes

Getting ready...

download and installtest & mount as a drive

Page 34: µjax in 30 minutes

simple write example

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

eps/1_write.html

<html>

<head><title>r

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 35: µjax in 30 minutes

simple read example

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

<html>

<head><title>r

jax: simple re

ad example</ti

tle>

</head>

<body>

<script src

="/rjax.js"></

script

<script>

var node=Rj

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 36: µjax in 30 minutes

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

add new entry<html>

<head><title>r

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 37: µjax in 30 minutes

list entries

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

<html>

<head><title>r

jax: list entr

ies example</t

itle>

[...]

<script>

var entries=Rj

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

);

document.

write('<a href

="/mydata/entr

ies?rjax:remov

e='

+a+'">r

emove</a>');

}

</script>

<a href="3_add

new.html">add

new</a>

</div>

</body>

Page 39: µjax in 30 minutes

views

Page 40: µjax in 30 minutes

µjaxcontent repository vs. ajax

What’s JCRIntroducing µjax

Page 41: µjax in 30 minutes

µjaxcontent repository vs. ajax

What’s JCRIntroducing µjax

silver

Page 42: µjax in 30 minutes

If you remember only 2 things.

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

I

Page 43: µjax in 30 minutes

If you remember only 2 things.

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

I

seriously!