3. obpqof`qba
R håçï=óçìê=eqji=C=g~î~ëÅêáéí
e~îÉ=~=î~ÖìÉ=ÅçåÅÉéí=çÑ=~=
“`çåíÉåí=oÉéçëáíçêóÒ
www.javapolis.com
4. Speaker’s Qualifications
David Nuescheler
JSR-170 Spec Lead
jsr-170-comments@jcp.org
David Nuescheler Chief Technology Officer
david.nuescheler@day.com
David Nuescheler
Jackrabbit Committer / Member
uncled@apache.org
www.javapolis.com
5. Overall Presentation Goal
Learn how
JCR and Ajax allow for very agile
application development.
www.javapolis.com
6. Kickstarting JCR
AJAX meets JCR
What’s JCR (elevator pitch)
jax
Introducing silve
r
Weblog in 15minutes
www.javapolis.com
7. Kickstarting JCR
AJAX meets JCR
What’s JCR (elevator pitch)
jax
Introducing silve
r
Weblog in 15minutes
www.javapolis.com
10. 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.”
?
www.javapolis.com
11. Best of both worlds.
s ys t e m
file
data base
hier-
archi
integ
es
re
rity
structu
read streams
tx access
write locking
query control
multi-
value
oning
versi
obser-
un-structured
“full-text” sort vation
order
content repo sit or y
12. What’s JCR?
- Reality Check -
Task: Write a JSP snippet that
lists “
documents” in a “folder””
.
www.javapolis.com
13. What’s JCR?
- Reality Check -
<% );
PI_DOCUMENTS(session
<%
TS documents = new LA
childCount = node.getConten LAPI_DOCUMEN
tCount(); new LLValue();
LLValue childTable =
for(int i=0;i<childCount;i ,
++) {
s(volumeID, folderID
documents.ListObject
JCR API
IContent child = node.getCo E, childTable);
PI_DOCUMENTS.PERM_SE
ntent(i);
null, null, LA
Property title = child.getP
.enumerateValues();
ropertyByName(quot;Titlequot;);
children = childTable
%><%= title.getValue() %><b Enumeration
r/><% reElements()) {
Task: Write a JSP snippet that
while(children.hasMo
}
)e.nextElement();
lue child = (LLValue
<%
%> <% LLVa ring(quot;Namequot;);
ng <% tle = child.toSt
fndocs ti
Stri
NodeIterator children = node.getNodes();
= new PageIterator%
%><%= title %><br/>< children = page.getPages();
IFnObj
SetDua
fnfold
<<<
lPr while (children.hasNex
int nu
while (children.hasNext()) {
er.get
Conten oxy( t()) {
lists “
documents” in a “folder””
.
}
mDocs
= fndo ts(idm
for (i Page child = children
cs. Fo
nt i = %> .nextPage();
1; i < getCount(); lderContent.
Node child = children.nextNode(); Container toplevel =
= numD idmFol child.getContent();
IFnDoc ocs; i derCon om title = to
umentD At e
Property title = child.getProperty(quot;Titlequot;);
++) { t ntDo plevel.getAtom(quot;Titlequot;
ua
new IF
nDocum l fndoc = cume );
%><%= title nt));r /><%
%><b
entDua
IFnPro
%><%= title %><br /><%
lPr }
pe
IFnPro rtiesDual pr oxy(fndocs.g %>
pe et
o
String rtyDual idmT pset = fndoc Item(new In
} te
.
i
title
= idmT tleProp = pr getPropertie ger(i)));
%><%=
title itlePr
op.get opset.getIte s();
%>
%>
if (co
mClean <br/><% cuments());
Value( m(quot;Tit
lequot;); entsProxy(binder.getDo
up) { <% );
s = new IDocum
cleane
IDocuments document
r.rele
} ase(fn
doc); documents.cache();
} ();
documents.getCount
t documentCount =
%> in {
cumentCount; i++) ItemByIndex(i));
r (int i = 0; i<do roxy(documents.get
fo umentP
document = new IDoc
ment.getTitle()
String title = docu
><%
%><%= title %><br/
+800
}
%>
www.javapolis.com
14. What’s JCR?
- Functional Elevator Pitch -
obser-
sql tx
locking versioning
vation
opt ion al
level 2 write, import,
access
control
level 1
read, export,
query
www.javapolis.com
15. Java Standardization
ase:d
rele mi
inal cted
Review Ballot
JSR-283 Public fe
exp 2008
ved
ro
pp
a
www.javapolis.com
17. Known compliant Repositories * using third party connector
*
*
Exo Microsoft
Apache Jackrabbit Oracle XML DB OpenText Livelink
ECMS Platform Sharepoint
*
Day CRX IBM FileNet P8 Xythos Repository Alfresco ECM Vignette V7
* *
any ors
ow mvendd?
HSe
DBMou ne
R do y
+hund
Interwoven rs
regiede of TCKs
IBM CM EMC Documentum
Repository st red
www.javapolis.com
18. Some known JCR Applications
Fast
BEA Portal Oracle Portal Enterprise Search
Sun JBoss Portal Interface 21
OpenPortal
Day Communique Spring Framework
DAM
magnolia WCMS Day Communique
Apache Sling
Collab
Mindquarry
Alfresco ECMS
Collaboration Apache Tapestry
QSLabs
Apache Day Communiqué
Compliance
Cocoon WCMS IBM FileNet
medic-2-medic WebSiteManager
Artifactory
Apache James mapofmedicine
Maven Proxy
Exo
TYPO3
ECMS Platform
GX WebManager v5.0 WCM
InfoQ Hippo Liferay
Nuxeo ECM Online Community CMS Enterprise Portal
Jahia Sakai
Framework E-learning
Percussion QuickWCM
Rhythmix Sourcemix
WCMS Lutece Sourcemix
Portal
www.javapolis.com
23. Introducing jax
JCR
longterm
stable &durable
well designed duty
heavy
strategic 16 t
ons
functionally broad
www.javapolis.com
24. Introducing jax
JCR
longterm
the other side
stable &durable
de
ve
lop
er
ha
t
well designed
“i want to build webapps”
heavy duty
me
strategic
lazy
16 t
ons
functionally broad
short-sighted
h
...easily coack
nfused
www.javapolis.com
25. Introducing jax
JCR
de
ve
lop
er
ha
t
av id)
me (d
silve
r
µjax
very simple pro
jection:
fits the bill
www.javapolis.com
26. Introducing jax
I browser & ujax.js
reading: json & resource GET’s
writing: form-POST & GET
s s
J2EE Web
Server
3
handles all the h
eavy
2 lifting, particul
arly
security
I
Browser 16 t
ons
2 MicrojaxServlet.java
very simple js A translating requests
PI to
read content, Fo to JCR calls
rms
to write conten
3 JCR Compliant
t
Content Repository
27. Introducing jax
“Data First!”
JCR s
uppor
“stru ts
cturef
aswe irst”
(but t ll.
hat’s
mi
ssing
point
)
www.javapolis.com
29. Getting ready...
test & mount as a drive
download a
nd install
www.javapolis.com
30. hello, world.
le>
d</tit
rl
lo, wo
l
html> tle>ujax:he
<
ti
head>< 2>
<
rld</h
>
</head 2>hello, wo
h
body><
<
>
</body
>
</html
drag, drop, done
http://localhost:7402/
apps/firststeps/0_hell
o.html
www.javapolis.com
31. simple write example
title>
mple</
e exa
e writ Tquot;>
d=quot;POS
simpl
<html> itle>ujax: metho
tepsquot;
<t irsts
<head> body> tent/f
/con
><
</head rm action=quot; -->
fo tle
< quot; />
!-- ti </h2> quot;Title
<
name=
tle
<h2>Ti ype=quot;textquot;
t >
<input cription --
ionquot;>
s
!-- de iption</h2> e=quot;Descript
< >Descr nam
s=quot;5quot;
<h2 a row
extare a>
t
< extare
</t r -->
- colo h2>
!-
< >Color</ rquot;>
=quot;Colo redquot;>red
<h2 name
select ion value=quot; eenquot;>green
< quot;gr
opt
< tion value=
op
<>
ct
</sele
>
</form
write me!
>
</body
>
</html
irststeps/1_write.html
tp://localhost:7402/apps/f
ht
www.javapolis.com
32. simple read example
title>
mple</
d exa
le rea
simp
<html> itle>ujax:
<t
<head> ript
quot;></sc
ead> ax.js
</h squot;);
jax/uj ststep olor+'quot;>';
> quot;/u
ody t/fir
src=
<b
conten or:'+node.C
script nt(quot;/
<
ript> ax.getConte kground-col
<sc bac
=uj
r node div style=quot;
va
='<
ar div write(div);
v
nt.
docume >
pt
</scri cript> le);
de.Tit
s
h2>< (no
< ument.write
doc h2>
ipt></ ion);
</scr ript> script
e.De
<p><sc t.write(nod
n
docume /p>
pt><
</scri
</div>
>
</body
read me! >
</html
http://localhost:7402/apps
/firststeps/2_read.html
www.javapolis.com
33. add new entry
tle>
le</ti
examp
entry
new /*quot;
x: add ntries
ml> uja
ht
< eps/e
itle> irstst
ead><t dy> tent/f
<h
ad><bo ction=quot;/con
</he
form a
< od=quot;POSTquot; >
meth equot; />
=quot;Titl
/h2> name
tle<
<h2>Ti ype=quot;textquot; ea>
t
textar
input
nquot;></
< riptio
/h2>
quot;Desc
tion<
escrip s=quot;5quot; name=
h2>D
< xtarea row
te
<
h2>
olor</ quot;Colorquot;>
h2>C d
< lect name= ue=quot;redquot;>re een
quot;>gr
se val
< option alue=quot;green
< tion v
op
<>
ct
</sele
</p>
bmitquot;>
e=quot;su
add new
ut typ
p
<p><in
>
</form
tml
http://localhost:7402/apps/firststeps/3_addnew.h
>
</body
>
</html
www.javapolis.com
34. list entries
itle>
ple</t
exam
ntries 2);
e
: list iesquot;,
l> >ujax /entr
<htm
<title tsteps
<head> /firs
ontent
t(quot;/c
[...] Conten
.get
t>
<scrip ntries=ujax
var e
pt>
</scri ');
or+'quot;>
y.Col
<div> '+entr
{
olor:
ries)
t>
ound-c ;
<scrip ar a in ent es[a]; ackgr
for (v entry=entri iv style=quot;b le+'</h3>')
Tit
'<d
var write( h2>'+entry. on);
nt.
docume .write('< pti
Descri
y.
nt
docume .write(entr
nt
docume
){
.Image
ry
if(ent
[...] }
''quot;>
/'+a+
>'); tmlquot;
'</div tries
ist.h
write( a href=quot;4_l '/mydata/en
nt.
docume .write('< ent(
veCont
nt
docume =”ujax.remo
k
onclic a>');
list entries </
remove
http://lo
calhost:7
</a>
402/apps/
}> dd new
firststep
mlquot;>a
s/4_list. t
/scrip 3_addnew.ht
html <
f=quot;
<a hre
</div>
>
</body
>
</html
www.javapolis.com
35. templates
%>
.Title
..] tNode
[.
curren
<%=
[...]
t>
<scrip wizard();
ujax.
pt>
</scri
[...]
rd();
w iza
x.
! Rja
!
ript>
</sc
resource or !
iented urls
http://l
ocalhost
:7402/co
ntent/fi
rststeps
.list.ht
ml
www.javapolis.com
36. Kickstarting JCR
AJAX meets JCR
What’s JCR (elevator pitch)
jax
Introducing silve
r
Weblog in 15minutes
www.javapolis.com
37. Kickstarting JCR
AJAX meets JCR
What’s JCR (elevator pitch)
jax
Introducing silve
r
Weblog in 15minutes
www.javapolis.com
38. Weblog in 15 minutes
- goals -
- seen before?
...a bunch of forms & a datamodel.
- something (almost) useable
www.javapolis.com
39. Weblog in 15 minutes
- goals -
Confession
I am not a Blogger
.
www.javapolis.com
40. Weblog in 15 minutes
- goals -
Confession
I am not a Blogger
.
cchi’s
azzo
ano m type”
stef “lino
www.javapolis.com
41. Weblog in 15 minutes
- goals -
»
» Transform “Stefano’s Linotype” into
a jax and JCR backed Blog.
LS!
TOtOitor &
NO ll tex ed
(we owser ;) )
br
...but an
audience
full of
buddy co
ders
www.javapolis.com