You are on page 1of 683

Using

Liferay Portal
A Complete Guide
THE LllERAY DOCUMENTATlON TEAM
Rich Sezov, Ji.
Jim Hinkey
Stephen Kostas
Jesse Rao
Cody Hoag
Lifeiay Piess
Using Lifeiay Poital .1
by Te Lifeiay Documentation Team
Copyiight 2013 by Lifeiay, lnc.
lSBN 98-0-8-1231-
Tis woik is oeied undei the following license
Cieative Commons Auiibution-Shaie Alike Unpoited
You aie fiee
1. to shaieto copy, distiibute, and tiansmit the woik
2. to iemixto adapt the woik
Undei the following conditions
1. Auiibution. You must auiibute the woik in the mannei specied by the
authoi oi licensoi (but not in any way that suggests that they endoise you
oi youi use of the woik).
2. Shaie Alike. lf you altei, tiansfoim, oi build upon this woik, you may dis-
tiibute the iesulting woik only undei the same, similai oi a compatible li-
cense.
Te full veision of this license is heie
hup//cieativecommons.oig/licenses/by-sa/3.0
Poitions of this document weie contiibuted by additional authois James
lalknei, Biuno laiache, Michael Han, Jeiey Handa, Maik Healy, and Jonathon
Omahen.
CoN1rN1s
Contents i
Preface vi
Whats New in the liist Edition . . . . . . . . . . . . . . . . . . . . . vi
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Publishei Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1 What is Liferay? 1
1.1 What makes Lifeiay Poital unique . . . . . . . . . . . . . . . . 3
1.2 Using Lifeiay Poital as a content management system . . . . . 3
1.3 Using Lifeiay Poital as a collaboiative platfoim . . . . . . . . . 9
1.4 Using Lifeiay as a social platfoim . . . . . . . . . . . . . . . . 11
1. Using Lifeiay as a web platfoim . . . . . . . . . . . . . . . . . 13
1. Extending and customizing Lifeiay foi youi own needs . . . . 1
1. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Web Content Management 17
2.1 How Can Lifeiays WCM Help You` . . . . . . . . . . . . . . . 18
2.2 Cieating sites and managing pages . . . . . . . . . . . . . . . 19
2.3 Authoiing (basic) content . . . . . . . . . . . . . . . . . . . . . 38
2.4 Publishing (basic) content . . . . . . . . . . . . . . . . . . . . 4
i
2. Using Lifeiays woikow with WCM . . . . . . . . . . . . . . 48
2. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
3 Advanced Web Content Management 52
3.1 Advanced content with stiuctuies and templates . . . . . . . . 3
3.2 Leveiaging Lifeiays multi-site capabilities . . . . . . . . . . .
3.3 Using site templates . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4 Using page templates . . . . . . . . . . . . . . . . . . . . . . .
3. Allowing useis to customize site pages . . . . . . . . . . . . . . 83
3. Staging page publication . . . . . . . . . . . . . . . . . . . . . 84
3. Cieating teams foi advanced site membeiship management . . 9
3.8 Displaying site pages to mobile devices . . . . . . . . . . . . . 9
3.9 Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
4 Document Management 106
4.1 Geuing Staited with Documents and Media . . . . . . . . . . . 10
4.2 Document Types and Metadata Sets . . . . . . . . . . . . . . . 111
4.3 Alteinative lile Repositoiy Options . . . . . . . . . . . . . . . 11
4.4 Using Exteinal Repositoiies . . . . . . . . . . . . . . . . . . . . 11
4. Miciosof Oce integiation . . . . . . . . . . . . . . . . . . . . 123
4. Conguiing the Documents and Media poitlet . . . . . . . . . 12
4. Automatic Pieviews and metadata . . . . . . . . . . . . . . . . 12
4.8 Lifeiay Sync . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
4.9 Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
5 Leveraging the Asset Framework 157
.1 Tagging and Categoiizing Content . . . . . . . . . . . . . . . . 18
.2 Taigeted Vocabulaiies . . . . . . . . . . . . . . . . . . . . . . 11
.3 Using laceted Seaich . . . . . . . . . . . . . . . . . . . . . . . 13
.4 Using the Asset Publishei . . . . . . . . . . . . . . . . . . . . . 14
. Seuing up Display Pages . . . . . . . . . . . . . . . . . . . . . 1
. Dening content ielationships . . . . . . . . . . . . . . . . . . 181
. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
6 Personalization and Customization 183
.1 Usei Peisonal Sites . . . . . . . . . . . . . . . . . . . . . . . . 184
.2 Page Customizations . . . . . . . . . . . . . . . . . . . . . . . 18
.3 Using Lifeiays iules engine . . . . . . . . . . . . . . . . . . . 189
.4 Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
ii
7 Collaboration Suite 196
.1 Undeistanding Lifeiays common conguiation options . . . . 19
.2 Expiessing youiself using Blogs . . . . . . . . . . . . . . . . . 211
.3 Oiganizing and shaiing events with the Calendai . . . . . . . 221
.4 Discuss, ask and answei using the Message Boaids . . . . . . . 224
. Woiking togethei with the Wiki . . . . . . . . . . . . . . . . . 238
. lind out what otheis think oi do using Polls . . . . . . . . . . 24
. Staying in touch with the Chat . . . . . . . . . . . . . . . . . . 20
.8 lntegiating youi email with Lifeiay Mail . . . . . . . . . . . . 2
.9 Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
8 Social Networking 259
8.1 Leveiaging Social Poitlets, Activities Tiacking and Usei Con-
nections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.2 Measuiing social activity . . . . . . . . . . . . . . . . . . . . . 29
8.3 Expoiting poital applications as widgets and OpenSocial gad-
gets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.4 lntegiating with lacebook . . . . . . . . . . . . . . . . . . . . 28
8. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
9 Using Web Forms and Dynamic Data Lists 290
9.1 Building a list platfoim in Lifeiay . . . . . . . . . . . . . . . . 291
9.2 Dening data types . . . . . . . . . . . . . . . . . . . . . . . . 291
9.3 Cieating data lists . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.4 Make it pieuy cieating custom displays . . . . . . . . . . . . 300
9. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
10 Using Workow 312
10.1 Enabling woikow . . . . . . . . . . . . . . . . . . . . . . . . 313
10.2 Cieating new woikow denitions . . . . . . . . . . . . . . . 313
10.3 Timeis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
10.4 Conguiing assets to use woikow piocess denitions . . . . 32
10. Using woikow with othei applications . . . . . . . . . . . . . 329
10. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
11 Kaleo Forms: Dening Business Processes 334
11.1 Kaleo loims . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
11.2 Kaleo Designei . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
11.3 Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
iii
12 Liferay Utility Applications 343
12.1 Captuiing Web Sites with the Bookmaiks Poitlet . . . . . . . . 344
12.2 Cieating Youi Own Plugin Repositoiy . . . . . . . . . . . . . . 31
12.3 Shopping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
12.4 Knowledge Base . . . . . . . . . . . . . . . . . . . . . . . . . . 39
12. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
13 Leveraging the Liferay Marketplace 389
13.1 Maiketplace Concepts Useis, Companies, and Apps . . . . . . 390
13.2 Accessing the Lifeiay Maiketplace . . . . . . . . . . . . . . . . 390
13.3 linding Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
13.4 Downloading and lnstalling Apps . . . . . . . . . . . . . . . . 400
13. Cieating and Uploading Apps . . . . . . . . . . . . . . . . . . 40
13. Plugin Management . . . . . . . . . . . . . . . . . . . . . . . . 40
13. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
14 Installation and Setup 422
14.1 Editions of Lifeiay . . . . . . . . . . . . . . . . . . . . . . . . . 422
14.2 Obtaining Lifeiay Poital . . . . . . . . . . . . . . . . . . . . . 42
14.3 lnstalling a bundle . . . . . . . . . . . . . . . . . . . . . . . . . 42
14.4 App seiveis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
14. Using Lifeiays setup wizaid . . . . . . . . . . . . . . . . . . . 434
14. Manual Conguiation . . . . . . . . . . . . . . . . . . . . . . 43
14. lnstalling Lifeiay on an existing application seivei . . . . . . . 438
14.8 lnstalling Lifeiay on Mule Tcat . . . . . . . . . . . . . . . . . . 440
14.9 lnstalling Lifeiay on Glasslish 3 . . . . . . . . . . . . . . . . . 44
14.10 lnstalling Lifeiay on Jeuy . . . . . . . . . . . . . . . . . . . . 4
14.11 lnstalling Lifeiay on JBoss .1 . . . . . . . . . . . . . . . . . . 483
14.12 lnstalling Lifeiay on JBoss . . . . . . . . . . . . . . . . . . . 48
14.13 lnstalling Lifeiay on JOnAS .2 . . . . . . . . . . . . . . . . . . 494
14.14 lnstalling Lifeiay on Resin 4 . . . . . . . . . . . . . . . . . . . 00
14.1 lnstalling Lifeiay on Tomcat . . . . . . . . . . . . . . . . . . 0
14.1 lnstalling Lifeiay on WebLogic 10 . . . . . . . . . . . . . . . . 14
14.1 lnstalling Lifeiay on Oiacle WebLogic 10.3 . . . . . . . . . . . 20
14.18 lnstalling Lifeiay on WebSpheie 8.0 . . . . . . . . . . . . . . . 2
14.19 Making Lifeiay Coexist with Othei Java EE Applications . . . 3
14.20 Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
15 Management 540
1.1 Managing Useis . . . . . . . . . . . . . . . . . . . . . . . . . . 41
iv
1.2 Te Poital Section of the Contiol Panel . . . . . . . . . . . . . 41
1.3 Adding useis . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
1.4 Usei management . . . . . . . . . . . . . . . . . . . . . . . . . 44
1. Usei Gioups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
1. Roles and Peimissions . . . . . . . . . . . . . . . . . . . . . . .
1. Managing Poital Seuings . . . . . . . . . . . . . . . . . . . . . 3
1.8 lntegiating Lifeiay useis into youi enteipiise . . . . . . . . . . 8
1.9 Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
16 Using the Control Panel 582
1.1 Custom lields . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
1.2 Monitoiing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3 Plugins Conguiation . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 Seivei Administiation . . . . . . . . . . . . . . . . . . . . . . 88
1. Poital lnstances . . . . . . . . . . . . . . . . . . . . . . . . . . 94
1. Plugins lnstallation . . . . . . . . . . . . . . . . . . . . . . . . 9
1. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
17 Advanced Portal Operation 597
1.1 Audit Tiails . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
1.2 Lifeiay monitoiing using Google Analytics . . . . . . . . . . . 0
1.3 Backing up a Lifeiay installation . . . . . . . . . . . . . . . . . 0
1.4 Lifeiays Logging System . . . . . . . . . . . . . . . . . . . . . 0
1. Patching Lifeiay . . . . . . . . . . . . . . . . . . . . . . . . . . 09
1. Upgiading Lifeiay . . . . . . . . . . . . . . . . . . . . . . . . . 14
1. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
18 Using Scripting for Advanced Flexibility 622
18.1 Accessing Lifeiay Seivices . . . . . . . . . . . . . . . . . . . . 23
18.2 Running sciipts fiom the contiol panel . . . . . . . . . . . . . 2
18.3 Leveiaging the Sciipt Engine in Woikow . . . . . . . . . . . 2
18.4 Custom Java Tools in the Sciipt Engine . . . . . . . . . . . . . 29
18. Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
19 Conguring Liferay for High Availability 635
19.1 Lifeiay Clusteiing . . . . . . . . . . . . . . . . . . . . . . . . . 3
19.2 Peifoimance Tuning . . . . . . . . . . . . . . . . . . . . . . . 2
19.3 Summaiy . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Index 668
v
Pvri~cr
Welcome to the woild of Lifeiay Poital' Tis book was wiiuen foi anyone who
has any pait in seuing up, using, oi maintaining a web site built on Lifeiay
Poital. loi the end usei, it contains eveiything you need to know about using
the applications included with Lifeiay. loi the administiatoi, youll leain all
you need to knowabout seuing up youi site with useis, sites, oiganizations, and
usei gioups, as well as how to manage youi sites secuiity with ioles. loi seivei
admins, it guides you step-by-step thiough the installation, conguiation, and
optimization of Lifeiay Poital, including seuing it up in a clusteied, enteipiise-
ieady enviionment. Use this book as a handbook foi eveiything you need to
do to get youi Lifeiay Poital installation iunning smoothly, and then keep it by
youi side as you conguie and maintain youi Lifeiay-poweied web site.
Whats Newin the First Edition
liist edition` Well, weve ienamed the book (it used to be the Administrators
Guide), so we guied wed stait the numbeiing ovei. Teies so much newin this
edition that it just about encompasses the whole book. Of couise, eveiything
fiom the old book has been updated to ieect the ielease of Lifeiay Poital .1.
We also have complete coveiage of Lifeiays newfeatuies, such as dynamic data
listsand the foim designei that goes with them, the iules engine, the audit
fiamewoik, a ievamped chaptei on enteipiise conguiation, and moie.
vi
Teie is, of couise, coveiage of Lifeiay Maiketplace as well as the Plugin
Secuiity Managei. Te Document Libiaiy and lmage Galleiy have been com-
bined into a iobust, poweiful Documents and Media poitlet, and youll nd full
documentation of it heie. Youll leain about Lifeiays OpenSocial integiation,
the new faceted seaich featuie, and how to use the ielated assets featuie.
Te new ielease is featuie-packed, and so the documentation must be also
we have ovei 0 pages of goodness awaiting you in these pages.
Conventions
Te infoimation contained heiein has been oiganized in a way that makes it
easy to locate infoimation. We stait at the beginning put a list of stu thats at
the beginning heie.
Sections aie bioken up into multiple levels of headings, and these aie de-
signed to make it easy to nd infoimation.
Souice code and conguiation le diiectives aie piesented monospaced, as
below.
If source code goes multi-line, the lines will be \
separated by a backslash character like this.
Italics aie used to iepiesent links oi buuons to be clicked on in a usei intei-
face.
Monospaced type is used to denote Java classes, code, oi piopeities within
the text.
Bold is used to desciibe eld labels and poitlets.
Page headeis denote the chapteis, and footeis denote the paiticulai section
within the chaptei.
Publisher Notes
lt is oui hope that this book is valuable to you, and that it becomes an in-
dispensable iesouice as you woik with Lifeiay Poital. lf you need any assis-
tance beyond what is coveied in this book, Lifeiay oeis tiaining, consult-
ing, and suppoit seivices to ll any need that you might have. Please see
hup//www.lifeiay.com/seivices foi fuithei infoimation about the seivices we
can piovide.
vii
lt is entiiely possible that some eiiois oi mistakes made it into the nal vei-
sion of this book. Any issues that we nd oi that aie iepoited to us by the
community aie documented on the Ocial Lifeiay Wiki. You can view them oi
contiibute infoimation that youve found about any issues at oui Documenta-
tion Eiiata page.
1
As always, we welcome any feedback. lf theie is any way you think we could
make this book beuei, please feel fiee to mention it on oui foiums. You can also
use any of the email addiesses on oui Contact Us page.
2
We aie heie to seive
you, oui useis and customeis, and to help make youi expeiience using Lifeiay
Poital the best it can be.
1
hup//www.lifeiay.com/community/wiki/-/wiki/Main/DocumentationEiiata
2
hup//www.lifeiay.com/contact-us
viii
Cu~v1rv 1
Wu~1 is Liirv~v`
lf youie ieading this, weie going to make a wild guess and say that youie
piobably looking foi some sofwaie to help you iun youi web site. Cieat-
ing a dynamic web site thats moie than biochuiewaie is complicated these
days. You have to think about all kinds of things like usei iegistiation, secuiity,
community-building, collaboiation, and of couise youi own, unique function-
ality and the design of youi site.
To cieate all this, you can puisue seveial dieient stiategies. You can de-
cide to build the whole thing youiself fiom sciatch. Te ieason usually given
foi puisuing this stiategy is that you have the most fieedom, since you can
wiite whatevei you want. A closei inspection, howevei, ieveals that instead of
fieedom, you become a slave, wiiting all kinds of code thats not coie to youi
web site. You have to wiite code foi usei iegistiation, login, secuiity, and ses-
sion management, code foi standaids suppoit, such as lacebook login, OpenlD,
OpenSocial, oi RSS feeds, and code foi geneial featuies, such as comments, tags,
and iatings. You also take the most iisk you and/oi youi development team aie
iesponsible foi eveiy bug, glitch, usei inteiface issue, oi secuiity holeand the
consequences foi thesethat can be found in youi site. Tis stiategy also ie-
quiies the most time to implement, because youie building eveiything fiom
sciatch. When consideiing this option, theiefoie, you ieally need to think haid
about whethei you and youi development team have the time and the expeitise
1
2 CHAPTER 1. WHAT IS LIFERAY?
to handle building eveiything fiom the giound up.
Anothei option is to sciounge the web foi sofwaie that has some of the fea-
tuies you want, and then glue it togethei into one integiated site. loi example,
eveiy site has some kind of content, so you might pick a content management
system. But you want useis to inteiact in some way, so you also giab foium
sofwaie. Piominent useis might get a blog, so youll need sofwaie to handle
that. And, of couise, dont foiget that you have to wiite youi own applica-
tion(s). Youie auempting to build a supei app out of a collection of dispaiate,
but best-of-bieed individual applications. Youve collected the applications, and
nowyoui job is to integiate all of these togethei so that useis only have to log in
once, the foium sofwaie can powei comments on youi content, and blogs aie
published in a nice, customizable feed on the home page. As you woik on this,
you nd that gluing all these applications togethei isnt as easy as you thought.
You might get all of it woiking, but then you have a dieient pioblem down the
ioad a maintenance nightmaie. All of these sofwaie packages will be updated
by theii development teams sepaiately, on dieient schedules, to x bugs, add
featuies, and plug secuiity holes. Now that youve customized them all, ev-
eiy upgiade of eveiy sofwaie package youve chosen becomes an exeicise in
ie-implementing youi glue code to make it all woik.
You could also tiy using something like a blog that has a lot of functionality
that can kind of be used as a content management system. But then, of couise,
things dont woik exactly as youd like them to, and featuies you need aie miss-
ing. You eithei have to build those featuies and integiate them in, oi do without
them.
One nal option, if you have a budget, is to buy something that mostly ts
what you want to do, with the intention of customizing it to t youi needs. Te
goal heie is to get something up and iunning as quickly as possible, by tak-
ing advantage of someones pioduct and suppoit. Te devil heie, though, is in
the details its the customizationpaiticulaily with pioducts that aie not open
souicethat can be most dicult. License agieements need to be negotiated to
get you access to non-documented, inteinal APls, and many pioducts aie sim-
ply not designed to be customized to the extent that you might want to have
them customized. lt can take moie time to customize than you though, and you
usually iun into some limitation that keeps you fiom building exactly what you
need. Alteinatively, you may wind up having to pay expensive consultants to
get the iesult that you want, and afei that, youve paid moie than you initially
thought you would, and you have a complicated situation when it comes to
upgiading youi system.
As you can see, all of these options have pios and cons to them. Teie aie
times when building fiom sciatch makes sense, and theie aie times when in-
1.1. WHAT MAKES LIFERAY PORTAL UNIQUE 3
tegiation oi puichasing a solution make sense. But what if you could have all
of these stiategies combined` What if theie was a pioduct that gave you the
fieedom to cieate whatevei you want, had tons of ieusable functionality, was
designed foi customization, and was a single, unied pioduct with a cleai up-
giade path`
Teie is. Tis solution gives you all the fieedom of cieating youi site fiom
the giound up, all the benets of existing, integiated, iobust applications, and
a development fiamewoik that makes youi application a ist class citizen. lts
called Lifeiay Poital.
1.1 What makes Liferay Portal unique
Lifeiay Poital is a web expeiience platfoim that contains all of the common
applications youd use as building blocks foi youi web site. Because of this,
using Lifeiay completely changes the way youd appioach building youi site,
because Lifeiay includes all the functionality mentioned above and moie. ln
fact, depending on what youie building, its possible to build some sites without
wiiting any code at all' lf youve got a gieat application in mind, then Lifeiay
is also a fantastic web application development platfoim that you can use to
youi advantage to ielease youi application fastei. Why` Because you can focus
on youi application, and use the usei management, secuiity, standaids suppoit,
and geneial featuies piovided by Lifeiay Poital without having to wiite them
youiself.
Of couise, theie aie moie featuies than just those. You can take advantage
of functionality enabling useis to connect with each othei in social netwoiks,
to collaboiate on whatevei inteiests them, to cieate content, and so much moie.
ln fact, itll take this whole book to desciibe fully what Lifeiay can do, but well
summaiize it as best we can in the iest of this chaptei.
ln shoit, Lifeiay Poital is moie than a development platfoim, moie than a
content management system, moie than a social netwoik, and moie than a set
of collaboiation tools. lts the best way to build a web site.
1.2 Using Liferay Portal as a content management system
One of the most common uses of Lifeiay Poital is as a content management sys-
tem. ln fact, many use Lifeiay Poital just foi content management, whethei it
be web content management oi management of le-based content (documents,
4 CHAPTER 1. WHAT IS LIFERAY?
media les, and the like). Tey do this because Lifeiay Poitals content manage-
ment system is so poweiful and featuie-iich that it could be oeied as a totally
sepaiate, standalone system of its own. Of couise, the fact that its integiated
with the iest of the applications in Lifeiay Poital makes it all the moie auiactive.
So what can it do` Well answei that question, but take it in two paits. liist,
well look at Lifeiay Poitals iole as a web content management system, and
then well see how Lifeiay Poital excels at le-based content management.
Effectively building a site with Liferay WCM
Te ist thing youll want to undeistand about Lifeiay WCM is that it scales to
woik foi the tiniest of sites all the way up to the laigest of sites. loi example,
on the small end of things you can ie up Lifeiay Poital, diop the Web Content
Display application onto a page, and immediately stait typing content into a
WYSlWYG editoi, in place. On the laige scale of things, you can set up Lifeiay
Poital to host many dieient web sites foi many dieient puiposes, all with
theii own domain names. Each site can take advantage of a sepaiate staging
seivei, wheie content and pages aie cieated by teams of people using stiuctuies
and templates, and updates to the pioduction seivei aie published on a schedule,
only afei having gone thiough a multi-step appioval piocess.
Tats poweiful.
By default, Lifeiay Poital staits with a single site that has a single page. You
can build any web site you wish out of this, complete with multi-nested page
hieiaichies, as the guie below shows.
Tese pages can have any layout you like Lifeiay Poital ships with seveial
built-in, and you can cieate youi own custom layouts and deploy them eas-
ily. Pages can be added, iemoved, oi ieoideied any time, and you have the
full exibility of all the HTML page auiibutes, such as meta tags and iobot le
declaiations, that you need.
Pages aie also integiated with Lifeiays poweiful peimissions system, so its
easy to iestiict access to ceitain poitions of youi site. You can give individual
useis sites of theii own, with public pages that have theii content and blog, and
piivate pages that contain theii calendai and email.
lf youie iunning a laige web site wheie youll be cieating and managing
lots of dieient sub-sites foi individuals and gioups, you can take advantage of
page templates and site templates. Te foimei enables you to set up templates of
pages with piedened layouts and applications alieady on them, and the lauei
enables you to cieate a whole site made up of multiple, piedened pages.
1.2. USING LIFERAY PORTAL AS A CONTENT MANAGEMENT SYSTEM
Figure 1.1: Liferays page hierarchies are easy to create, using a tree
structure thats familiar to anyone who has used a le manager.
Teies even moie. lf you have a veiy laige site, you might need multiple
people to woik on it. And you ceitainly dont want the live site changing befoie
youi useis eyes. loi that ieason, Lifeiay Poital piovides a featuie called staging,
that lets you place youi changes in a holding aiea while theyie being woiked
on. You can have a local staging seivei, wheie the staged site iesides on the same
seivei as the live site, oi you can have a iemote staging seivei, wheie all web
content woik happens on a sepaiate seivei fiom youi live site. ln eithei case,
when youie ieady, site changes can be pushed to the live site, eithei manually
oi on a schedule.
Figure 1.2: Staging supports publishing manually or on a schedule.
Lifeiay Poitals web content cieation tools aie easy and intuitive to use at
all levels. lf you need only basic content management capabilities foi youi site,
you can jump iight in. liomthe Dockbai, you can add the Web Content Display
application anywheie in youi page layout and entei content in place. lts easy
to go fiom this basic level of content management to moie sophisticated levels
of functionality.
CHAPTER 1. WHAT IS LIFERAY?
loi example, suppose you wanted to build an online news-oiiented site.
Most of the content youll publish is an aiticle of some kind. Lifeiays web
content management system lets you cieate a structure foi this, so that you can
captuie all the infoimation fiom youi wiiteis that youd need in an aiticle. Te
guie below shows what this stiuctuie might look like to a jouinalist whod be
enteiing his oi hei aiticle into the system.
Figure 1.3: Structures allowyou to specify exactly the type of data that
makes up your content. You can also include tooltips to help your users
understand what each eld is for.
As you can see, you can use stiuctuies to make suie wiiteis piovide the title
of the stoiy, what type of stoiy it will be, and the byline (i.e., the wiiteis name).
Youve made suie that all the ielevant infoimation foi the stoiy is captuied in
the system.
Web content is one example of what in Lifeiay is called an asset. Assets can
have meta-data auached to them, and that metadata can be used to aggiegate
similai assets togethei in seaiches oi as published content. One way to do this
1.2. USING LIFERAY PORTAL AS A CONTENT MANAGEMENT SYSTEM
in the example above is that wiiteis can tag and categoiize theii stoiies so they
can be found moie easily by useis.
Tis is just one example, of couise. But the concept is applicable to any kind
of site youd want to build. loi example, if you weie building a site foi a zoo,
you could use web content stiuctuies to help useis entei data about animals in
the zoo, such as theii common names, theii scientic names, theii species, theii
locations in the wild, and moie.
When it comes time to publish content, stiuctuies aie combined with tem-
plates. Templates aie instiuctions foi how to display stiuctuies, wiiuen most
of the time in Velocity oi lieemaikeiboth of which aie well-known templat-
ing languages used foi mixing HTML with piogiammatic elements. Because of
this, theyie veiy easy to wiite, and can help you ensuie that youi site has a
consistent look and feel.
Teie is much moie to web content. You can cieate abstiacts, schedule when
content is published and when it should be taken down (oi ieviewed), dene
ielated assets, and moie.
Tis is just the web content poition of Lifeiays content management system.
Lifeiay Poital is also gieat at managing le-based content.
Keeping track of documents, images, video, and more
lts iaie to nd in an open souice pioject a full-featuied content management
system. Most of the time, youll nd web content management systems and le-
based content management systems as sepaiate piojects. Lifeiay Poital, how-
evei, piovides you with both. As shown above, the web content management
system is as iobust as any othei youll nd, and its le-based content manage-
ment system is the same.
Lifeiay Poital keeps the Ul of its le-based content management system in
an application called Documents and Media Library. Tis application iesides in
the contiol panel oi can be added to any page, and, as shown below, looks veiy
much like the le managei that youie alieady familiai with fiomyoui opeiating
system.
Like a le managei, you can biowse les and foldeis in nested hieiaichies.
You can also mount othei iepositoiies that you might have in youi enviion-
ment, such as Documentum (EE only) oi any system that implements Content
Management lnteiopeiability Seivices (CMlS). lt piovides pieviews of just about
eveiy document type you can think of. And, like a le managei, you can copy
and move les between foldeis by diagging and diopping them. Of couise, if
you still want to use youi opeiating systems le managei, you can, because
8 CHAPTER 1. WHAT IS LIFERAY?
Figure 1.4: Liferay Portals Documents and Media library was purposefully
designed to be familiar to anyone who uses a computer.
Lifeiays Documents and Media libiaiy suppoits WebDAV, using the same cie-
dentials you use to log in to Lifeiay.
Lifeiay Poitals Documents and Media libiaiy, howevei, is much moie iobust
than a le managei is, because its a full content management system. You can
dene ways of classifying les that may be of dieient types, but aie meant foi
the same, oveiaiching puipose.
loi example, you can dene metadata sets, which aie gioups of elds desciib-
ing auiibutes of a le. One of these that ships with the pioduct is called meeting
metadata, and it contains elds such as Meeting Name, Date, Time, Location,
Desciiption, and Paiticipants. Tis is a geneiic set of elds that go togethei and
that youd want to use as a gioup. You can cieate as many of these as you want.
loi les, you can dene document types. Tey piovide a moie natuial way of
woiking with les. loi example, you might cieate a document type called Meet-
ing Minutes, because this is how we as humans conceptualize oui documents.
lt doesnt ieally mauei whethei its a Miciosof Woid document, an HTML le,
oi a text lethe document contains meeting minutes. Once youve cieated the
document type, you can auach the Meeting Metadata set that contains many
of the elds youd want, and you can also add extia elds, such as a eld foi
action items. When useis want to add a le containing theii notes foi meeting
minutes, they can also add all the ielevant metadata about the meeting (such as
the time, location, and action items). Tis captuies the context infoimation that
goes with the document, and it piovides a much moie natuial way of woiking
with documents than just dumping them into a shaied le system.
Of couise, the system goes much fuithei than this. loldeis can be set so that
1.3. USING LIFERAY PORTAL AS A COLLABORATIVE PLATFORM 9
only ceitain document types can be added to them. Woikow iules can also
be added to foldeis to iun les thiough an appioval piocess that you dene. ln
shoit, Lifeiays le-based content management systemgives you all the featuies
you need to manage and shaie les in a gioup.
Many Lifeiay Poital useis see it as a iobust content management system,
and they use it piimaiily foi that puipose. Now, hopefully, you can see why.
Well covei the system in-depth in the body of this book, but foi now we need
to look at some of the othei ways you can use Lifeiay Poital, staiting with its
fantastic collaboiative tools.
1.3 Using Liferay Portal as a collaborative platform
Many sites have giown oiganically. You may have giown youi community by
using sepaiate tools ist a foiums application, and then a wiki foi collaboia-
tive documentation, and maybe even a chat application. lt can be haid (and
eiioi-pione) to integiate all of these applications so youi useis can use them
seamlessly. Tankfully, Lifeiay includes a suite of collaboiative applications
you can use, and theyie all integiated togethei.
Lifeiay Poital oeis eveiy standaid collaboiative application thats available.
Tese applications iange fiompeisonal pioductivity applications like a calendai
and email, to community-building applications like message boaids, polls, and
wikis.
Figure 1.5: Liferay Portals message boards are as fully featured as any
standalone forumapplication, with the added benet that theyre
integrated with the rest of the system.
10 CHAPTER 1. WHAT IS LIFERAY?
Tis is a suite of integiated applications with all the featuies of similai, stan-
dalone applications. loi example, Lifeiay Poitals message boaids include cat-
egoiies and subcategoiies, message thieads, captcha, RSS feeds, email notica-
tion, posting via email, and much moie. But moie than this, the applications
aie integiated with the iest of Lifeiay Poitals fiamewoik. Useis log in, and
theii pioles aie used automatically by the message boaids and all the othei
collaboiative applications. And as well see latei, functionality fiom the built
in applications can be added to youi own to piovide featuies like comments in
youi own sofwaie, and you dont have to wiite any code to do it.
Lifeiay Poitals wiki is anothei example of a full-featuied collaboiative ap-
plication. lt has suppoit foi authoiing pages in a WYSWYG editoi, oi moie
advanced useis can use the easy-to-leain standaid Wiki Cieole syntax. Useis
can comment on wiki aiticles, and it keeps a full histoiy of eveiy change thats
been made, allowing useis to ieveit back to any change. lt also suppoits RSS
feeds (just about eveiy Lifeiay application does) so you can subsciibe to see new
aiticles as they aie posted. Each site can have one oi moie wikis, and each wiki
can have one oi moie top-level nodes.
Figure 1.6: Liferay Portals wiki enables users to collaboratively create
complex articles. Clicking the Details link shows the full history of the
article, including the author of each change.
We could go thiough all of Lifeiay Poitals collaboiative applications in a
1.4. USING LIFERAY AS A SOCIAL PLATFORM 11
similai fashion, but lets save that foi the body of the book. Lifeiay Poitals suite
of collaboiative applications includes a blog (complete with blog aggiegation
featuies so you can publish multiple useis blog entiies in one place), a chat
application foi useis who aie online at the same time, message boaids, a wiki,
a knowledge base that you can use to publish a libiaiy of technical aiticles, a
polling systemyou can use to have useis vote on ceitain questions, and peisonal
pioductivity applications like a calendai and email.
Lifeiay Poital includes eveiy application youll need to enable useis to col-
laboiate. Next, well see how you can use Lifeay Poital as a social platfoim.
1.4 Using Liferay as a social platform
Whethei you plan to build a social netwoik oi enable social applications as
pait of youi oveiall usei expeiience, Lifeiay Poital has the tools to make those
featuies woik foi you. Staiting with a suite of applicationsincluding a piole
summaiy, activities feeds, social iequests, a wall, and moieand iounding things
out with an APl to handle ielationships between useis as well as publish theii
activities to each othei, Lifeiay Poital helps you implement common featuies of
social netwoiks to enhance youi existing site.
Figure 1.7: Liferay Portal provides feeds of social activities. These feeds
can contain entries fromany of Liferays built-in applications or
applications that you write.
Social ielationships within Lifeiay Poital aie ideally suited foi many diei-
ent kinds of implementations, whethei youie building a public social netwoik
12 CHAPTER 1. WHAT IS LIFERAY?
oi want to enable social featuies in youi coipoiate lntianet. Useis can cie-
ate ielationships within the system, allowing them to see updates fiom those
whose activity they need to tiack. Tats fai moie poweiful than having them
subsciibe to multiple individual RSS feeds oi visit multiple pioles, because the
system keeps tiack of the updates fiom those with whom you have a ielation-
ship, automatically.
Moie than this, howevei, Lifeiay is a gieat integiation platfoim foi social
applications. lt fully suppoits the OpenSocial fiamewoik. You can use Lifeiay
Poitals built-in OpenSocial gadget editoi to cieate and seive youi own OpenSo-
cial gadgets.
Figure 1.8: Liferay Portals OpenSocial gadget editor lets you rapidly
create social applications that can be served across the web to any other
OpenSocial container.
Lifeiay Poital also suppoits the cieation of lacebook applications, in fact,
no additional coding is necessaiy to publish youi Lifeiay applications on lace-
book (you would, of couise, need to use lacebooks APl to use lacebook-specic
featuiessuch as posting on useis timelines). Te only thing you need to do is
get an APl key and canvas page URL fiom lacebook.
1.5. USING LIFERAY AS A WEB PLATFORM 13
Figure 1.9: Any Liferay application can be published to multiple social
networks with a fewclicks.
As you can see, Lifeiay Poital is built foi social applications adding social
featuies to youi web site, cieating a social netwoik of youi own, cieating social
applications to be published on othei web sites, oi building a social application
foi lacebook.
As with social applications, Lifeiay Poital is also an easy to use, iobust plat-
foim foi any web application youie consideiing wiiting. ln addition to this,
Lifeiay Poital is easily conguied to be used as a shaied hosting platfoim foi
multiple web sites. Lets look at the benets you can ieap by using Lifeiay Poital
in these ways.
1.5 Using Liferay as a web platform
We cant even begin to imagine what youie thinking of building, but whatevei
it is, youie going to put youi heait and soul into it. Building it on Lifeiays
web platfoim can give you a leg up, by pioviding to you eveiything you need to
suppoit youi application, so you can concentiate solely on what youre building,
and not the iest of the featuies youi useis expect will come along with it.
Liferay as an application development platform
lmagine youi application foi a moment. Does it iequiie useis to iegistei with
youi site` Will they be able to comment on content contained within youi
application` ls theie some asset that useis can tag oi categoiize` lf you think
about the layout of the application, would it benet fiommodulaiization` Could
14 CHAPTER 1. WHAT IS LIFERAY?
you make use of a iich JavaSciipt fiamewoik with many components built into
it` How about secuiitywill you need to make infoimation available to some
useis, but not to all useis` Lifeiay Poital has all of this and moie available to
the developei, so you dont have to wiite it youiself.
Lifeiay Poitals development fiamewoik is a gieat help when youie building
a web application. While the fiamewoik itself is coveied in othei iesouices such
as the Liferay Developers Guide oi Liferay in Action, the stiengths of Lifeiay as
a platfoim aie also appaient once youve nished wiiting youi application.
loi example, bug xes to youi applications aie easy to apply, because Lifeiay
applications aie hot deployed to the iunning seivei. Lifeiays Maiketplace gives
you a ieady-made shopping centei foi youi applications. And Lifeiays web
seivices and JSON aichitectuie make it easy foi you to shaie data fiom youi
applications to othei systems iunning on dieient platfoims.
You get all thisnot to mention the automatic lacebook and OpenSocial inte-
giation mentioned abovesimply by using Lifeiays development platfoim. lts
a veiy poweiful platfoim, and ceitainly woith youi investigation.
Agreat integration platform
lf youie building an enteipiise system, poitals weie designed in the ist place
to be a single point of entiy to youi useis applications and content. Since Lif-
eiay Poital integiates well with usei diiectoiies such as LDAP and Active Di-
iectoiy, and single sign-on systems such as SAML and OpenSSO, it ts well into
youi enteipiise systems. Tis allows you to use it as an integiation platfoim foi
existing applications.
Lifeiay Poital, since it adheies to the JSR standaid foi poitlets, was designed
fiom the giound up foi application integiation. You can mix and match any
application installed in the system on any page within the poital. You can make
use of any APls piovided by othei systems to integiate theii data into an appli-
cation window in Lifeiay. And applications you cieate with Lifeiays Seivice
Buildei APl aie web seivice-enabled fiom the stait.
Hosting multiple sites on Liferay Portal
Lifeiay Poital excels as a multi-site hosting platfoim. You can use it to host
multiple sites undei the same oveiall aichitectuie (like lacebook, MySpace, oi
Pinteiest oei to theii useis), oi you could host seveial completely dieient web
sites based solely on Lifeiays ability to seive multiple instances of itself fiom
the same physical installation.
1.6. EXTENDING AND CUSTOMIZING LIFERAY FOR YOUR OWN NEEDS 1
ln the ist scenaiio, Lifeiay Poitals Sites aichitectuie lets you cieate multi-
ple, dieient web sites that have public and/oi piivate sets of pages and as many
pages within those sets as youd like. Useis join the web site, and once theyie
membeis, they can join and leave open sites with one click. Some sites can be
dened as iestiicted oi piivate, and useis cant access those unless theyie added
by site administiatois. All of these sites can have canonical domain names such
as baseballcaids.lifeiay.com oi piogiock.lifeiay.com.
Using this constiuct, you can build anything fiomlacebook, to Yahoo Gioups,
to Souiceloige, to the now-defunct-but-once-loved Geocities. Teie is no limit
to the numbei of sites you can have some Lifeiay installations have only one
oi two, but otheis have many thousands.
ln the second scenaiio, Lifeiay Poital lets you cieate completely sepaiate
instances of itself fiomthe same installation. Useis, gioups, oiganizations, sites,
and ioles fiom each instance aie kept completely sepaiate. lf a usei iegisteis
foi a usei id on one instance, he oi she would have to iegistei as a new usei on
anothei instance as well.
Tis lets you host many dieient, sepaiate web sites fiom one Lifeiay Poital
installation. Useis of each instance have access to the same poweiful content
management, collaboiation, social, and web development platfoim that theyd
have if they weie opeiating fiom a single, standalone installation.
1.6 Extending andcustomizing Liferay for your own needs
Beyond using Lifeiay as a development platfoim foi new applications, Lifeiay
Poital has also been designed to be extended and modied. As an open souice
pioject, its souice code is available, but Lifeiay Poitals developeis have de-
signed the pioduct to make it easy to build whatevei you want out of it.
Special sofwaie components called hook and ext plugins enable develop-
eis to change any aspect of Lifeiays inteiface and behavioiwithout having to
modify any of Lifeiay Poitals souice code. Tis piovides you all the benets
of the build fiom sciatch stiategy we mentioned eailiei, but without all the
eoit to build fiom sciatch. lf you want to make a change to the usei iegis-
tiation scieens, add suppoit foi a piopiietaiy single sign-on mechanism that
youve wiiuen, ievise the usei inteiface foi the message boaids application, oi
anything else, you can make those customizations. And if youie a developei,
weie suie you know that its a whole lot easiei to customize something that al-
most does things exactly the way you want than it is to wiite that featuie fiom
sciatch. With Lifeiay Poital, you can have youi cake and eat it too.
1 CHAPTER 1. WHAT IS LIFERAY?
1.7 Summary
So what is Lifeiay` As you can see, its haid to desciibe, because it does so
much. What weve essentially done is say its a totally awesome content and
document managing, usei collaboiating, socially enabling, application develop-
ing, coipoiate integiating, completely customizable platfoim foi building the
lnteinet. lf wed said that up fiont, youd piobably have doubted us. Hopefully
now, you can see that its tiue.
lf youie inteiested in using Lifeiay Poital foi your pioduct, continue iead-
ing. Well go thiough all of these featuies (and moie that we couldnt mention)
thioughout the iest of the book.
Cu~v1rv 2
Wrn CoN1rN1 M~N~crxrN1
Web Content Management is a systemwhich allows non-technical useis to pub-
lish content to the web without having advanced knowledge of web technology
oi piogiamming of any soit. Lifeiay WCM empoweis you to publish youi con-
tent with a simple point and click inteiface and it helps you to keep youi site
fiesh. Youll nd youiself easily cieating, editing and publishing content within
just a few minutes of being exposed to its featuies. But Lifeiay WCM doesnt
saciice powei foi simplicity. lf need be, you can use youi developei skills to
cieate complex piesentation layei templates that make youi content pop with
dynamic elements. Once these templates have been deployed into the poital,
youi non-technical useis can manage content using these templates as easily as
they would manage static content. All of this makes Lifeiay WCM an appio-
piiate choice foi sites with only a few pages oi sites with gigabytes of content.
ln this chaptei, well covei the following topics
leatuies of Lifeiay WCM
Cieating sites and managing pages
Authoiing content
Publishing content
1
18 CHAPTER 2. WEB CONTENT MANAGEMENT
Woikow
Site membeiships and peimissions
As youll see, Lifeiays WCM is a full-featuied solution foi managing youi
web site. Well stait with an oveiview of what it has to oei and then well dive
down into its featuies. Note that web content is just one kind of asset on Lifeiay.
Othei types of content (blog posts, wiki aiticles, message boaid posts, etc.) aie
also consideied assets. Lifeiay piovides a geneial fiamewoik foi handling assets
that includes tags, categoiies, comments, iatings, and moie. Please see chaptei
foi moie infoimation on Lifeiays asset fiamewoik.
2.1 HowCan Liferays WCMHelp You?
With Lifeiays WCM you have the ability to cieate, edit, stage, publish and ap-
piove content with easy to leain yet poweiful tools. Lifeiays WCMstieamlines
the content cieation piocess foi end useis. lts much fastei to use Lifeiays
WCM than it would be to cieate all the content foi youi site in HTML. Some
ways Lifeiay WCM makes this possible include
Once set up, non-technical useis can manage the site.
Lifeiays ne-giained peimissions system ensuies youi content gets to
the iight useis.
To manage the site, no piogiamming is iequiied.
Content can be staged.
Content can be passed thiough a woikow.
Content can be published on a schedule.
WCM is integiated with Lifeiays seivices so advanced template devel-
opeis can use them to queiy foi data stoied elsewheie in Lifeiay.
Once you get familiai with Lifeiay WCM youll wondei how you evei got
along without it.
2.2. CREATING SITES AND MANAGING PAGES 19
What Features Does Liferay WCMHave?
Lifeiays WCM has a host of featuies the makes managing the content of youi
site easiei.
WYSIWYG Editor: A complete HTML editoi that allow you to modify
fonts, add coloi, inseit images and much moie.
Structure Editor: Easily add and iemove elds you want available to con-
tent cieatois and then dynamically move them aiound. Tis editoi in-
cludes an entiie suite of foim contiols you can diag and diop onto youi
stiuctuie.
Template Editor: lmpoit template sciipt les that infoim the system how
to display the content within the elds deteimined by the stiuctuie.
Web Content Display: A poitlet that allows you place web content on a
page in youi poital.
Asset Publisher: Apoitlet which can aggiegate dieient types of content
togethei in one view.
Seduler: Lets you schedule when content is ieviewed, displayed and
iemoved.
Workow Integration: Run youi content thiough an appioval oi ieview
piocess.
Staging: Use a sepaiate staging seivei oi stage youi content locally so
you can keep youi changes sepaiate fiom the live site.
Lifeiays Web Content Management is a poweiful and iobust tool foi cieat-
ing and oiganizing content on youi web site. Lets begin by examining some
basic concepts involving sites and pages.
2.2 Creating sites and managing pages
With most pioducts, you would leain what the sofwaie can do in teims of
seuing up youi useis and secuiity model and then stait building youi system.
Youd design youi infiastiuctuie and get youi seivei enviionment up and iun-
ning while youi developeis wiite the applications that live on youi web site.
With Lifeiay Poital, howevei, you stait faithei ahead. Lifeiay Poital is moie
20 CHAPTER 2. WEB CONTENT MANAGEMENT
than just a container foi applications with a iobust secuiity model. lt alieady
includes many of the applications youll need, out of the box, ieady to go and
integiated with all the usei management and secuiity featuies youve alieady
leained about.
Neaily all Lifeiay useis use Lifeiays Web Content Management system(WCM).
Afei all, all eveiy web site has content that needs to be managed. Lifeiays
WCM empoweis you to manage all the content on youi site quickly and eas-
ily within youi biowsei. Beyond managing existing content, Lifeiay WCM lets
useis easily cieate and manage eveiything fiom a simple aiticle containing text
and images to fully functional web sites. Web publishing woiks alongside Lif-
eiay Poitals laigei collection of applications, which means you can add shop-
ping cait functionality, visitoi polls, web foims, site collaboiation tools and
moie. Eveiything is done with oui collection of easy-to-use tools with familiai
iich-text editois and an intuitive inteiface.
ln this section well covei some basic aspects of Lifeiay WCM, including
Page types
Layouts
Page and content peimissions
lmpoiting and expoiting content
Content cieation and editing
Content publishing
WCM Woikow
By the time weie done, you should be able to apply all these concepts to youi
own content. To demonstiate Lifeiays Content Management featuies, well
cieate and manage content on the poital foi Nose-ster, a new social netwoik
wheie people aie connected based on what theii noses look like.
liist, a liule housekeeping. lf weie going to be Nose-ster, oui poital should
also be called Nose-stei. To set geneial infoimation about youi poital like the
name and mail domain, go to the Contiol Panel and select Portal Seings undei
the Poital heading. You could set up the conguiation foi Nose-stei as follows.
You can also customize the logo in the top lef coinei of eveiy page by se-
lecting Display Seings undei the Miscellaneous tab on the panel to the iight.
Once youve made the changes, we can begin cieating pages.
2.2. CREATING SITES AND MANAGING PAGES 21
Figure 2.1: Changing Portal Settings
Creating and managing pages
You have a few options foi accessing the page cieation inteiface. To simplify
this, well covei the Dockbais Manage menu slightly out of oidei. Teie aie
two inteifaces to be awaie of Site Pages and Page. You can get to these fiom
multiple places. Depending on what youie editing and wheie you aie on the
poital, youll use eithei the Manage menu oi the Contiol Panel to woik with
youi pages. liomthe Contiol Panel, make suie you have the coiiect site selected
in the context menu selectoi and click the Site Pages link in the content section.
lf youve alieady navigated to the site you wish to manage, click Manage fiom
the Dockbai and select Site Pages. Tis is the exact same inteiface you see in
the Contiol Panel. To manage the specic page of the site youve navigated to,
click Manage and select Page.
loi convenience, you can also navigate to the Sites page undei the Poital
section of the Contiol Panel and click Actions Manage Pages. To quickly add
a single page while to the site youie biowsing, click Add fiom the Dockbai and
select Page. Just entei a name foi the page and its added immediately. Click
22 CHAPTER 2. WEB CONTENT MANAGEMENT
Figure 2.2: Managing Individual Pages
the name of the page in the navigation menu to visit it and stait woiking on it.
Site Pages is an inteiface to viewexisting pages, cieate newpages, viewpages
and expoit oi impoit pages using Lifeiay Aichive (LAR) les. Note that you can
switch between managing a set of pages and managing a single page using the
lef-hand side navigation menu. Click on Public Pages oi Private Pages to man-
age the gioup oi click on an individual page to manage just that one. Switch-
ing views like this changes the list of available tabs to the iight. By default,
lifeiay.com, which we ienamed to nosestei.com, contains a single public page
called Welcome.
Lifeiays page gioups aie always associated with sites. Even useis peisonal
pages aie pait of theii peisonal sites. All pages belong to one of two types of
page sets public pages and piivate pages. By default, public pages aie accessible
to anyone, even non-logged in useis (guests). Piivate pages aie accessible only
to useis who aie membeis of the site which owns the pages. Tis means the
piivate pages of an oiganizations site would be viewable only by membeis of
the oiganization.
Regaidless of whethei the pages aie public oi piivate, Lifeiay uses the same
inteiface to manage them. Lets look at this inteiface moie closely.
More page management tools
liomthe Manage Site Pages dialog box, you can add a page to the site by clicking
the Add Page buuon. Because Public Pages is selected on the lef, clicking Add
Page heie adds a top level page next to the Welcome page. You can, howevei,
2.2. CREATING SITES AND MANAGING PAGES 23
Figure 2.3: Managing Site Pages
nest pages as deeply as you like. To cieate a sub-page undei the Welcome page,
select the Welcome page ist and then cieate youi page. lf you latei decide you
dont like the oidei of youi pages, you can diag and diop them in the list to
put them in whatevei oidei you want. Lets go ahead and add anothei top level
page and name it Community. Well use this page foi the Recent Bloggeis and
Wiki poitlets.
Figure 2.4: Adding Pages
When you cieate a new page, you can cieate eithei a blank page oi a page
piepopulated with poitlets fiom a page template. When youie enteiing the
24 CHAPTER 2. WEB CONTENT MANAGEMENT
name of the page, you can select fiom a list of page templates that aie cuiiently
available. To view the pages once you add them, click the View Pages buuon.
Tis is how youd populate youi pages with content and applications. Tis is
coveied in succeeding chapteis.
lf youie using the Manage Pages inteiface to cieate a new page, youll have
some additional options to cieate dieient types of pages. Teie aie Portlet
Pages, Panel Pages, Embedded Pages, URL Pages and Link to Page. By default,
all pages aie cieated as poitlet pages but in some situations you might want to
use one of the othei options.
Portlet Pages aie the pages weie usually talking about. Tey have a layout
which you can diag and diop poitlets into. Most of the pages you cieate will be
poitlet pages.
Panel Pages can have any numbei of poitlets on them, as selected by an ad-
ministiatoi, but only one will be displayed at a time. Useis select which poitlet
they want to use fioma menu on the lef side of the page and the selected poitlet
takes up the entiie page.
Figure 2.5: Apanel page
Embedded Pages display content fiomanothei website inside of youi poital.
An administiatoi can set a URL fiomin the page management inteiface and that
page will appeai in the context and within the navigation of youi Lifeiay poital.
URL Pages aie just iediiects to any URL specied by an administiatoi. You
can use URL pages to cieate links to pages belonging to othei sites of youi poital
oi to pages of an exteinal site. Use URL pages cautiously since blind iediiects
cieate a pooi usei expeiience.
Link to Page cieates a poital page which functions as an immediate iediiect
to anothei page within the same site. You can select which page to link to fiom
a diopdown in the page management inteiface. You could use a Link to Page
2.2. CREATING SITES AND MANAGING PAGES 2
to place a deeply nested page in the piimaiy navigation menu of youi site, foi
example.
Once youve cieated pages and populated them with content, Lifeiay pio-
vides a way foi you to back them up to sepaiate les. Lets see how that woiks.
Baing up and Restoring Pages Next to the Add Page buuon in the Manage
Site Pages scieen aie two buuons labeled Export and Import. Te Expoit buuon
expoits the pages you cieate into a single le, called a LAR (Lifeiay Aichive).
You can then impoit this le into any seivei iunning Lifeiay to ie-cieate the
pages. lf you have a LAR you would like to impoit, use the Import buuon.
Expoiting and lmpoiting LARs is a gieat way to take content fiom one envi-
ionment (say, a development oi QA enviionment) and move it all in one shot
to youi pioduction seivei. Note that you should not make this a iegulai oc-
cuiience. lf you want to iegulaily move pages fiom one seivei to anothei, you
should use Lifeiays staging enviionment, which is coveied in chaptei 3.
LARs aie also a good way to back up youi sites content. You can expoit
them to a specic location on youi seivei which is backed up, and if you evei
have to iestoie youi site, all you need to do is impoit the latest LAR le. One
limitation on LAR les, howevei, is that they aie veision dependent, so you cant
use an expoit fiom an old veision of Lifeiay and impoit it into a newei veision.
Lets be good administiatois and expoit a LAR le foi backup puiposes.
Click on the Export buuon and then name the le nosesterv1.lar. Use the
check boxes to deteimine what youd like to expoit. loi this initial expoit, se-
lect eveiything. Note that if you select the More Options link, the list expands
to include data fiom many of Lifeiays applications, including the Documents
and Media Libiaiy, Message Boaids and Web Content. You can also expoit the
theme youie using.
Once you click Export, youi biowsei piompts you to save the le. Once you
have the le, you can copy it to a backup location foi safekeeping oi impoit it
into anothei installation of Lifeiay Poital. lf you must iebuild oi wish to ieveit
back to this veision of youi site, you can impoit this le by clicking the Import
buuon fiom the Manage Site Pages dialog box, biowsing to it and selecting it.
Next, well look at the options on the iight side menu, staiting with Look
and leel.
Customizing the Look and Feel When you open the Manage Site Pages dialog
box it defaults to the Look and leel tab. On this tab, youie piesented with an
inteiface that allows you to choose a theme foi the cuiient site. Temes can
2 CHAPTER 2. WEB CONTENT MANAGEMENT
tiansfoim the entiie look of the poital. Tey aie cieated by developeis and aie
easily installed using the Lifeiay Maiketplace. Since we dont have any themes
beyond the default one installed yet, well use the default theme foi oui pages.
Figure 2.6: Look and Feel Interface
Many themes include moie than one coloi scheme. Tis allows you to keep
the existing look and feel while giving youi site a dieient avoi. Change the
coloi scheme fiom blue to gieen by selecting Green undei Color Schemes. lf you
now go back to the site (by clicking Back to nosester.com in the top lef coinei
2.2. CREATING SITES AND MANAGING PAGES 2
of the Contiol Panel), youll see some paits of the page aie now tinged in a
gieenish hue.
lf you apply a coloi scheme to a set of public oi piivate pages it is, by default,
applied to each page in the set. lf, howevei, you open the Manage Pages dialog
box foi a paiticulai page, you can select Dene a specic look and feel for this
page to make the coloi scheme apply to this page only. You can use this featuie
to choose a dieient coloi scheme foi a paiticulai page than the one dened foi
the set of public oi piivate pages to which it belongs.
Teie aie a few moie conguiable seuings foi youi theme. You can switch
the bullet style between dots and aiiows and you can choose whethei oi not to
show poitlet boideis by default.
Also notice themes can apply to iegulai biowseis oi mobile devices. You
could cieate anothei site foi mobile useis auached to the hup//m.nosestei.com
addiess and seive up a page designed foi the smallei scieens on phones.
Te CSS section allows you to entei custom CSS that will also be seived up
by youi theme. ln this way, you can tweak a theme in ieal time by adding new
styles oi oveiiiding existing ones.
Te next option conguies the logo that appeais foi youi site.
Using a custom logo lf you want to use youi own logo foi a specic site, use
the Logo tab. Adding a custom logo is easy select the Logo tab and biowse to
the location of youi logo. Make suie youi logo ts the space in the top lefcoinei
of the theme youie using foi youi web site. lf you dont, you could wind up
with a site thats dicult to navigate, as othei page elements aie pushed aside
to make way foi the logo.
ln the logo tab, you can also choose whethei oi not to display the site name
on the site. lf you check the box labeled Show Site Name the site name will ap-
peai in the the top iight coinei of the page. Tis option is enabled by default and
cannot be disabled if the Allow Site Administrators to set their own logo option
is disabled in Portal Seings. lt is also not available foi the default site only
newly cieated sites and usei pages have the option to have the name display.
Changing options for individual pages
When you select a single page, some dieient options appeai. Lets look at what
these do.
Details: lets you name the page foi any localizations you need. You can also
set the HTML title that appeais in the biowsei window foi the page. Plus you
can set an easy to iemembei, fiiendly URL foi the page.
28 CHAPTER 2. WEB CONTENT MANAGEMENT
SEO: piovides seveial means of optimizing the data the page piovides to an
indexei thats ciawling the page. You can set the vaiious meta tags foi desciip-
tion, keywoids and iobots. Teies also a sepaiate Robots section that lets you
tell indexing iobots how fiequently the page is updated and how it should be
piioiitized. lf the page is localized, you can select a box to make Lifeiay gen-
eiate canonical links by language. lf you want to set some of these seuings foi
the entiie site, you can specify them fiom the Sitemaps and Robots tabs of the
Manage Site Seuings dialog box (see below).

ln pievious veisions of Lifeiay, it was possible that a


single page could be indexed multiple times. ln Lifeiay
.1, all URLs that diiect to the same page will only cie-
ate one entiy in the index. Pieviously, the simple URL
hp://www.nosester.com/web/guest/blog/-/blogs/thenose and dif-
feient veisions of the URL which piovided additional infoima-
tion about the iefeiiing page had dieient entiies in the index.
As of Lifeiay .1, each asset (web content aiticle, blog entiy, etc.) has a
unique URL. liom the seaich engines point of view, this will make youi
pages iank highei since any iefeiences to vaiiations of a specic URL will
all be consideied iefeiences to the same page.
Look and Feel: lets you set a page-specic theme.
Layout: lets you specify how poitlets aie aiianged on a page. Choose fiom
the available installed templates to modify the layout. lts veiy easy foi devel-
opeis to dene custom layouts and add them to the list. Tis is coveied moie
thoioughly in both the Liferay Developers Guide and in Liferay in Action.
JavaScript: gives you the ability to paste custom JavaSciipt code to be exe-
cuted on this page.
Custom elds: lf custom elds have been dened foi pages (which can be
done fiomthe Custom Fields page of the Contiol Panel), they appeai heie. Tese
aie metadata about the page and can be anything you like, such as authoi oi
cieation date.
Advanced: contains seveial optional featuies. You can set a queiy stiing to
piovide paiameteis to the page. Tis can become useful to web content tem-
plates, which youll see in the next chaptei. You can set a taiget foi the page so
that it eithei pops up in a paiticulaily named window oi appeais in a fiameset.
And you can set an icon foi the page that appeais in the navigation menu.
2.2. CREATING SITES AND MANAGING PAGES 29
Mobile Rule Groups: allows you to apply iules foi how this page should be
iendeied foi vaiious mobile devices. You can set these up in the Mobile Device
Rules section of the Contiol Panel.
CustomizationSettings: lets you maik specic sections of the page you want
useis to be able to customize.
Note that the Manage Page Layout menu diiects you to the same Layout
tab thats in Manage Page.
Modifying Page Layouts
Page layouts allow you to aiiange youi pages so the content appeais the way
you want it to. Lifeiay comes with many layouts alieady dened. Developeis
can cieate moie and they can be deployed to youi poital foi youi use.
To piepaie foi the poitlets well soon be adding, lets change the layout of
the Collaboiation page. To access layouts, select Manage Page Layout fiom
the Dockbai.
Now, select the 2 Columns (70/30) layout and click Save. Once saved, youll
ietuin to the page and itll seemas though nothing has happened. Once we stait
adding poitlets, howevei, youll notice the page is now equally divided into two
columns. You can stack poitlets on top of each othei in these columns. Teie
aie, of couise, moie complicated layouts available and you can play aiound with
them to get the layout you want.
Sometimes a paiticulai layout is almost what you want but not quite. ln this
case use the Nested Poitlets poitlet to embed a layout inside anothei layout. Tis
poitlet is a containei foi othei poitlets. lt lets you select fiom any of the layouts
installed in Lifeiay, just like the layouts foi a page. Tis gives you viitually
unlimited options foi laying out youi pages.
Te next option in the Manage menu is page customizations.
Page Customizations
Page Customizations aie a newfeatuie in Lifeiay .1. With page customizations,
any usei with the appiopiiate peimissions can cieate peisonalized veisions of
any public page. Befoie useis can cieate peisonalized veisions of pages, cus-
tomizations must ist be enabled by an administiatoi. Administiatois can ac-
tivate oi deactivate customizations foi any iow oi column on any page. When
useis customize a page, they have the option to use eithei theii veision oi the
default veision of a page. Useis cant see alteinate veisions of pages othei than
theii own.
30 CHAPTER 2. WEB CONTENT MANAGEMENT
Figure 2.7: Setting Customizable Columns
When an administiatoi activates page customizations foi a page, any poitlets
that aie in a Customizable iow oi column can be moved aiound the page oi
iemoved fiom the page. Useis can add new poitlets of theii own choosing to
these columns of the page and can also customize poitlet conguiations. lf at
any time useis deteimine they dont like theii customizations, they can click
Reset My Customizations to ieveit theii pages back to the default. loi moie
infoimation about page customizations, please iefei to the Page Customizations
section of chaptei .
Now that you know how to enable page customizations, lets look at the
seuings foi the site as a whole.
Conguring Site Settings
As with Site Pages, you can access Site Seuings thiough the Contiol Panel oi
diiectly fiom the site using the Dockbai (Manage Site Seings).
Youll nd options to specify details and metadata about youi site, set up
fiiendly URLs and viitual hosts, conguie seaich engine optimization seuings,
tuin staging on oi o and specify a Google Analytics lD. Lets take a closei look.
Details: allows an administiatoi to change the desciiption and membeiship
type of a site and also to specify tags and categoiies foi the site. Te membeiship
type can be set as open, iestiicted oi piivate based on the piivacy needs of the
site. Useis can join and leave an open site at will. To join a iestiicted site, a usei
has to be added by the site administiatoi. A usei can also iequest to be added
thiough the Sites section of the Contiol Panel. A piivate site is like a iestiicted
site but doesnt appeai in the Sites section of the Contiol Panel foi useis who
aient membeis.
Pages: liom Site Seuings, click on Pages to manage some basic featuies of
the pages on a site. lf no pages have been dened yet, you can set site templates
2.2. CREATING SITES AND MANAGING PAGES 31
Figure 2.8: Site Settings
foi the public oi piivate pages. lf pages alieady exist, links aie piovided to view
them. You can also change the sites application adaptei, which is a special type
of hook plugin that customizes out of the box functionality foi specic sites.
Site URL: Set a fiiendly URL and/oi a viitual host foi youi site heie. Te
Friendly URL option lets you manage the path to youi site in the poitals URL.
liiendly URLs aie used foi both public and piivate pages. loi public pages,
the fiiendly URL is appended to hup//localhost8080/web. loi piivate pages,
the fiiendly URL is appended to hup//localhost8080/gioup. Each fiiendly URL
needs to be a unique name, of couise. Having a human-ieadable fiiendly URL
assists indexing bots and is ciitical to good seaich engine optimization.
loi example, suppose you weie cieating a poital foi a bank called the Best
Bank. lf you set the fiiendly URL of youi poitals default site to /best-bank, the
URL of youi default sites public home page would change to
hup//localhost8080/web/best-bank/home
lf youi poitals default site had piivate pages, the URL of the default piivate
home page would change to
hup//localhost8080/gioup/best-bank/home
Note that if youie adding a fiiendly URL foi youi poitals home page, you
should update youi poitals Home URL eld so that page iequests to youi do-
main name iediiect piopeily. To do this, navigate to the Poital Seuings page
of the Contiol Panel and nd the Home URL eld in the Navigation section.
loi oui bank example, we would entei /web/best-bank/home into the Home URL
32 CHAPTER 2. WEB CONTENT MANAGEMENT
eld. Once youve enteied this seuing, page iequests to localhost8080 will iedi-
iect to the fiiendly URL of youi poitals newhomepage hup//localhost8080/web/best-
bank/home.
Virtual Hosts make web navigation much easiei foi youi useis by connecting
a domain name to a site. Tis tab allows you to dene a domain name (i.e.,
www.mycompany.com) foi youi site. Tis can be a full domain oi a subdomain.
Tis enables you to host a numbei of web sites as sepaiate sites on one Lifeiay
seivei.
loi instance, if we set this up foi Nose-steis Development Netwoik, useis in
that site could use developeis.nosestei.com to get to theii site, piovided Nose-
steis netwoik administiatois cieated the domain name and pointed it to the
Lifeiay seivei.
To set this up, the DNS name developers.nosester.com should point to youi
poitals lP addiess ist. Ten entei hp://developers.noseter.com in the Viitual
Host tab foi the Developeis site. Tis helps useis quickly access theii site with-
out having to iecall an extended URL.
Site Template: lf youve cieated the site fioma site template, this section dis-
plays infoimation about the link between the site template and the site. Specif-
ically, you can see which site template was used and whethei oi not it allows
modications to the pages inheiited fiom it by site administiatois. lf youie not
using site templates foi this site, you can safely ignoie this section.
Sitemap: lets you send a sitemap to some seaich engines so they can ciawl
youi site. lt uses the sitemap piotocol, which is an industiy standaid. You can
publish youi site to Yahoo oi Google and theii web ciawleis will use the sitemap
to index youi site. Lifeiay Poital makes this veiy simple foi administiatois by
geneiating the sitemap XML foi all public web sites.
By selecting one of the seaich engine links, the sitemap will be sent to them.
lts only necessaiy to do this once pei site. Te seaich engine ciawlei will pe-
iiodically ciawl the sitemap once youve made the initial iequest.
lf youie inteiested in seeing what is being sent to the seaich engines, select
the Preview link to see the geneiated XML.
Robots: lf youie using viitual hosting foi this site, you can conguie ro-
bots.txt iules foi the domain. Te Robots page gives you the option to con-
guie youi robots.txt foi both public and piivate pages on a site. lf you dont
have Viitual Hosting set up, this tab is iathei boiing.
Staging: enables you to edit and ievise a page behind the scenes, then publish
changes to youi site once they have been completed and ieviewed. loi a full
explanation of Staging, see chaptei 3 Advanced web content management.
Analytics: allows you to integiate youi pages with Google Analytics. Lif-
eiay piovides seamless integiation with Google Analytics, allowing you to place
2.2. CREATING SITES AND MANAGING PAGES 33
youi lD in one place, then it will get inseited on eveiy page. Tis enables you
to focus youi eoits on building the page, iathei than iemembeiing to put the
code eveiywheie. Google Analytics is a fiee seivice which lets you do all kinds
of tiac analysis on youi site so you can see who visits, wheie visitois aie fiom
and what pages they most ofen visit. Tis helps you tweak youi site so you can
piovide the most ielevant content to youi useis.
Now that you know how to conguie sites, lets look at page templates and
site templates.
Page Templates and Site Templates
Page Templates and Site Templates aie invaluable tools foi building similai pages
on laigei poitals. As you continue to add pages to sites in youi poital, youll
notice iepeatable paueins in the designs of those pages. Page templates enable
you to pieconguie a single page and then apply it to any new page you cieate.
Site Templates allow you to do the same thing but on the scale of a siteif you
have multiple sites that use a similai stiuctuie of pages, you can cieate a single
site template and use it to cieate as many sites as desiied. loi a full explanation
of Page Templates and Site Templates, see chaptei 3.
Site Content
Lifeiay .1 makes it easiei to access Web Content management without using
the Contiol Panel. You can now click Manage and then Site Content to access
the same Web Content contiols featuied in the Contiol Panel iight fiom youi
poital page.
You can manage the following kinds of content
Recent Content
Web Content
Documents and Media
Bookmaiks
Calendai
Message Boaids
Blogs
Wiki
34 CHAPTER 2. WEB CONTENT MANAGEMENT
Figure 2.9: Site Content
Polls
Sofwaie Catalog
Tags
Categoiies
Social Equity
Dynamic Data Lists
loi details about Lifeiays social collaboiation suite, see chaptei 10.
Creating the Nose-ster pages
Teie aie a lot of othei things you can do beyond placing poitlets on a page.
So lets stait woiking on the Nose-stei site. You can do this by going up to the
Dockbai and clicking Go to Nose-ster.
Well use the Community page you cieated eailiei in the chaptei. Navigate
to the Community page and select Manage Page fiom the Dockbai.
Tis scieen should now be familiai to you but lets iecap.
Te Page tab allows you to
2.2. CREATING SITES AND MANAGING PAGES 3
Change the name of the page
Entei HTML code foi the title
Choose the page type
Hide the page fiom the theme navigation
Dene a fiiendly URL to the page
Choose an icon to be displayed
Choose a fiame taiget foi the page
Copy an existing page
You can also entei custom meta tags oi JavaSciipt to the page if youie a
web developei. Additionally, if you click the Permissions buuon, you can dene
which useis, gioups, ioles oi oiganizations can view oi edit the page.
Te Childien tab lets you cieate child pages undeineath the page youve se-
lected. You can nest pages as deep as you like but foi eveiy page below the
top level hieiaichy you must piovide navigation to it via a Navigation oi Biead-
ciumb poitlet, at least with most themes (including the default). Developeis can
cieate themes which have cascading menu bais which show the full hieiaichy.
Some examples of that aie in Lifeiays plugin iepositoiies.
loi now, click Return to full page. You should be able to dene and manage
pages in Lifeiay at this point so lets look at what youd put on a page.
Portlets
As we discussed eailiei, Lifeiay Poital pages aie composed of poitlets. All of
youi sites functionality, fiom blogs to shopping, is composed of poitlets.
Adding poitlets to a page is simple. Lets add some to oui Collaboiation
page.
1. ln the Dockbai, select Add More.
2. ln the menu that appeais, expand the Collaboration categoiy.
3. Diag the Blogs Aggregator poitlet o the Add Application window onto the
iight column of oui page.
4. Next, diag the Wiki poitlet to the le column.
3 CHAPTER 2. WEB CONTENT MANAGEMENT
See how easy it is to add applications to youi pages` Weve gone one step
fuithei weve got the Wiki poitlet, the Blogs Aggiegatoi poitlet and then a
nested poitlet with a dieient layout and the Aleits, Seaich and Dictionaiy
poitlets in the guie below.
Figure 2.10: Yeah, were showoffs. But as you can see, your page layout
options are virtually limitless.
Youll nd its easy to make youi pages look exactly the way you want them
to. lf the layout options piovided aient enough, you can even develop youi
own. Moie infoimation about that can be found in Lifeiays ocial guide to
development, Liferay in Action.
Page Permissions
By default, public pages aie just that public. Tey can be viewed by anybody,
logged in oi not logged in. And piivate pages aie ieally only piivate fiom non-
membeis of the site. lf someone has joined youi site oi is a membei of youi
oiganization, that peison can see all the piivate pages. You can, howevei, mod-
ify the peimissions on individual pages in eithei page gioup so only ceitain
useis can view them.
Lets say we wanted to cieate a page only foi administiatois to see. We can
do this with the following pioceduie
2.2. CREATING SITES AND MANAGING PAGES 3
1. Go to the Dockbai and select Manage Control Panel.
2. Ensuie youve selected the default site in the context selectoi.
3. Click the Site Pages link.
4. Click the Private Pages tab to switch to the Piivate Pages. Remembei, these
pages by default aie viewable only by membeis of the site.
. Cieate a page called Admin Tips.
. Click on the page in the tiee on the lef and then click Permissions.
. Uncheck the View and Add Discussion peimissions next to the Site Membei
iole.
8. Click the Save buuon.
Figure 2.11: Permissions for Admin Tips
Congiatulations' Youve just changed the peimissions foi this page so only
site administiatois can view it. Any useis you add to this iole can now see the
page. Othei useis, even membeis of this site, wont have peimission to see it.
Pages in Lifeiay aie as exible as pages youd cieate manually without a
poital. Using a point and click inteiface, you can dene youi site any way
38 CHAPTER 2. WEB CONTENT MANAGEMENT
you want. You can cieate and iemove pages, expoit and impoit them, set theii
layouts, dene how they aie indexed by seaich engines and moie. Youve also
been intioduced to Lifeiays concept of sites. Again, using a point and click
inteiface, you can cieate multiple web sites and dene how useis can access
them, whethei they aie linked to a domain name and cieate all of theii pages.
You now undeistand how to manage pages in Lifeiay Poital. lts time to
move on to adding content to those pages. Lifeiays Web Content Management
(WCM) is a highly poweiful, yet exible, set of tools that enables you to suc-
cessfully manage youi web site.
Youll soon discovei that Lifeiays WCM is easy to leain and highly cong-
uiable. lf you alieady have expeiience with WCM, youll see some new featuies
and impiovements to old ones. lf youie new to Lifeiays WCM, then youll be
suipiised at how fast you will be adding, editing and scheduling content on
youi site. Once youie familiai with poitlets such as Web Content Display and
Asset Publishei, youi ability to manage an immense site with a laige amount of
content will simply amaze you.
Well be using Lifeiays WCM to publish simple pieces of content, develop
templates to dene howcontent is to be displayed, set up a woikowfoi content
to be appioved, schedule when content is to be published and much, much moie.
2.3 Authoring (basic) content
Youve been assigned the task to build a web site foi an innovative new social
netwoiking site called Nose-stei. Youve decided to take advantage of Lifeiay
Poital and its iapid deployment featuies as well as its ability to get a fully func-
tional, content-iich web site with integiated social featuies up and iunning in
liule time. Togethei, we can get you staited.
Well walk thiough the cieation of Nose-steis web site, staiting by cieating
and publishing some simple content using Lifeiays built-in WYSlWYG editoi.
Well then take advantage of Lifeiays iobust stiuctuie editoi. Well use tem-
plates to display the content and then exploie some of the advanced publishing
featuies such as the built-in woikow and Asset Publishei.
Creating content the simple way
As weve stated above, content is the ieason web sites exist. Lifeiay Poital has
made it easiei than evei to get content published to youi site. Because Lifeiay
2.3. AUTHORING (BASIC) CONTENT 39
Poital is so exible, you can use basic authoiing tools iight away oi take advan-
tage of the moie advanced featuies. lts adaptable to youi needs.
Well begin by cieating simple content using Lifeiays WYSlWYGEditoi and
then well publish it to the home page of Nose-steis web site. Tis is a fast and
stiaightfoiwaid piocess that demonstiates how easy it is to cieate and publish
content on youi Lifeiay Poital instance. Lets leain about the Web Content
section of the contiol panel so we can cieate and publish oui ist pieces of
content.
Figure 2.12: Choosing a Site in the Content Section
When you manage web content fiom the Contiol Panel you can select the
location wheie the content iesides. loi instance, you can add content thats
available to a specic site oi globally acioss the poital. Te Content section of
the Contiol Panel displays as its heading the name of the site youie cuiiently
woiking on. Tis heading is called the context menu selector you can change the
scope of wheie youd like to view, edit oi cieate content by using the diop-down
selectoi auached to the heading.
Rich, WYSIWYGEditing
Once you have the Nose-stei site selected, click on the Web Content link in the
Contiol Panel. Next, click the Add buuon undei the Web Content tab. Tis is
a highly customizable foim that by default has two elds a title and a powei-
ful WYSlWYG editoi. We could customize this foim to contain whatevei elds
oui content needs but lets keep things simple foi now. Well covei moie ad-
vanced featuies such as stiuctuies, templates and content scheduling latei in
this chaptei.
loi now, type the woids Welcome to Nose-ster in the Name eld. Notice that
content can be localized in whatevei language you want. lf you click on the
localize checkbox, two select boxes appeai which allowyou to pick the language
youie woiking in and the default language. You can entei tianslations of youi
content foi any language in the list. Te scieenshot below shows this inteiface
but foi now, we wont be using it, so you can leave it unchecked. ln the content
eld, add a shoit sentence announcing the web site is up and iunning.
40 CHAPTER 2. WEB CONTENT MANAGEMENT
Figure 2.13: The Web Content Editor provides many options for
customization.
Geuing a newweb site up and iunning is an exciting step foi anyone, whethei
it is a laige coipoiation oi a small non-piot chaiity. To celebiate this momen-
tous achievement at Nose-stei, lets give oui announcement some of the pomp
and ciicumstance we think it deseives'
Using the editoi, select all the text and then change the style to Heading 1
and the coloi to Dark Green.
You could inseit an image heie oi even moie text with a dieient style, as
demonstiated in the scieenshot below. You can also add bullets, numbeiing,
links to anothei site oi custom images. You can even add an emoticon. Lets
add a smiley face at the end of oui announcement.
Te WYSlWYG editoi is a exible tool that gives you the ability to add text,
images, tables, links and moie. Additionally, you can modify the display to
match the puipose of the content. Plus its integiated with the iest of Lifeiay
2.3. AUTHORING (BASIC) CONTENT 41
Figure 2.14: Viewyour content changes directly in the editor.
42 CHAPTER 2. WEB CONTENT MANAGEMENT
Poital foi example, when you upload an image to be added to a page, that image
can be viewed and manipulated in the Documents and Media poitlet.
lf youie HTML savvy, Lifeiay WCM doesnt leave you out in the cold. You
can click the Source buuon and wiite youi own HTML if you wish.
On the iight of the New Web Content foim aie options that allow you to
customize youi web content.
Figure 2.15: Newweb content can be customized in various ways using
the menu on the right.
Abstract: lets you to cieate a biief summaiy of the web content. You can
also paii the text with a small image.
Categorization: species the content type fiom a list of options. Tey aie
Announcements, Blogs, General, News, Press Release, and Test. You can also cieate
tags to make the content easiei to nd in a seaich. Note that these categoiies aie
dened by a piopeity in the piopeities le, see the journal.article.types
piopeity in chaptei 20 foi fuithei infoimation.
Sedule: customizes the date and time youi content publishes and/oi ex-
piies.
Display Page: lets you deteimine wheie the web contents aie displayed
when linked fiom othei pages. Te concept of the Canonical URL is new to
Lifeiay .1. Te Canonical URL is unique foi aiticles that iediiect the visitoi to
the aiticles default display page.
lmagine you have a newspapei with a spoits section and a technology sec-
tion. You add a Spoits page and a Tech page to youi site, each one with a specic
bannei and look and feel. You want the aiticles to appeai in the appiopiiate
pages, but you know in Lifeiay aiticles aie not ielated to pages. You can add an
aiticle as ofen as you like in dieient web content display poitlets oi in con-
guied Asset Publisheis. But if you have a View in context link, wheie will you
2.3. AUTHORING (BASIC) CONTENT 43
show youi aiticle` Tis is wheie youd use a default display page. Aiticles that
have a default display page dened aie shown with othei ielated aiticles in the
same display page.
lmagine you have 100 spoits aiticles and 100 tech aiticles. ln pievious vei-
sions of Lifeiay youd need to cieate a page foi each aiticle to show it. Now
with only one spoits page and one tech page, you can show all aiticles in one
place in a consistent fashion.
Creating a display page Teie aie two ways of cieating a display page. You
can use a Content Display Page template, which automatically cieates eveiy-
thing you need, oi you can cieate one manually. Te Content Display Page
template is found undei Page Templates in the Poital section of the Contiol
Panel.
To cieate a display page manually, add an Asset Publishei to a page. Ten
make it the Default Asset Publishei foi the page. Tis denes this Asset Pub-
lishei as the one that displays the content if seveial Asset Publisheis aie on the
same page. Set this up by clicking Conguration on youi Asset Publishei. Undei
the Setup tab, navigate to Display Seings and check the checkbox labeled Set
as the Default Asset Publisher for is Page.
Once youve given an aiticle its default display page, links to the aiticle iedi-
iect the usei to its default display page. To see how this woiks, add an Asset
Publishei to anothei page, like the Home page of the newspapei, and conguie
it to View in a Specic Portlet. Tis seuing is found in the Asset Link Behavior
menu undei Display Seuings. lf you click on the link, youll be iediiected to the
Default Display Page of the aiticle.
You now see that the link looks something like this
www.nosestei.com/nose-aiticle
Tis is an example of a canonical URL, and its a nice enhancement foi Seaich
Engine Optimization (SEO) because the aiticles URL becomes the page URL. To
a seaich engine thats ciawling youi site, this means that the location of youi
aiticle nevei changes. And if you decide to use the content on anothei page
in the futuie, the aiticle is still available at this URL. Tis featuie is used in
seaich iesults, in ielated assets and in Asset Publisheis. loi moie infoimation
on Lifeiays Display Pages, see chaptei .
Related Assets: enables you to connect any numbei of assets within a site
oi acioss the poital, even if they dont shaie any tags and aient in the same
categoiy. You can connect youi content to a Blogs Entiy, Message Boaids Mes-
sage, Web Content, Calendai Event, Bookmaiks Entiy, Documents and Media
Document, and a Wiki Page.
44 CHAPTER 2. WEB CONTENT MANAGEMENT
Figure 2.16: This blog entry has links to three Related Assets: one web
content display and two blog entries.
Youll leain how to publish links to ielated assets using the Related Assets
poitlet in the Dening content relationships section of chaptei .
Permissions: customize who has access to the content. By default, content
is viewable by Anyone (Guest Role). You can limit viewable peimissions by
selecting any Role fiomthe diop-down oi in the list. Additionally, Lifeiay Poital
piovides the ability to customize peimissions in moie detail. Select the More
Options link next to the diop down buuon and youll nd the dieient activities
you can giant oi deny to youi web content.
Custom elds: customize metadata about the web content. Te elds can
iepiesent anything you like, such as the web contents authoi oi cieation date.
lf custom elds have been dened foi web content (which can be done fiom the
Custom Fields page of the Contiol Panel), they appeai heie.
2.4. PUBLISHING (BASIC) CONTENT 4
Figure 2.17: Permissions for Web Content allowyou to ne-tune how
your content is accessed.
loi moie infoimation on Custom lields see the Custom lields section in
chaptei 1.
loi this piece of web content, we dont need to change anything. Afei youie
nished with peimissions, click Save as Dra. Tis saves the content in diaf
foim. Once youie satised with youi changes, select Publish. Tis makes the
content available foi display, but we still have some woik to do to enable useis
to see it. ln Lifeiay WCM, all content iesides in a containei, which is one of two
poitlets Web Content Display oi Web Content List. By fai the most fiequently
used is the Web Content Display poitlet. Lets look at how it woiks.
2.4 Publishing (basic) content
Now that weve cieated and published oui ist piece of web content foi Nose-
stei, its time to display it. liist, add the Web Content Display poitlet to oui
Welcome page by selecting Add Web Content Display fiom the Dockbai.
Once the poitlet appeais, diag it to the position on the page wheie you want
youi content to appeai. You can have as many Web Content Display poitlets on
a page as you need, which gives you the powei to lay out youi content exactly
the way you want it.
To add existing web content, select the gear icon on the lowei lef of the
poitlet. You will see the message Please select a web content from the list below.
You have seveial options heie.
Natuially, if youi content appeais in the list, you can simply select it. lf
theie is lots of published content available, you could seaich foi the content by
name, lD, type, veision, content and site (click the Advanced link to see all the
4 CHAPTER 2. WEB CONTENT MANAGEMENT
Figure 2.18: Adding the Web Content Display Portlet
options). You can also show the available locales foi youi content. lf youie
woiking on the page foi a paiticulai language, you can select the tianslation of
youi content that goes with youi locale.
lf you have enabled OpenOce.oig integiation with youi poital, you can
also enable document conveision foi youi content. Tis gives youi useis the
ability to download youi content in theii foimat of choice. Tis is especially
handy if you aie iunning a ieseaich oi academically oiiented site, useis can
veiy quickly download PDls of youi content foi theii ieseaich piojects.
Note that you also have othei options, such as enabling a Piint buuon, en-
abling iatings so useis can iate the content, enabling comments and enabling
iatings on comments.
Te Piint buuon pops the content up in a sepaiate biowsei window that
contains just the content, without any of the web site navigation. Tis is handy
foi piinting the content. Enabling iatings shows one of two iatings inteifaces
Lifeiay has ve stais oi thumbs up and thumbs down. Tis can be set globally
in the portal-ext.properties le. See chaptei 12 foi fuithei infoimation
about this.
Enabling comments cieates a discussion foium auached to youi content
which useis can use to discuss youi content. Enabling iatings on comments
gives youi useis the ability to iate the comments. You may decide you want
one, some oi none of these featuies, which is why theyie all implemented as
simple check boxes to be enabled oi disabled at need.
lf you click the Supported Clients tab, youll see you can choose the type
of client to which you want to expose content. Tis lets you taiget the laige
scieens of useis computeis foi expansive giaphics and lots of special eects
oi taiget the small scieens of mobile devices with peitinent infoimation and a
2.4. PUBLISHING (BASIC) CONTENT 4
Figure 2.19: Publishing web content is a snap. At a minimum, you only
have to select the content you wish to publish. You can also enable lots of
optional features to let your users interact with your content.
lightweight page. loi now, leave both checked and click the Save buuon. You
can now close the conguiation window.
To publish new content, select the page and green plus icon on the lowei lef
of the poitlet. Tis launches the same full-featuied editoi youve alieady seen
in the Contiol Panel, which lets you add and edit content in place as you aie
woiking on youi page.
Tis is anothei example of the exibility that Lifeiay Poital oeis. At times,
you may want to add content diiectly into the Web Content Display poitlet of
the page youie managing, especially if you aie in the piocess of building the
page. At othei times, you may want to use the Contiol Panel to cieate content,
because at that moment youie moie conceined with the cieation of the content
and not wheie the content will latei be displayed. Lifeiay WCM suppoits both
piocesses.
48 CHAPTER 2. WEB CONTENT MANAGEMENT
Editing content thats alieady been published is just as easy as cieating new
content is. Youll use the same exact tools.
Editing Content Once the content is displayedwhethei youve selected con-
tent oi cieated it in the Web Content Display poitletyou can edit the content
diiectly fiom the Web Content Display poitlet oi fiom the Contiol Panel. To
edit it fiom the Web Content Display poitlet, select the pencil icon to the lowei
lef of the poitlet. Tis launches the WYSlWYG editoi and fiom theie you can
make any necessaiy changes.
Figure 2.20: Edit, Select and Add Icons of Web Content Display Portlet
When you publish youi content this way, it becomes available immediately
(unless, of couise, you have a woikow enabled, which well see below). Tis
happens whethei you edit it in place oi in the Contiol Panel.
Note if you want to view youi page the way youi useis will see it (i.e.,
without all those poitlet contiols and icons), go up to the Dockbai and select
Toggle Edit Controls. Tis makes all those extia contiols you see as a poital
administiatoi disappeai. lf you need to use those contiols again, just select
Toggle Edit Controls again.
Tats pieuy much all theie is to simple content cieation. Whole sites have
been cieated this way. But if you want to take advantage of the full powei of
Lifeiays WCM, youll want to use stiuctuies and templates found in chaptei
3. Next, lets see how you can manage youi content with an appioval piocess
called woikow.
2.5 Using Liferays workowwith WCM
Woikowis essentially a piedeteimined sequence of connected steps. ln Lifeiay
WCM, woikow is designed to manage the cieation, modication and publica-
tion of web content. You can set up a woikow so content cant be published
without going thiough an appioval piocess you design. ln this way, content is
published to the site only afei it has been ieviewed and appioved.
2.5. USING LIFERAYS WORKFLOW WITH WCM 49
Lifeiays woikow engine is called Kaleo woikow and it ships with Lifeiay
CE. lf you have uninstalled it oi aie using EE, it needs to be installed and con-
guied sepaiately. Tis is coveied in chaptei . Since we have somewhat of a
What came istthe chicken oi the egg` pioblem, foi now, well assume its
installed and look at how you can take advantage of woikow in geuing youi
content thiough any appioval steps between cieation and publication.
You may have noticed something appeais to be missing fiom the staging
piocess discussed above. ln paiticulai, you might be asking the question, How
do l ieject changes` Staiting with Lifeiay .1, Staging is integiated with Lif-
eiays Woikow engine. To have a ieview piocess foi staged pages, you need
to make suie you have a woikow engine conguied and you have staging set
up in the woikow. To do this, select the woikow denition desiied foi page
ievisions in the Woikow Conguiation.
When using a woikow, clicking Submit for Publication submits the staged
pages into the woikow. Once all necessaiy appiovals have been completed,
the page status is maiked as ieady foi publication. Te Publish to Live Now and
Schedule for Publication options publish the last veision of the selected pages
maiked as ieady foi publication.
To enable woikow foi Web Content, navigate to the Contiol Panel and
select Workow Conguration. liom theie, select a woikow that has been de-
ployed to Lifeiay.
Figure 2.21: Enabling Workowfor Content Management
As youll discovei in chaptei 10, you can design woikows to suit youi oiga-
nizations appioval piocess. loi Nose-steis implementation well use the Single
Approver woikow which ships with the pioduct.
0 CHAPTER 2. WEB CONTENT MANAGEMENT
Dening Workows for Web Content
Lets set up Lifeiays Woikow foi the Nose-stei web site. You must have the
Kaleo woikow plugin installed in oidei foi the woikow categoiies to appeai
in the Contiol Panel. Lifeiays Kaleo woikow engine ships with CE veisions
of Lifeiay. loi installation instiuctions foi Lifeiay EE, please see chaptei 10.
1. Go to the Contiol Panel and select Workow Conguration fiom the lef
panel.
2. liom the select box, choose Single Approver foi Web Content. Click Save.
Note that you can add woikow to many of Lifeiays poitlets.
Tats all it takes to set up woikow foi web content. Now that woikow is
enabled, publishing content woiks a liule bit dieiently. Lets go thiough the
piocess of publishing details foi new class oeiings at Nose-stei. Retuin to the
home page and click the Add Web Content icon on the Web Content Display
poitlet. Call the new content Course Oerings and entei some content. Notice
that the Publish buuon is now gone. ln its place is a Submit for Publication
buuon. Go ahead and click it.
Next, go to the WorkowTasks in Contiol Panel and then select My Workow
Tasks. You will see the option to Review Content foi Sales Goals. lt shows be-
cause you aie logged in as an Administiatoi. Teie is also a Content Appioveis
iole which is dened by this woikow and anyone in this iole can appiove con-
tent as well.
To appiove the content, you must ist take owneiship of it. Click on the
task. You should see the scieen below.
Taking owneiship of, ieviewing and appioving content is veiy easy
1. Click the Assign to Me buuon. Alteinatively, you could assign it to some-
one else in the Content Appioveis iole oi cieate / update a due date foi the
contents appioval.
2. Once youve assigned it to youiself, buuons allowing you to appiove oi ieject
the content appeai. Click Approve.
3. Youie asked to submit a comment. Youd have to do this foi eithei Approve
oi Reject. Add a comment and click Save.
4. Te content is now appioved.
2.6. SUMMARY 1
ln a ieal woild situation, you obviously wouldnt want the peison who cie-
ated the content to be the one who appioves it. lnstead, you would have one oi
moie ioles designed foi useis who will be cieating content and you would have
specic useis assigned to one oi moie ioles foi appioving content. Oui exam-
ple was of a veiy stiaightfoiwaid woikow, as it has only a single appiovei.
Kaleo woikow allows you to design woikows that go thiough as many steps
as you need to confoim to youi business piocesses. We look at Kaleo woikow
in moie detail in chaptei .
2.6 Summary
Tis chaptei has piovided an intioduction to Lifeiay Web Content Management.
Weve seen how to cieate and manage pages within a site in Lifeiay. Weve also
seen howeasy it is to cieate and edit web content using Lifeiays iich WYSlWYG
editoi. Tis poweiful tool enables useis who dont have much expeiience with
HTML and CSS to easily cieate and style web content of any type that youd
like to publish on the web.
Lifeiay WCM also includes a poweiful woikow engine, allowing you to set
up custom publishing iules to t youi oiganization. You can set up custom ap-
pioval piocesses foi dieient sites as well as foi dieient kinds of content within
a site. Well examine sites in moie detail in chaptei 3. Well also covei some
moie advanced web content management tools such as web content stiuctuies
and templates, page templates and site templates, staging, and mobile device
iules.
Cu~v1rv 3
Auv~Ncru Wrn CoN1rN1 M~N~crxrN1
ln the pievious chaptei we looked at some basic ways you can use Lifeiay to
handle youi web content. ln this chaptei well delve deepei into slightly moie
complex web content management techniques. But dont be alaimed, its not
too intense. Well covei the following topics
Web content stiuctuies and templates
Leveiaging Lifeiays multi-site capabilities
Using page templates and site templates
Allowing useis to customize site pages
Staging
Cieating teams to allow foi exible management of site peimissions
Mobile device iules
Well examine how web content stiuctuies and templates piovide additional
powei and exibility to the web content management system we saw in chaptei
2. Youll also leain how easy it is to set up and administei multiple sites in
Lifeiay. Next, well leain how you can empowei youi useis to cieate peisonal
2
3.1. ADVANCED CONTENT WITH STRUCTURES AND TEMPLATES 3
customizations of site pages. Well also examine how you can use staging to
manage the publication of pages and content on youi site. Well conclude with
sections on cieating teams and iules foi piesenting site pages to mobile devices.
Once nished with this chaptei, youll be the envy of youi peeis as theyll think
you ieally know what youie doing.
3.1 Advanced content with structures and templates
lf youve evei launched a web site, you know that as it giows, you can expe-
iience giowing pains. Tis is the case especially if youve given lots of people
access to the site to make whatevei changes they need to make. Without pie-
set limitations, useis can display content in any oidei and in any mannei they
desiie (think huge, ashing leueis in a font nobody can iead). Content can get
stale, especially if those iesponsible foi it dont maintain it like they should.
And sometimes, content is published that should nevei have seen the light of
day.
Tankfully, Lifeiay WCM helps you handle all of those situations. You can
use Structures to dene which elds aie available to useis when they cieate con-
tent. Tese can be coupled with Templates that dene how to display that con-
tent. Content wont get stale, because you can take advantage of the Scheduling
featuie to deteimine when content is displayed and when its iemoved. Addi-
tionally, you can conguie Lifeiays built-in Workow systemto set up a ieview
and publishing piocess so only what you want winds up on the live site. Lif-
eiay Poital gives you the management tools you need to iun eveiything fiom a
simple, one-page web site to an enoimous, content-iich site.
All of this staits with stiuctuies.
Using structures
Stiuctuies aie the foundation foi web content. Tey deteimine which elds
aie available to useis as they cieate new items foi display. Stiuctuies not only
impiove manageability foi the administiatoi, they also make it much easiei foi
useis to quickly add content.
loi example, say youie managing an online news magazine. All youi aiti-
cles need to contain the same types of infoimation a title, a subtitle, an authoi
and one oi moie pages of text and images that compiise the body of the aiti-
cle. lf Lifeiay only suppoited simple content as has been desciibed above, youd
have no way to make suie youi useis enteied a title, subtitle, and authoi. You
might also get aiticles that dont match the look and feel of youi site. lf titles aie
4 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
supposed to be navy blue but they come in fiom youi wiiteis manually set to
light blue, you need to spend time iefoimauing them befoie they aie published.
Stiuctuies give you the ability to piovide a foimat foi youi content so youi
useis know what needs to be enteied to have a complete aiticle. Using stiuc-
tuies, you can piovide a foim foi youi useis which spells out exactly what is
iequiied and can be foimaued automatically using a template.
You cieate a stiuctuie by adding foim contiols such as text elds, text boxes,
text aieas (HTML), check boxes, select boxes and multi-selection lists. Also you
can add specialized, Lifeiay-specic application elds such as lmage Uploadei
and Documents and Media iight onto the stiuctuie. luitheimoie, you can move
the elements aiound by diagging them wheie you want them. Tis makes it
easy foi you to piototype dieient oideis foi youi input elds. Additionally,
elements can be giouped togethei into blocks which can then be iepeatable.
Template wiiteis can then wiite a template which loops thiough these blocks
and piesents youi content in innovative ways, such as in sliding navigation bais,
content which sciolls with the usei and moie.
Lets look at how we can cieate and edit stiuctuies thiough the Manage
Stiuctuies inteiface.
Editing a Structure
Go back to the Contiol Panel and select *Web Content* fiomthe content section.
Te ist way to access the Manage Stiuctuies inteiface is simply by clicking
Manage Structures. Tis opens a popup showing all the web content stiuc-
tuies that exist in youi cuiiently selected scope. Heie, you can add new web
content stiuctuies, edit existing ones, manage the templates associated with
a stiuctuie, edit the peimissions of a stiuctuie, and copy oi delete stiuctuies.
Copying web content stiuctuies can be useful if youd like to cieate a new web
content stiuctuie thats similai to an existing one, but you dont want to stait
fiom sciatch. Lifeiay geneiates a unique poital lD foi the copied stiuctuie, but
eveiy othei auiibute of the copied stiuctuie, including the name, is the same
as that of the oiiginal. Once youve copied a web content stiuctuie, you should
entei a new name foi it to avoid confusing it with the oiiginal. When you copy
a web content stiuctuie, youll be piompted to choose whethei to copy any de-
tail templates oi list templates associated with the stiuctuie. loi infoimation on
detail templates and list templates, please iefei to chaptei 9 on Dynamic Data
Lists.
Te second way to access the Manage Stiuctuies inteiface is diiectly fiom
the web content aiticle WYSlWYGeditoi. Click Add Basic Web Content fiom
the Web Content page to add anothei piece of content to youi poital. lnstead of
3.1. ADVANCED CONTENT WITH STRUCTURES AND TEMPLATES
Figure 3.1: You can access the Manage Structures interface by clicking
manage Structures fromthe Web Content page of the Control Panel.
going iight foi the content, this time well ist cieate a stiuctuie. To access the
Manage Stiuctuies inteiface, simply click on Select next to the Structure heading
neai the top of the page. To cieate a new stiuctuie in youi chosen scope, simply
click on the Add buuon in the Manage Stiuctuies popup.
lts veiy easy to cieate and edit stiuctuies all you have to do is diag ele-
ments into the stiuctuie and then give them names. loi instance, select the
Checkbox element undei the Form Controls tab and diag it onto the stiuctuie.
You can do the same with any of the elements. To iemove it fiom the stiuctuie,
simply select the Delete icon (black ciicle with X) in the uppei iight coinei of
the element. Take a moment to add, delete and ieaiiange dieient elements.
Lifeiay suppoits the following elements in stiuctuies
FORM FIELDS
Text Field: Used foi items such a titles and headings.
Text Box: Used foi the body of youi content oi long desciiptions.
Text Area (HTML): An aiea that uses a WYSlWYG editoi to enhance the
content.
Chebox: Allows you to add a checkbox onto youi stiuctuie. Template
developeis can use this as a display iule.
Selection List: Allows you to add a select box onto youi stiuctuie.
Multi-selection List: Allows you to add a multi-selection list onto youi
stiuctuie.
APPLICATION FIELDS
Image Uploader: Allows you to add the upload image application into youi
stiuctuie.
CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Documents and Media: Allows you to add the Documents and Media foldei
hieiaichy to youi stiuctuie.
MISCELLANEOUS
Link to Page: lnseits a link to anothei page in the same site.
Selection Break: lnseits a bieak in the content.
Tese foim elements piovide all you need to model any infoimation type
you would want to use as web content. Lifeiay customeis have used stiuctuies
to model eveiything fiom aiticles, to video metadata, to databases of wildlife.
Youie limited only by youi imagination. To ie that imagination, lets look
moie closely at the foim elements.
Editing formelements
When cieating a new stiuctuie, it is essential that you set vaiiable names. Tem-
plate wiiteis can use these vaiiables to iefei to elements on youi foim. lf you
dont set vaiiable names, Lifeiay geneiates iandom vaiiable names, and these
can be dicult foi a template wiitei to follow. loi example, considei a eld
called Author. You might cieate this eld in youi foim but the undeilying vaii-
able name in the stiuctuie might look something like TextField4882. Te
template wiitei needs to cieate maikup foi youi stiuctuie and place the Authoi
eld in a ceitain spot in the maikup. How will he oi she know which eld is
Authoi when theyie all named iandomly`
To solve this pioblem, all you need to do is set a vaiiable name foi each eld
as you add it to youi stiuctuie. Lets do this now. ln youi stiuctuie, add an
element Text Area (HTML) which has the lield Label Instructions. lf we wanted
to give it the vaiiable name Steps, we can do it veiy easily at the bouom of
eveiy foim element is a Variable Name eld. Replace the geneiated name with
the name you want to use. Now youi template wiitei has a vaiiable by which
he oi she can iefei to this eld.
Below each eld is a buuon labeled Edit Options. Tis contains seveial othei
ways to conguie youi elds
Field Type: changes the eld type, in case you diagged the wiong eld type
to this location in the foim.
Field Label: changes the displayed label foi the eld.
Index Type: Choose how you want Lifeiay to index youi eld foi seaich.
You can have it indexed by keywoid, which lteis out common woids such as
and, but, the, and so on, oi you can have it index the full text of the eld. By
default, indexing is tuined o.
Predened Value: Specifying piedened values foi stiuctuie foims is a way
to specify defaults. When a usei cieates a new web content aiticle based on
3.1. ADVANCED CONTENT WITH STRUCTURES AND TEMPLATES
a stiuctuie that has piedened values foi vaiious elds, the piedened values
appeai in the foim as defaults foi those elds.
Instructions for the User: Check this box and type a desciiption of what the
eld is foi to display it as a tooltip foi the usei.
Repeatable: lf you want this eld to be a iepeatable element, check this box.
Youi useis can then add as many copies of this eld as they like. loi example,
if youie cieating a stiuctuie foi aiticles, you might want a iepeatable Authoi
eld in case you have multiple authois foi a paiticulai aiticle.
Required: Check the box to maik the eld iequiied. lf a eld is iequiied,
useis must entei a value foi it in oidei to submit content using this stiuctuie.
loi the Nose-stei stiuctuie, type something in the Instructions for the User
eld that helps useis know what to put into the Body element (example this
is an HTML Text area for the body of your content). Also enable the Display as
Tooltip box. Now, when useis hovei ovei the Help icon neai youi title, youi
instiuctions aie displayed.
Structure Default Values
Stiuctuie Default Values allow you to cieate one stiuctuie that uses common
data fiom multiple aiticles.
Retuining to oui newspapei scenaiio again, lets say you want all spoits
aiticles to have the same display page (spoits page), the same categoiies, oi the
same set of tags. lnstead of adding them foi each aiticle oi wondeiing if youi
useis aie adding them to eveiy web content, you can add these chaiacteiistics
once foi eveiy spoits aiticle by cieating default values foi the stiuctuie. Teie
aie two ways to edit stiuctuie default values cieating a newstiuctuie oi editing
an existing stiuctuie.
loi a new stiuctuie, you must ist cieate the stiuctuie befoie editing its
default values. Navigate to Web Content in the Contiol Panel and click the
Structures tab, then select the Add Structure buuon. Undei the XML Schema
Denition section of the new stiuctuie foim, use the Add Row buuon to cieate
dieient types of elds foi the stiuctuie. Oi you can use the editoi to cieate the
stiuctuie manually the Launch Editoi buuon allows you to edit the XML foi
the stiuctuie if you wish to do it via code. When you aie done, click Save and
Continue to go to the Stiuctuie Default Values foim.
To edit an existing stiuctuie, go to Web Content in the Contiol Panel and
click the Structures tab to see the stiuctuies list. lind the Actions buuon foi the
desiied stiuctuie and select Edit Default Values fiomthe menu to viewa window
like the one below. Tis foim allows you to manage the stiuctuie seuings.
8 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.2: You can create elds for structure default values via the XML
Schema Denition section of the newstructure form.
Eveiy new web content you cieate with this stiuctuie is pieloaded with the
data you inseited.
As with eveiything else in Lifeiay, you can set peimissions on stiuctuies.
Lets see how youd do that.
Assigning Permissions
Seuing peimissions on stiuctuies is done using the same pioceduie as peimis-
sions eveiywheie else in Lifeiay. Most useis should not have the ability to edit
stiuctuies. Stiuctuies aie coupled with templates, which iequiie some web de-
velopment knowledge to cieate. Tis is why only tiusted developeis should be
able to cieate stiuctuies and templates. Useis, of couise, should be able to view
stiuctuies. Te View peimission enables them to make use of the stiuctuies to
cieate content.
You can giant oi deny peimissions based on Roles and this is the iecom-
mended way to handle peimissions foi stiuctuies.
Now that you undeistand what stiuctuies aie used foi, you need to undei-
stand the othei half of Lifeiays web content management system templates.
Using templates
Developeis cieate templates to display the elements of the stiuctuie in the maikup
they want. Content can then be styled piopeily using CSS, because maikup is
3.1. ADVANCED CONTENT WITH STRUCTURES AND TEMPLATES 9
Figure 3.3: You can edit default values via the Actions button of the
structure form.
0 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.4: ViewPermission for a Structure
geneiated consistently by the template when stiuctuied content is displayed.
ln essence, templates aie sciipts that tell Lifeiay how to display content in the
stiuctuie. Any changes to the stiuctuie iequiie coiiesponding changes to the
template, because new oi deleted elds pioduce eiiois on the page. lf useis
entei content into a stiuctuie, it must have a matching template. Without a
template, the poital has no idea how to display content which has been cieated
using a custom stiuctuie.
Lets look moie closely at the types of templates Lifeiay suppoits.
Template Types (VM, XSL, FTL and CSS)
Lifeiay suppoits templates wiiuen in foui dieient templating languages, to
suppoit the skill sets of the laigest numbei of developeis. Tis incieases the
chances you can jump iight in and use whichevei one youve alieady used be-
foie. lf you havent yet been exposed to any of them, youi best bet is Velocity
oi lieemaikei, as they aie less chauy than XSL and extiemely simple to un-
deistand.
VM (Velocity Macio) Velocity is a sciipting language that lets you mix logic
with HTML. Tis is similai to othei sciipting languages, such as PHP, though
Velocity is much simplei. Because its been in the pioduct the longest, it is
piobably the most widely used language foi templates in Lifeiay WCM. lf you
havent used any of the template languages befoie, we iecommend using Veloc-
ity youll get up to speed the fastest.
XSL (Extensible Style Sheet Language) XSL is used in Lifeiay templates
to tiansfoim the undeilying XML of a stiuctuie into maikup suitable foi the
biowsei. While it may not be as clean and compact as Velocity oi lTL, its
widely used foi tiansfoiming XML into othei foimats and its veiy likely youi
developeis have alieady been exposed to it.
3.1. ADVANCED CONTENT WITH STRUCTURES AND TEMPLATES 1
FTL (lieeMaikei Template Language) lieemaikei is a templating language
which could be consideied a successoi to Velocity, though it is not yet as popu-
lai. lt has some advantages ovei Velocity foi which it saciices some simplicity,
yet it is still easy to use.
CSS (Cascading Style Sheets) You can use CSS if youi stiuctuie is veiy
stiaightfoiwaid and modications aie simple (colois, fonts, layouts, etc.). lf
youi stiuctuie is moie complex, howevei, youll need to use one of the othei
options.
Adding a Template
Lifeiay WCMmakes it easy to cieate stiuctuies, templates and content fiomthe
same inteiface. Lets go thiough the entiie ow of how youd cieate a stiuctuie,
link it to a template and then cieate content using them both. Well use Velocity
foi oui template and well lay out the stiuctuie elds systematically to go along
with the foimat weve dened foi oui content.
1. Go back to the Web Content section of the Contiol Panel and click Add undei
Web Content.
2. Click Select next to the Stiuctuies heading to access the Manage Stiuctuies
inteiface.
3. Add the following elds
lield Type Vaiiable Name
Text title
Text Box abstract
lmage image
Text Aiea body
4. Name the stiuctuie News Article and click Save.
. Back on the Manage Stiuctuies inteiface, click Actions Manage Templates
next to the News Aiticle stiuctuie that you cieated.
. Click add.
2 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.5: Adding Template Interface
3.1. ADVANCED CONTENT WITH STRUCTURES AND TEMPLATES 3
. Entei the name News Article and add a desciiption.
8. Make suie Velocity is selected as the sciipt language (its the default).
9. lf youve wiiuen the sciipt befoiehand, you can select Browse to upload it
fiomyoui machine. Otheiwise, you can click Launch Editor to type the sciipt
diiectly into the small editoi window that appeais.
10. Click Save.
11. Click Back.
12. Select the News Aiticle stiuctuie.
13. On the New Web Content foim, youll see the Title, Abstiact, lmage, and
Body elds that you dened foi the News Aiticle stiuctuie. Te News Aiticle
template should also be selected.
14. Populate the elds and click Publish to publish youi News Aiticle.
Below is the template sciipt foi this stiuctuie. lt is wiiuen in Velocity
#set ($renderUrlMax = $request.get("render-url-maximized"))
#set ($namespace = $request.get("portlet-namespace"))
#set($readmore = $request.get("parameters").get("read_more"))
<h1>$title.getData()</h1>
#if ($readmore)
<p>$abstract.getData()</p>
<p>$body.getData()</p>
#else
<p>
<img src="${image.getData()}" border="0" align="right">
$abstract.getData()</p>
<a href="${renderUrlMax}&${namespace}read_more=true">Read More</a>
#end
Tis template is pieuy small but it actually does quite a bit. liist, a poitlet
URL which maximizes the poitlet is cieated. Once this is done, the template
gets the namespace of the poitlet. Tis is impoitant to avoid URL collisions
with othei URLs that might be on the page.
Afei this, the template auempts to get a iequest paiametei called read_more.
Whethei oi not this was successful is the key to the iest of the sciipt
lf the template got the read_more paiametei, it displays the abstiact and
the body below the title (which is always displayed).
4 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
lf the template didnt get the read_more paiametei, it displays the im-
age, the abstiact and the link cieated above, which sets the read_more
paiametei.
When this template is iendeied, it looks like this
Figure 3.6: Initial View
Figure 3.7: After Clicking Read More
Now that youve cieated a handsome template, its time to decide who the
lucky people aie that get to use it.
Assigning template permissions
Peimissions foi templates aie similai to peimissions foi stiuctuies. As with
stiuctuies, you only want specic developeis editing and cieating templates.
You may, howevei, want to make the templates viewable to some content cie-
atois who undeistand the template sciipting language but aie not diiectly wiit-
ing the sciipts. You can deteimine who views the template by selecting fiom
the Viewable By select box beneath the Permissions tab. By default the Anyone
(Guest Role) is selected.
3.2. LEVERAGING LIFERAYS MULTI-SITE CAPABILITIES
Youll also want to deteimine how useis can inteiact with the template. You
can do this by selecting the More link.
liom the More link, you can giant oi deny peimissions based on Roles. loi
instance, you may cieate a iole with the ability to update the template and cieate
a second iole that can both update and delete. Lifeiay Poital makes it possible
to assign peimissions based on the ioles and iesponsibilities within youi oiga-
nization.
Now that you undeistand the iole stiuctuies and templates play in cieating
web content, lets look at how you can use Lifeiay to manage multiple sites.
3.2 Leveraging Liferays multi-site capabilities
As stated in chaptei 1, a site is a set of pages that can be used to publish content
oi applications. Sites can be independent oi they can be associated with an
oiganization and seive as the website foi that oiganization. With Lifeiay, you
can cieate as many dieient sites as you like within the context of a single poital.
You can use sites in Lifeiay to build many dieient kinds of web sites. Whethei
youie builing a laige coipoiate website, a company intianet, oi a small site de-
signed to facilitate collaboiation among team membeis, Lifeiays fiamewoik
piovides all the tools you need. To suppoit dieient kinds of collaboiation and
social scenaiios, Lifeiays sites piovide thiee membeiship types
Open Useis can become membeis of the site at any time. Useis can join
sites fiom the My Sites poitlet.
Restiicted Useis can iequest site membeiship but site administiatois
must appiove iequests in oidei foi useis to become membeis. Requests
can be made fiom the My Sites poitlet.
Piivate Useis aie not allowed to join the site oi iequest site membeiship.
Piivate sites dont appeai in the My Sites poitlet. Site administiatois can
still manually select useis and assign them as site membeis.
ln addition to these membeiships, when a site is associated with an oigani-
zation, all the useis of that oiganization aie automatically consideied membeis
of the site.
Membeis of a site can be given additional piivileges within the site by using
Lifeiays peimission seuings. lt is also possible to assign dieient ioles within
the site to dieient membeis. Tis can be done thiough site roles which aie
dened equally foi all sites oi teams which aie unique foi each site.
CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Lifeiays sites have two categoiies of pages called page sets. Teie aie two
kinds of page sets public pages and piivate pages. A site can have only public
pages, only piivate pages oi both. Piivate pages can only be accessed by site
membeis. Public pages can be accessed by anyone, including useis who havent
logged in. lts possible to iestiict access to pages at the page set level oi at
the level of individual pages thiough the peimission system. Public pages and
piivate pages have dieient URLs and can have dieient content, applications,
themes, and layouts.
Building a coipoiate lntianet piovides a typical use case foi Lifeiay sites.
A coipoiate lntianet could have sites foi all the oiganizations in the company
Sales, Maiketing, lnfoimation Technology, Human Resouices and so on. But
what about the coipoiate health and tness centei` Tats something eveiy-
body in the company, iegaidless of oiganization, may want to join. Tis makes
it a good candidate foi an open and independent site. Similaily, the home page
foi a coipoiate intianet should piobably be placed in an open independent site
so any membei of the poital can access it.
loi othei kinds of web sites, you may want to use independent sites to biing
people togethei who shaie a common inteiest. lf you weie building a photo
shaiing web site, you might have independent sites based on the types of pho-
tos people want to shaie. loi example, those who enjoy taking pictuies of
landscapes could join a Landscapes site and those who enjoy taking pictuies
of sunsets could join a Sunsets site.
Lifeiay always piovides one default site, which is also known as the main
site of the poital. Tis site does not have its own name but iathei takes the
name of the poital. By default the poital name is liferay.com but this value can
be changed thiough the simple conguiation of the setup wizaid. Te poital
name can also be changed at any time thiough the Contiol Panel within Portal
Seings.

Tip: Piioi to Lifeiay .1, theie weie two ways of cieating sites
oiganizations and communities. Tis has been simplied to pio-
vide moie ease of use and allow foi moie exibility. Te main
iole of oiganizations is still to oiganize the useis of the poital in
a hieiaichy, but they can also have associated sites. Communi-
ties can still be cieated thiough independent sites, but the new
name ieects the fact that sites can be used foi many dieient
puiposes besides communities.
Sites can be cieated thiough the Contiol Panel by a poital administiatoi. To
3.2. LEVERAGING LIFERAYS MULTI-SITE CAPABILITIES
add a site, click on Sites undei the Poital section of the Contiol Panel and then
click Add. lf theie is at least one site template available, a diopdown menu ap-
peais. Site templates piovide a pieconguied set of pages, poitlet applications,
and content that can be used as the basis of a sites public oi piivate page set. To
cieate a site fiom sciatch, select Blank Site. Otheiwise, select the name of the
site template youd like to use. lf you opt to cieate a site fiom a site template,
you have to choose whethei to copy the site templates pages as youi new sites
public oi piivate page set. lf othei site templates aie cieated, they will appeai in
the Add menu as they become available. Te following guie shows the foim
that needs to be lled when cieating a Blank Site.
Te following guie shows the foim that needs to be lled when cieating a
Blank Site.
Figure 3.8: Adding a Site
Name: is the name of the site you wish to cieate.
Description: desciibes the sites intended function.
Membership Type: can be open, iestiicted oi piivate. An open site appeais
in the My Sites poitlet and useis can join and leave the site whenevei they
want. A iestiicted site is the same except useis must iequest membeiship. A
site administiatoi must then explicitly giant oi deny useis iequests to join. A
piivate site does not appeai in the My Sites poitlet and useis must be added to
it manually by a site administiatoi.
8 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Active: deteimines whethei a site is active oi inactive. lnactive sites aie
inaccessible but can be activated whenevei a site administiatoi wishes.
Once youve cieated a site, it appeais in the Sites page of the Contiol Panel.
Once the site has been cieated you can specify moie details about the site using
thiee categoiies Basic lnfoimation, Seaich Engine Optimization and Advanced.
Figure 3.9: Editing a Site
Details: lets you edit the infoimation you enteied when you cieated the
3.3. USING SITE TEMPLATES 9
site and allows you to choose a site template foi the public oi piivate pages of
youi site. lf you select a site template, leave the Enable propagation of changes
from the site template box checked to automatically update youi site if the as-
sociated site template changes. Te update will only be done to pages which
have not been changed within the specic site. lf you uncheck this box but
iecheck it latei, the template pages aie then ieapplied to youi site, oveiwiiting
any changes that may have been made. Only useis who have the peimission
Unlink Site Template will be able to disable the piopagation of changes. When
the piopagation is enabled, the site template might pievent modication of some
oi all pages to ensuie the piopagation occuis.
Categorization: allows you to apply categoiies and tags to the site.
Site URL: lets you set fiiendly URLs and viitual hosts foi youi web site.
Site Template: piovides additional infoimation about the site template as-
sociated to the pages of the site (if any).
Sitemap: lets you use the sitemap piotocol to notify seaich engines youi web
site is available foi ciawling.
Robots: lets you use a robots.txt le to specify ceitain pages and links
you dont want to be indexed by seaich engines. You need to set a viitual host
befoie you set a robots.txt le.
Staging: lets you tuin on eithei Local Live staging oi Remote Live staging.
To enable staging, the Enable propagation of changes from the site template box
on the Details tab must be unchecked. With staging enabled, changes to the
site template aie automatically piopagated to the staged site, not to the live site.
Te changes still must be appioved befoie the site is published to live.
Analytics: lets you set a Google Analytics lD that is used foi youi site.
When cieating a site fiom a site template, the initial foim piovides a new
option that lets you decide if you want to copy the pages fiom the template as
public pages oi as piivate pages. By default, the site is linked to the site template
and changes to the site template piopagate to any site based on it. A checkbox
appeais that allows useis to unlink the site template if the usei has peimission
to do so.
Site templates aie veiy poweiful foi managing many similiai sites. Lets
examine how they woik.
3.3 Using site templates
Site Templates can be administeied fiom the Contiol Panel. Tey allow poital
administiatois to cieate multiple sites with the same default set of pages and
content. Site templates can contain multiple pages, each with its own theme,
0 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.10: When creating a site froma site template, you need to choose
whether the site template should be copied into the sites public pages or
private pages.
3.3. USING SITE TEMPLATES 1
layout template, poitlets, and poitlet conguiations. Site templates can also
contain content just like actual sites. Tis allows administiatois to use site tem-
plates to cieate new sites that aie each cieated with the same default pages,
poitlets, and content. Afei theyve been cieated, these sites and theii pages
can be modied by site administiatois. Using site templates can save site ad-
ministiatois a lot of woik even if each site that was cieated fiom a given site
template ends up being veiy dieient.
To get staited, click on Site Templates in the Poital section of the Contiol
Panel. Heie, you can add, manage, oi delete site templates. You can also con-
guie the peimissions of site templates. As long as a site is linked to the site
template it was cieated fiom, changes to the site templates pages, poitlets, and
poitlet conguiations aie piopagated to the site. Changes to a site templates
content, howevei, aie not piopagated to existing sites that aie linked to the site
template. We discuss the piopagation of changes between site templates and
sites in moie detail in the section on site templates use cases below.
To manage the pages of a site template, click on Site Templates in the Contiol
Panel and then click Actions Manage Pages. liomheie, you can add oi iemove
pages fiom a site template oi select themes and layout templates to apply to the
site template. Click on a specic page if youd like to select a dieient theme
oi layout template foi that page. To edit the pages themselves, click Actions
View Pages. You can add specic poitlets to each page of a site template and
conguie the piefeiences of each poitlet. Each page can have any theme, any
layout template, and any numbei of poitlet applications, just like a page of a
iegulai site. As with site pages, you can oiganize the pages of a site template
into hieiaichies. When you cieate a site using a site template, the conguiation
of pages and poitlets is copied fiom the template to the site. By default, all
changes made to the site template aie automatically copied to sites based on
that template.

Tip: lf you want to publish a piece of web


content to many sites and ensuie modications
aie applied to all, dont use site template con-
tent foi that puipose. lnstead, place the con-
tent in the global scope and then iefeience it
fiom a Web Content Display application in each
site.
By default, the following site templates aie piovided
2 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Community Site: Piovides a pieconguied site foi building online com-
munities. Te home of a community site piovides message boaids, seaich,
a display of a poll, and statistics of the activity of community membeis.
Te site is also cieated with a page foi a community calendai and a page
foi a wiki.
Intranet Site: Piovides a pieconguied site foi an intianet. Te Home
page displays the activities of the membeis of the site, seaich, a language
choosei and a list of the iecent content cieated in the intianet. lt also pio-
vides 3 additional pages foi Documents and Media, Calendar and exteinal
News obtained thiough public feeds.
liguie 3.11 displays the foim shown when editing the Community Site tem-
plate
To view and manage the pages of a site template, click the Open site template
link. Tis opens the template in a new biowsei window (oi tab) and it can be
navigated oi managed like a iegulai site.
Site Templates Example
Suppose we need to cieate the following thiee sites foi Nose-steis inteinal use
Engineeiing, Maiketing, and Legal. Tese should be piivate sites that aie only
accessible to membeis of these iespective depaitments. We could design each
site sepaiately but can save ouiselves some woik if we cieate a site template to
use instead.
To cieate a site template, navigate to the Contiol Panel and click Site Tem-
plates. Ten click Add and entei a name foi youi template well use Depart-
ment foi oui example. Leave the Active and Allow Site Administrators to Mod-
ify the Pages Associated with is Site Template boxes checked. Te Active box
must be checked foi youi template to be usable. lf youi template is still a woik
in piogiess, you can uncheck it to ensuie that no one uses it until its ieady.
Checking Allow Site Administrators to Modify the Pages Associated with is Site
Template allows site administiatois to modify oi iemove the pages and poitlets
that the template intioduces to theii sitesif you want the templates to be com-
pletely static, you should uncheck this.
liom the list of site templates, click on the Department site template that
you cieated. Ten click on the Open site template link to begin adding pages and
poitlets and conguiing the layouts. When you click this link, the site template
opens in a new biowsei tab oi window. loi oui example, we would like oui site
template to include foui pages. liist, wed like a Home page with the Activities,
3.3. USING SITE TEMPLATES 3
Figure 3.11: Site Templates
Announcements, and Calendai poitlets. Next, wed like a Documents and Media
page with the Documents and Media poitlet. linally, we should cieate a Wiki
page with the Wiki and Tag Cloud poitlets and a Message Boaids page with
the Message Boaids and Tag Cloud poitlets. When youie done cieating and
conguiing the pages of youi site template, just close the biowsei tab oi window
that opened when you clicked Open site template. Changes to site templates aie
automatically saved as you make them, so you dont need to ietuin to the Site
Templates page of the Contiol Panel and select Save.
Next, lets use oui site template to cieate oui Engineeiing, Maiketing and
Legal sites. Go to the Contiol Panel and click on Sites. Ten click Add De-
partment. Entei *Engineeiing* foi the site name and set the Membeiship Type
4 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.12: You can see the name of the site template youre currently
editing
to Private. Recall that piivate sites dont appeai in the My Sites poitlet so that
iegulai poital useis wont even know that the Engineeiing site exists. Also, the
only way useis can be added to a piivate site is via an invitation fiom a site
administiatoi. Leave the Active box checked so that youi site can be used im-
mediately. Select the Copy as Private Pages option since oui Engineeiing site
is intended foi inteinal use only. Leave the Enable propagation of changes from
the site template box checked so that the Engineeiing site ieceives updates if
the Depaitment site template is modied. linally, click Save to cieate youi the
Engineeiing site.
Repeat these steps to cieate the Maiketing and Legal sites. Te new sites
have all the pages and poitlets you cieated in the site template. To view the
pages of the new sites, click on Sites in the Contiol Panel and then click on
Actions Go to Private Pages next to one of youi new sites. Using site tem-
plates stieamlines the site cieation piocess foi administiatois, making it easy
to cieate sites quickly. Now each Nose-stei depaitment has its own calendai,
documents and media libiaiy, wiki, and message boaids application. Although
the pages and poitlets of each depaitments site aie the same, each site will
quickly be lled with depaitment-specic infoimation as useis add and shaie
content within the sites. Also, site administiatois can add new pages, poitlets,
and content to theii sites, fuithei dieientiating each depaitments site fiom
the otheis.
Propagating changes fromsite templates to sites
lts possible foi site template administiatois to add, update, oi delete site tem-
plate pages. Changes made to a site template can be piopagated to sites whose
pages sets aie linked to the site template. Such a link is cieated when you cieate
a site based on a site template and leave the Enable propagation of changes from
the site template box checked. To disable oi ie-enable this link foi a site, select
the site in the Contiol Panels context menu selectoi. Ten click on Site Seings
3.3. USING SITE TEMPLATES
and uncheck oi iecheck the Enable propagation of changes from the site template
checkbox. You can can also access the Site Seuings inteiface via the Dockbai
by clicking Manage Site Seings. ln this section, we explain the piopagation
of changes fiom site templates to sites and discuss the options available to site
administiatois and site template administiatois.
lf a sites page set has been cieated fiom a site template and the piopagation
of changes fiom the site template is enabled, site administiatois can add new
pages but cannot iemove oi ieoidei the pages impoited fiom the site template.
lf a site has both pages impoited fiom a site template and custom site pages,
the site template pages always appeai ist, custom pages added by site admin-
istiatois appeai afei the site template pages. Only site template administiatois
can iemove, ieoidei, oi add site template pages. Site administiatois can add oi
iemove custom site pages. Tey can also ieoidei custom site pages as long as
theyie all positioned afei the site template pages. Site template administiatois
cannot add, iemove, oi ieoidei custom site pages.
lf a site administiatoi changes a page that was impoited fiom a site template
and iefieshes the page, the following message appeais
Tis page has been changed since the last update fiom the site template. No
fuithei updates fiom the site template will be applied. Click Reset to oveiwiite
the changes and ieceive updates fiom the site template.
lf the site administiatoi clicks the Reset buuon, changes aie piopagated fiom
the site template to all the pages of the site that weie impoited fiomthe site tem-
plate. Clicking the *Reset* buuon makes two kinds of updates. liist, changes
made by site administiatois to pages that weie impoited fiom the site template
aie undone. Second, changes made by site template administiatois to site tem-
plate pages aie applied to the site pages.
Site template administiatois can set piefeiences foi poitlets on site template
pages. When a poital administiatoi cieates a site fiom a site template, the poit-
let piefeiences aie copied fiom the site templates poitlets, oveiiiding any de-
fault poitlet piefeiences. When meiging site template and site changes, e.g.,
when ieseuing, poitlet piefeiences aie copied fiom site template poitlets to
site poitlets. Only global poitlet piefeiences oi local poitlet piefeiences which
dont iefei to lDs aie oveiwiiuen.
Site administiatois can also add data to site template poitlets. loi example,
site template administiatois can add the Wiki poitlet to a site template page
and use the Wiki to cieate lots of aiticles. When a poital administiatoi cieates
a site fiom a site template, data is copied fiom the site templates poitlets to the
sites poitlets. Te piefeiences of the sites poitlets aie updated with the lDs of
the copied data. loi example, if a site is cieated fiom a site template that has a
Wiki poitlet with lots of wiki aiticles, the wiki aiticles aie copied fiom the site
CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
templates scope to the sites scope and sites Wiki poitlet is updated with the
lDs of the copied wiki aiticles. Poitlet data is only copied fiom a site template
to a site when the site is ist cieated, data is not copied copied duiing a site
ieset.
Now that weve leained how site templates woik, lets discuss how to use
page templates.
3.4 Using page templates
Click on Page Templates in the Contiol Panel to see a list of page templates.
Page templates function similaily to site templates but at the page level. Each
page template piovides a pie-conguied page to ieuse. Within a page template,
its possible to select a theme, a layout template, to add poitlets to the page and
to conguie poitlet piefeiences. Both sites and site templates can utilize page
templates foi cieating new pages.
You can edit oi delete existing page templates, conguie theii peimissions,
oi add new page templates. By default thiee sample page templates aie pio-
vided
Blog: piovides a page with thiee applications ielated to blogging. lt has
two columns the main lef column contains the blogs poitlet and the
small iight column piovides two side poitlets, Tag Cloud and Recent Blog-
geis. Te tag cloud application shows the tags used within the site and
allows navigating thiough the blog entiies shown in the main blogs poit-
let.
Content Display Page: piovides a page pieconguied to display content.
lt has thiee auxiliaiy applications (Tags Navigation, Categoiies Naviga-
tion, and Seaich) and an Asset Publishei. Te most signicant aspect of
this page is that the Asset Publishei is pieconguied to be display any
web content associated with this page. Tis means that you can select
any page cieated fiom this page template as a Display Page foi a web
content aiticle. You can choose a display page foi a web content aiticle
when cieating a new web content aiticle oi when editing an existing one.
When you cieate a new web content aiticle, a unique (canonical) URL foi
the web content pointing to this page will be assigned to it.
Wiki: piovides a page with thiee applications ielated to authoiing a wiki.
lt also has two columns, the main lef column with the wiki application
3.4. USING PAGE TEMPLATES
Figure 3.13: Page Templates
and two iight side poitlets to allow navigating thiough pages by tags and
categoiies.
To add a new page template, click the Add buuon. Ten entei a name and
desciiption foi youi template. Leave the Active buuon checked. Click Save and
then identify youi page template in the list. Click its name oi use the Actions
buuon to edit the page template. Te Open Page Template link opens a new
biowsei window which you can use to conguie youi new page. Any changes
you make aie automatically saved so you can close the new biowsei window
once youie done.
8 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Note that afei a newpage template has been cieated the default peimissions
aie to only allowthe cieatoi to use the page template. To give othei useis access
to it, use the actions menu in the list of templates and choose Permissions. Once
you see the matiix of ioles and peimissions, check the View peimission foi
the iole oi ioles needed to see the page template in the list of available page
templates when cieating a new page. lf you want any usei who can cieate a
page to be able to use the page template, just check the View peimission foi the
User iole.
Figure 3.14: Selecting a Page Template
To use youi template to cieate a newpage, just navigate to a page ovei which
you have site administiatoi piivileges and select Add Page fiom the Dock-
bai. Youll be able to select a page template and type a name foi the new page.
Alteinatively, you can use the Contiol Panel. liist, in the context selectoi menu,
select the site to which youd like to add a page and then click on the Site Pages
link. Ten click the Add Page buuon, type a name, select youi template fiom
the diop down menu and click Add Page to nish.
Note that by default, when a site administiatoi cieates pages based on a page
template, any futuie changes to the template aie automatically piopagated to
those pages. Site administiatois can disable this behavioi by unchecking the
Automatically apply changes done to the page template box.
lf staging has been enabled, changes to the page template aie automatically
piopagated to the staged page. Tese changes still need to be appioved befoie
the page is published to live. loi this ieason, the automatic piopagation of page
template changes to the staged page cannot be tuined o and the Automatically
3.4. USING PAGE TEMPLATES 9
Figure 3.15: Choosing whether or not to automatically apply page
template changes to live pages
apply changes done to the page template checkbox does not appeai.
Well discuss staging in moie detail latei in this chaptei. loi now lets look
at impoiting and expoiting templates.
Exporting and Importing Site Templates and Page Templates
lf you want to expoit a site that uses site oi page Templates to a dieient en-
viionment (tiough a LAR le oi iemote publication), the Templates must be
expoited and impoited manually in advance oi the impoit will fail.
To expoit a Site using a Site Template, use the following piocess 1. Go to
Contiol Panel Site Templates and click Actions Manage Pages foi the
Site Template youi site is using. 2. Click Export to obtain a LAR le with the
content of the Site Template. Be suie to choose the applications and data you
want expoited. 3. ln youi taiget enviionment, go to Contiol Panel Site
Templates and cieate a new Site Template. 4. Click Actions Manage Pages
foi that Site Template and then click Import. . Upload the LAR le containing
youi site templates content.
Now the site can be expoited and impoited noimally to this new enviion-
ment.
loi page templates, the piocess veiy similai 1. Go to Contiol Panel Page
Templates. 2. Next to the page template you would like to expoit, click Actions
Expoit. Tis pioduces a LAR le you can impoit latei. 3. On the taiget
80 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
enviionment, go to Contiol Panel Page Templates and cieate a new Page
Template. 4. Next to the new template, click Actions lmpoit. . Upload the
LAR le containing the expoited page template fiom step 3.
Te page template can now be impoited noimally to this new enviionment.
Next, lets examine the tools Lifeiay piovides foi handling tianslations.
Localization
Pievious veisions of Lifeiay had the ability to cieate and manage dieient tians-
lations of youi web content but with Lifeiay .1 weve added seveial impiove-
ments.
When you cieate a newpiece of Web Content, you have the ability to choose
a default language. lf you click Change, you can select youi default language
fiom a laige numbei of languages Lifeiay suppoits. Befoie you can cieate a
tianslation, you must nish cieating the content in youi default language and
save it. Once youve done that, editing the content piovides you with the option
to Add Translation.
Afei you click Add Translation, you can select a language by sciolling thiough
the list oi by enteiing the language you want to use in the seaich box. When
you select a language, a lightbox opens within youi biowsei window enabling
you to easily compaie the oiiginal with the new tianslation. Once you aie done
with the tianslation, click Save and the tianslation is added to the list of Avail-
able Translations.
Te ability to completely delete a tianslation in one step has also been added.
lnstead of simply disabling a tianslation oi having to go thiough a multistep
piocess to iemove it, you can now simply open the tianslation you dont want
and click Remove Translation.
When you cieate a new web content stiuctuie, each eld you cieate has
a Localizable checkbox displayed next to it. Tis enables you to contiol what
can and cant be changed in the tianslation piocess. loi example, if you dont
want images oi content titles to be changed when the content is tianslated,
you can make suie those elds aient listed as localizable. When you follow
the steps above to localize content, only elds within the stiuctuie that had
the Localizable box checked appeai within the tianslation window.Next, well
discuss how to let useis customize theii site pages.
3.4. USING PAGE TEMPLATES 81
Figure 3.16: Adding a translation
82 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.17: Adding a translation
3.5. ALLOWING USERS TO CUSTOMIZE SITE PAGES 83
3.5 Allowing users to customize site pages
As we discussed befoie, as youi site becomes laigei and moie complex, man-
agement of the content becomes moie challenging. Weve gone ovei Lifeiay
management tools that help you cieate content quickly and in an oideily fash-
ion. You cieated a simple announcement with Lifeiays stiuctuie editoi that
allows you to quickly design a stiuctuie and piepaie it foi the template design-
eis. Ten you applied a template to the stiuctuie. You know how to display
content using the Web Content Display poitlet. Now, youie ieady to take ad-
vantage of Lifeiays advanced publishing options.
lf a web site isnt piopeily managed, it can quickly become stale and that
diives vieweis away. lf people aie nding youi site because of seaich engines,
you dont want them piesented with outdated (and possibly inaccuiate) web
content.
You also want youi content to be found easily by youi useis. Tis is done
thiough tags and categoiies.
Additionally, you may want to cieate content and send it thiough an ap-
pioval and ieviewal piocess weeks befoie you want it displayed on the web
site. Lifeiay gives you this exibility with the Schedule and Workow featuies.
Scheduling Web Content
Lifeiays WCM lets you dene when youi content goes live. You can deteimine
when the content is displayed, expiied and/oi ieviewed. Tis is an excellent
way to keep youi site cuiient and fiee fiom outdated (and peihaps incoiiect)
infoimation. Te schedulei is built iight into the foim youi useis access to add
web content, in the same column as the stiuctuie and template selectois.
Display Date: Sets (within a minute) when content will be displayed.
Expiration Date: Sets a date to expiie the content. Te default is one yeai.
Never Auto Expire: Sets youi content to nevei expiie.
Review Date: Sets a content ieview date.
Never Review: Sets the content to nevei be ieviewed.
As you can see, the scheduling featuie in Lifeiay Poital gives you gieat con-
tiol in managing when, and foi how long, youi web content is displayed on
youi web site. Additionally, you have the ability to deteimine when youi con-
tent should be ieviewed foi accuiacy and/oi ielevance. Tis makes it possible
to manage youi giowing inventoiy of content.
Similai to scheduling, Lifeiays staging featuie also allows you to manipulate
time, in a mannei of speaking.
84 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.18: Schedule for Publishing Content
3.6 Staging page publication
Staging is an impoitant featuie of Lifeiay WCM. Te concept of staging is a
simple one you can modify youi site behind the scenes and then publish all
youi updates in one shot. You dont want useis seeing youi web site change
befoie theii eyes as youie modifying it, do you` Lifeiays staging enviionment
allows you to make changes to youi site in a specialized *staging aiea*. When
youie nished, you can publish all youi site changes at once.
Lifeiay piovides site administiatois with two dieient ways to set up stag-
ing Local Live and Remote Live. With Local Live staging, both youi staging
enviionment and youi live enviionment aie hosted on the same seivei. When
Local Live staging is enabled foi a site, a clone of the site is cieated containing
copies of all of the sites existing pages. Poitlet data is also copied, depending
on which poitlets aie selected when staging is enabled. Te cloned site becomes
the staging enviionment and the oiiginal site becomes the live enviionment.
When Remote Live staging is enabled foi a site, a connection is established
between the cuiient site and anothei site on a iemote Lifeiay seivei. Te ie-
mote site becomes the live enviionment and the cuiient site becomes the stag-
ing enviionmentan instance of Lifeiay Poital used solely foi staging. Content
cieatois can use the staging seivei to make theii changes while the live seivei
handles the incoming usei tiac. When changes to the site aie ieady to be pub-
lished, they aie pushed ovei the netwoik to the live seivei. Whethei you enable
Local Live oi Remote Live staging, the inteiface foi managing and publishing
staged pages is the same.
3.6. STAGING PAGE PUBLICATION 8
So when should you use Local Live staging and when should you use Re-
mote Live Staging` Local Live staging allows you to publish site changes veiy
quickly, since the staged and live enviionments aie on the same seivei. lts also
easiei to switch between the staged and live enviionments using Local Live
staging. Howevei, since the staged content is stoied in the same database as
the pioduction content, the content isnt as well piotected oi backed up as with
Remote Live staging. Also, you cant install new veisions of poitlets foi testing
puiposes in a Local Live staging enviionment since only one veision of a poitlet
can be installed at any given time on a single Lifeiay seivei.
With Remote Live staging, youi staging and live enviionments aie hosted on
sepaiate seiveis. Tis allows you to deploy newveisions of poitlets and content
to youi staging enviionment without woiiying about inteifeiing with youi live
enviionment. With Remote Live staging, you can also use one Lifeiay instance
as the staging seivei foi multiple pioduction seiveis. Howevei, publishing is
slowei with Remote Live than with Local Live since data needs to be tiansfeiied
ovei a netwoik. And, of couise, you need moie haidwaie to iun a sepaiate
staging seivei.
Lifeiay .1 added a featuie to staging called Page Veisioning. Tis featuie
woiks with both Local Live and Remote Live staging and allows site administia-
tois to cieate multiple vaiiations of staged pages. Tis allows to seveial dieient
veisions of sites and pages to be developed at the same time. Vaiiations can be
cieated, meiged, and published using a Git-like veisioning system. Lets jump
in to see how to use staging.
Enabling Local Live staging
Site administiatois can enable Staging foi a site via the Site Seuings Ul. To ieach
this inteiface via the Contiol Panel, select a site in the context menu selectoi,
click on *Site Seuings* in the Contiol Panel menu, then click on *Staging* at
the lef. Undei Staging Type, select eithei *Local Live* oi *Remote Live* and
additional options appeai. Staging allows changes to be made in a staging en-
viionment so that woik can be ieviewed, possibly using a woikow, befoie its
published to a live site. Enabling Local Live staging is easy. Just select *Local
Live* and decide whethei youd like to enable page veisioning. You can enable
page veisioning on a sites public pages, piivate pages, both, oi neithei. Page
veisioning allows you to woik in paiallel on dieient veisions of pages and
maintains a histoiy of all page modications. We discuss page veisioning in
moie detail below.
8 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Enabling Remote Live staging
When you enable Remote Live staging, the iemote site becomes the live enviion-
ment and the cuiient site becomes the staging enviionment. Te iemote (live)
Lifeiay seivei and the local (staging) Lifeiay seivei should be completely sepa-
iate systems. Tey should not, foi example, shaie the same the database. When
Remote Live staging is enabled, all the necessaiy infoimation is tiansfeiied ovei
the netwoik connecting the two seiveis. Befoie a site administiatoi can enable
Remote Live staging foi a site, the iemote Lifeiay seivei must ist be added to
the cuiient Lifeiay seiveis list of allowed seiveis. Te cuiient Lifeiay seivei
must also be added to the iemote Lifeiay seiveis list of allowed seiveis. You
can make these conguiations in youi Lifeiay seiveis portal-ext.proper-
ties les. Youi ist step should be to add the following lines to youi cuiient
Lifeiay seiveis portal-ext.properties le
tunnel.servlet.hosts.allowed=127.0.0.1,SERVER_IP,[Remote server IP address]
axis.servlet.hosts.allowed=127.0.0.1,SERVER_IP,192.168.0.16,[Remote server IP address]
Ten add the following lines to youi iemote Lifeiay seiveis portal-ext.pro-
perties le
tunnel.servlet.hosts.allowed=127.0.0.1,SERVER_IP,[Local server IP address]
axis.servlet.hosts.allowed=127.0.0.1,SERVER_IP,192.168.0.16,[Local server IP address]
Remembei to iestait both Lifeiay seiveis afei making these poital piopei-
ties updates. Afei iestaiting, log back in to youi local Lifeiay poital instance
as a site administiatoi. Ten navigate to the Contiol Panel and choose a site in
the context menu selectoi. Ten click on Site Seings in the Contiol Panel menu
and then on Staging in the menu at the lef. Select Remote Live undei Staging
Type and additional options appeai.
liist, entei youi iemote Lifeiay seiveis lP addiess into the Remote Host/lP
eld. lf the iemote Lifeiay seivei is a clustei, you can set the Remote Host/lP to
the load balanced lP addiess of the clustei in oidei to inciease the availability
of the publishing piocess. Next, entei the poit on which the iemote Lifeiay
instance is iunning into the Remote Poit eld. You only need to entei a Remote
Path Context if a non-ioot poital seivlet context is being used on the iemote
Lifeiay seivei. linally, entei the site lD of the site on the iemote Lifeiay seivei
that will be used foi the Live enviionment. lf a site hasnt alieady been piepaied
foi you on the iemote Lifeiay seivei, you can log in to the iemote Lifeiay seivei
and cieate a new blank site. Afei the site has been cieated, note the site lD so
you can entei it into the Remote Site lD eld on youi local Lifeiay seivei. You
can nd any sites lD by selecting Actions Edit next to the sites name on
3.6. STAGING PAGE PUBLICATION 8
the Sites page of the Contiol Panel. linally, check the *Use a Secuie Netwoik
Connection* eld to secuie the publication of pages fiom youi local (staging)
Lifeiay seivei to youi iemote (live) Lifeiay seivei.
Tats all you need to do to enable Remote Live Staging' Howevei, when a
usei auempts to publish changes fiom the local (staging) seivei to the iemote
(live) seivei, Lifeiay passes the useis ciedentials to the iemote seivei to peifoim
a peimission check. ln oidei foi a publishing opeiation to succeed, the opeiation
must be peifoimed by a usei that has identical ciedentials and peimissions on
both the local (staging) and the iemote (live) seivei. Tis is tiue iegaidless of
whethei the usei auempts to publish the changes immediately oi auempts to
schedule the publication foi latei. lf only a few useis should have peimission
to publish changes fiom staging to pioduction, its easy enough to cieate a few
usei accounts on the iemote seivei that match a selected fewon the local seivei.
Howevei, the moie usei accounts that you have to cieate, the moie tedious
this job becomes and the moie likely you aie to make a mistake. And you not
only have to cieate identical usei accounts, you also have to ensuie that these
useis have identical peimissions. loi this ieason, we iecommend that you use
LDAP to copy selected usei accounts fiom youi local (staging) Lifeiay seivei
to youi iemote (live) Lifeiay seivei. Lifeiays Viitual LDAP Seivei application
(EE-only), available on Lifeiay Maiketplace, makes this easy.
Example: Enabling Local Live staging
Lets cieate a Local Live staging enviionment foi Nose-steis home page. Befoie
we begin, lets add a newpage. Click Add Page fiomthe toolbai in the default
site and name the new page News and Events. Next, click the View Pages buuon
to navigate to the pages. Ten add the Aleits and Announcements poitlets to
the News and Events page.
When you activate Local Live staging, Lifeiay cieates a clone of youi site.
Tis clone became the staging enviionment. Because of this, we iecommend
only activating staging on new, clean sites. Having a few pages and some
poitlets (like those of the example site weve cieated) is no big deal. Howevei,
if you have alieady cieated a laige amount of content you might not be able to
enable staging on that site. Also, if you intend to use page veisioning to tiack
the histoiy of updates to youi site, we iecommend that you enable it as eaily as
possible, *befoie* youi site has many pages and lots of content. Youi sites up-
date histoiy wont be saved until you enable page veisioning. Page veisioning
iequiies staging (eithei Local Live oi Remote Live) to be enabled.
Now weie ieady to activate staging foi this site. Go to the Contiol Panel
then to Site Seings and select Staging fiom undei the Advanced heading. Well
88 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
assume we dont have a sepaiate staging seivei so well select the Local Live
staging type. lf you do have a sepaiate seivei to use foi staging, follow the
instiuctions in the pievious section foi conguiing it and youi local seivei foi
iemote staging. Eithei way, once you make a selection (eithei Local Live oi
Remote Live), moie options become available foi page veisioning and staged
poitlets.
Enabling Page Versioning and Staged Portlets
Enabling page veisioning foi a site allows site administiatois to woik in paiallel
on multiple veisions of the sites pages. Page veisioning also maintains a his-
toiy of all updates to the site fiom the time page veisioning was enabled. Site
administiatois can ieveit to a pievious veision of the site at any time. Tis ex-
ibility is veiy impoitant in cases wheie a mistake is found and its impoitant to
quickly publish a x. lf youie following the Nose-stei example, check Enabled
On Public Pages to enable page veisioning foi the Nose-stei site and then click
Save.
Befoie you activate staging, you can choose which poitlets data should be
copied to staging. Well covei many of the collaboiation poitlets listed undei
the Staged Poitlets heading when we come to chaptei 8. loi now, you just need
to be awaie that you can enable oi disable staging foi any of these poitlets. Why
might you want to enable staging foi some poitlet types but not otheis` ln the
case of collaboiative poitlets, you piobably dont want to enable staging since
such poitlets aie designed foi usei inteiaction. lf theii content weie staged,
youd have to manually publish youi site whenevei somebody posted a message
on the message boaids to make that message appeai on the live site. Geneially,
youll want web content to be staged because end useis aient cieating that
kind of content-web content is the stu you publish to youi site. But poitlets
like the Message Boaids oi the Wiki would likely benet fiom not being staged.
Notice which poitlets aie maiked foi staging by default if you enable staging
and accept the defaults, staging is not enabled foi the collaboiative poitlets.
Using the staging environment
Afei enabling staging (eithei Local Live oi Remote Live) foi a site, youll notice
a coloied bai with some new menus just below the Dockbai when you navigate
to the site. Tese new menus help us manage staged pages. Youll also notice
that most of youi page management options have been iemoved, because now
you cant diiectly edit live pages. You now must use the staging enviionment
to make changes. Click on Staging to view the staged aiea. Youi management
3.6. STAGING PAGE PUBLICATION 89
Figure 3.19: You can decide to use versioning and choose what content
should be staged.
90 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
options aie iestoied and you can access some new options ielated to staging. lf
youie following along with the Nose-stei example, navigate back to the News
and Events page and click on *Staging* to get youi page editing capabilities
back.
Figure 3.20: You can see the newbar staging adds to the top of your
screen.
Add the Calendai poitlet and then click on Live fiom the Dockbai. Notice
that the Calendai poitlet isnt theie. Tats because youve staged a change to
the page but havent published that change yet to the live site. Go back to the
staged page and look at the options you have available. liomheie you can Undo
changes, view a History of changes, Mark as Ready for Publication and Manage
Page Variations.
Undo/Redo: allows you to step back/foiwaid thiough iecent changes to a
page, which can save you the time of manually adding oi iemoving poitlets if
you make a mistake.
History: shows you the list of ievisions of the page, based on publication
dates. You can go to any change in the ievision histoiy and see how the pages
looked at that point.
Manage Page Variations: allows you to woik in paiallel on multiple veisions
of a staged page. We will explain this latei.
Afei youie done making changes to the staged page, click the Mark as Ready
for Publication buuon. Te status of the page changes fiom Dra to Ready for
Publication and any changes youve made can be published to the Live Site.
When you publish a page to live, only the veision which was Marked as Ready
for Publication is published.
3.6. STAGING PAGE PUBLICATION 91
Te diopdown next to the Staging link at the top gives you the option to
Publish to Live Now oi Schedule Publication to Live.
Publish to Live Now: immedatiately pushes any changes to the Live Site.
Sedule Publication to Live: lets you set a specic date to publish oi to
setup iecuiiing publishing. You could use this, foi example, to publish all changes
made duiing the week eveiy Monday moining without any fuithei inteivention.
Click on Mark as Ready for Publication and then Publish to Live Now to pub-
lish youi Calendai poitlet to the live site.
Content publication can be also contiolled using staging. Calendai events
aie staged by default (this can be changed in Staging Conguiation). lf you cie-
ate an event in the staged site, it isnt visible in the live site until you publish
it to the live site following the same steps you just peifoimed (you can select
which types of content aie published when you publish to the live site). lf woik-
owis enabled foi Calendai Events, the event needs to go thiough the woikow
piocess befoie it can be published to the live site.
Figure 3.21: Ready to publish to the live site.
One of the most poweiful featuies of staging is page vaiiations. Lets see
how to use them to cieate multiple dieient vaiiations of youi sites pages foi
dieient puiposes.
Site Pages Variations
Lets say youie woiking on a pioduct-oiiented site wheie youll have seveial
majoi changes to a page oi a set of pages ovei a shoit peiiod of time. Also
you need to be woiking on multiple veisions of the site at the same time to
ensuie eveiything has been piopeily ieviewed befoie it goes live. With staging
in Lifeiay .1 you can do this using Page Variations.
loi example, you can cieate seveial page vaiiations, enabling the maiketing
team to give youi site a completely dieient look and feel foi Chiistmas. At the
same time, the pioduct management team can woik on a dieient veision that
will be published the day afei Chiistmas foi the launching of a new pioduct.
Additionally, the pioduct management team is consideiing two dieient ideas
92 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
foi the home page of the site, so they can cieate seveial page vaiiations of the
home page inside theii pioduct launch site.
Vaiiations only aect pages and not the content, which means all the exist-
ing content in youi staging site is shaied by all youi vaiiations. ln dieient site
page vaiiations you can have dieient logos, dieient look and feel foi youi
pages, dieient applications on these pages, dieient conguiation of these ap-
plications and even dieient pages. One page can exist in just one site page
vaiiation oi in seveial of them.
By default, we only have one site page vaiiation which is called Main Vari-
ation. To cieate a new one, use the diopdown next to the Staging link and click
on Manage Site Pages Variations. Tis biings you to a list of the existing site
page vaiiations foi youi site. Click Add Site Pages Variation to cieate a new
one. liom the Add Site Pages Variation scieen, you can set a Name, Desciiption
and also set youi new vaiiation to copy the content fiom an existing vaiiation.
Teie aie seveial options to choose in this selectoi.
Any existing Site Pages Variation: cieates a new site page vaiiation that
contains only the last veision of all the pages that exist in this vaiiation. Te
cuiient vaiiation must be maiked as ieady foi publication.
All Site Pages Variation: cieates a new vaiiation that contains the last vei-
sion maiked as ieady foi publication fiom any single page existing in any othei
vaiiation.
None: cieates a new, empty vaiiation.
You aie also able to iename any vaiiation. loi example, edit the Main Vaiia-
tion and change its name to something that makes moie sense in youi site, such
as Basic, Master, Regular and cieate a vaiiation foi Chiistmas.
You can switch between dieient vaiiations by clicking on them fiom the
staging menu bai. lts also possible to set peimissions on each vaiiation, so
ceitain useis have access to manage some, but not all vaiiations.
You can now go to the home page of youi Chiistmas vaiiation and change
the logo, apply a new theme, move poitlets aiound, change the oidei of the
pages and conguie dieient poitlets. Te othei vaiiations wont be aected.
You can even delete existing pages oi add newones (iemembei to Mark as Ready
for Publication when you aie nished with youi changes).
When you delete a page, it is deleted only in the cuiient vaiiation. Te same
happens when you add a new page. lf you tiy to access a page which was
deleted in the cuiient vaiiation, Lifeiay infoims you this page is not enabled in
this vaiiation and you must enable it. To enable it, navigate to the Manage
Site Pages scieen. Heie all the existing pages foi all the vaiiations aie shown in
a tiee. Pages not enabled foi the cuiient vaiiation aie shown in a lightei coloi.
3.6. STAGING PAGE PUBLICATION 93
To publish a vaiiation to the live site, click on Publish to Live now in the
diopdown next to the vaiiation name. Publications can also be scheduled in-
dependently foi dieient vaiiations. loi example, you could have a vaiiation
called Mondays which is published to the live site eveiy Monday and anothei
one called Day 1 which is published to the live site eveiy ist day of each month.
You can also have vaiiations foi a single page inside a site page vaiiation,
which allows you to woik in paiallel in dieient veisions of a page. loi example,
you might woik on two dieient pioposals foi the design of the home page foi
the Chiistmas vaiiation. Tese page vaiiations only exist inside a site Page
vaiiation.
To cieate a new page vaiiation, click Manage Page Variations on the staging
toolbai. Tis biings you to a list of existing page vaiiations foi the cuiient
page (by default, theie is only one called Main Variation). You can cieate moie
oi iename the existing one. You can switch between dieient page vaiiations
using the toolbai containing the page vaiiations below the site pages vaiiations
toolbai. When you decide which page vaiiation should be published, maik it
as Ready for Publication. Only one page vaiiation can be maiked as ieady foi
publication and that is the one that gets published to the live site.
Figure 3.22: Creating a newPage Variation
loi example, we could cieate a page vaiiation called Tanksgiving foi the
News and Events page inside of the Chiistmas vaiiation and anothei one called
94 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Chiistmas Day to display dieient content on those paiticulai days.
Figure 3.23: The Thanksgiving Page Variation.
Anothei poweiful featuie is the possibility of merging Site Pages Vaiiations.
To meige two Site Pages Vaiiations, you need to go to the Manage Site Vaiiations
scieen. liom theie, click on Merge on the Site Pages Vaiiation you want to use
as the base. You will be asked to choose the Site Pages Vaiiation to meige on
top of it. Meiging woiks in the following way
New pages that dont exist in the base Vaiiation, will be added.
lf a page exists in both Site Pages vaiiations, and at least one veision of the
page was maiked as ieady foi publication, then the latest veision maiked
as ieady will be added as a new Page Vaiiation in the taiget page of the
base Vaiiation. (Note that oldei veisions oi page vaiiations not maiked as
ieady foi publication wont be copied. Howevei, meige can be executed
as many times as needed and will cieate the needed pages vaiiations in
the appiopiiate page of the base Site Pages Vaiiation).
Meiging does not aect content noi will oveiwiite anything in the base
Vaiiation, it will just add moie veisions, pages and page vaiiations as
needed.
3.7. CREATING TEAMS FOR ADVANCED SITE MEMBERSHIP MANAGEMENT9
Lets nish oui discussion of staging by outlining a few moie featuies.
Wrapping up staging
You can enable staging on an individual site basis, depending on youi needs.
Tis makes it easy to put stiict contiols in place foi youi public web site, while
opening things up foi individual sites that dont need such stiict contiols. Lif-
eiays staging enviionment is extiemely easy to use and makes maintaining a
content-iich web site a snap.
Lifeiay .0 intioduced a new featuie to the peimissions system called teams.
Lets examine them next.
3.7 Creatingteamsfor advancedsitemembershipmanage-
ment
Teams dont appeai as a link in the Contiol Panel because they exist within sites.
Teams allow site administiatois a gieatei degiee of exibility than was possible
using just usei gioups and ioles. Tey allowsite administiatois to cieate vaiious
sets of useis and peimissions foi site-specic functions. Teams aie the piefeiied
method foi collecting peimissions within a single site.
lf you cieate a team foi one site, the peimissions dened foi it aie not avail-
able to any othei sites. ln contiast, if you assigned a customiole to a usei gioup,
the iole would be available poital-wide even though the specic peimissions de-
ned by it would only apply within the scope of a designated site. luitheimoie,
team membeis, unlike usei gioup membeis, aie guaianteed to be membeis of
the desiied site.
To cieate a team within a site, ist naviagte to the Control Panel Sites
page then and then select Actions Manage Memberships foi the site within
which you want to cieate a team. linally, click View Teams and click the
Add Team buuon.
Afei youve clicked the Add Team buuon and enteied a name and a desciip-
tion, click Save. Youi new team will appeai in the list. To add membeis, simply
click on Actions Assign Members.
Peimission management foi teams is handled at the individual poitlet level,
using the Options Conguration Permissions tab of the poitlet itself. Re-
membei the poitlet options link is the wiench symbol at the top of a poitlet.
Tis enables useis who wouldnt have access to all of the necessaiy options in
the Contiol Panel to manage peimissions thiough teams.
9 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.24: Creating a Teamwithin a Site
Figure 3.25: Assigning Portlet Permissions to a Team
3.8. DISPLAYING SITE PAGES TO MOBILE DEVICES 9
To give a team access to a paiticulai poitlet function, access the Permissions
tab of a poitlet iesiding on a page, check the boxes coiiesponding to peimissions
you want to assign to the teams, then click Save. Tats it' Now youi team is
ieady to peifoim theii functions. Next, lets look at how to conguie Lifeiay
foi mobile devices.
3.8 Displaying site pages to mobile devices
Mobile device iules allow you to conguie sets of iules to altei the behavioi
of the poital based on the device being used to access Lifeiay. Te piopoition
of mobile device useis biowsing the web has been steadily incieasing, so its
impoitant to be able to handle dieient kinds of devices appiopiiately. loi in-
stance, you can conguie the look and feel of Lifeiay pages accessed by smait-
phone oi tablet useis dieiently fiom those accessed by PC useis.
Both sites and individual pages can be conguied with any numbei of iule
gioups. A iule gioup is designed to desciibe a gioup of devices, think of a iule
gioup as a mobile device family. lt can contain one oi moie iules that desciibe
a categoiy of devices, such as all Andioid devices oi all iOS tablets. You can
dene as many iules in a iule gioup as you need to classify all the devices foi
which youd like to dene actions. Rule gioups can be piioiitized to deteimine
which one applies to a given page iequest.
ln oidei to conguie mobile device iules, you need a way to nd out the
chaiacteiistics of the device. While some of the chaiacteiistics aie piovided
by the device, most aie not. loi this ieason, theie aie databases that contain
infoimation about thousands of devices. Tese databases make it possible to
leain eveiy detail about a device fiom the device type, which is included in
each iequest sent to the poital. Lifeiays Mobile Device Rules can connect to
device databases so that you can use theii device chaiacteiistics in youi iules.
Among the plugins available on Lifeiay Maiketplace, you can nd the De-
vice Recognition Piovidei plugin. Tis plugin piovides out of the box integia-
tion with WURlL, an open souice database licensed with the AGPLv3 license.
Commeicial licenses aie also available. lts also possible to develop plugins that
integiate with othei device databases. Even if you dont have a device database,
you can still set up mobile device iules. Tey wont, howevei, be eective until
a database is deployed, because the poital wont have enough infoimation about
the devices being used to make page iequests.
To conguie mobile device iules, you must install the Device Recognition
Piovidei plugin. Tis plugin uses the WURlL database to enable Lifeiay to
detect which mobile device oi opeiating system is being used foi any given
98 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
iequest. To install the plugin, navigate to the Stoie section of the Contiol Panel,
located undei the Maiketplace heading. Click on the Utility section and then
on See All. Seaich foi the appiopiiate Device Recognition Piovidei plugin (CE
oi EE) and click on it. linally, click on Free to acquiie the plugin. Once youve
acquiied the plugin, you need to download and install it. To do so, navigate
to the Puichased section of the Contiol Panel, nd youi Device Recognition
Piovidei plugin, and click on Download and then Install.
Installation Note: lf youi seivei doesnt have access to the outside lnteinet,
an eiioi appeais in youi log
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder
Tis occuis because WURlL by default downloads device infoimation fiom
the web. You can piovide the same infoimation to WURlL manually. Download
the SLl4J distiibution fiom hup//www.slf4j.oig/download.html, unzip the ie-
sulting le, copy slf4j-log4j12.jar to [WEB_APP_HOME]/wurfl-web/WEB-
INF/lib foldei, and iestait youi Lifeiay instance. On some application seiveis,
youll need to add this .jai le to the wurfl-web.war le ist (in the diiectoiy
noted above) befoie deploying the le to youi seivei.
You can access the Mobile Device Rules administiative page fiom the Con-
tent section of the Contiol Panel. Select the appiopiiate scope using the con-
text menu selectoi so youi iule gioups aie available wheie you expect them to
be. Te Mobile Device Rules administiative page displays a list of dened iule
gioups and lets you add moie. To add iules to a iule gioup, select Actions
Manage Rules, oi click on a iule gioup to edit it, and then click the Manage Rules
link.
Te iules dened foi a iule gioup, along with the piioiities of the iule gioups
selected foi a paiticulai site oi page, deteimine which iule gioups actions aie
applied to a given iequest. liom the Manage Rules page foi a specic iule set,
you can add a iule by specifying a iule type. Remembei that you can add as
many iules to a iule gioup as you need in oidei to classify the devices on which
youd like to take actions. Note that, by default, only the Simple Rule type is
available. Te iules aie designed, howevei, to be extensible, and additional iule
types can be added by youi developeis. Once added, you can edit the iule to
specify a device type and opeiating system.
Once youve cieated some mobile device iule gioups and added some iules to
them, youll be ieady to set up some actions. Te actions dened foi a iule gioup
deteimine what happens to a paiticulai iequest when the device is detected and
the iule gioup has been found to apply.
You can add actions to a iule gioup fiom the Site Pages page of the Contiol
Panel. Select eithei the public oi piivate pages and then look foi the Mobile Rule
3.8. DISPLAYING SITE PAGES TO MOBILE DEVICES 99
Figure 3.26: You can manage device rules fromthe Mobile Device Rules
administrative page.
Groups link in the iight-hand menu. Use the Select Rule Group buuon to select
iule gioups to be applied eithei to a site oi to a single page. lf you select the
page gioup itself fiom the lef-hand menu, the selected iule gioup applies to all
the pages of the site by default. lf, howevei, you select an individual page and
then click the Select Rule Group buuon, the iule gioups apply only to that page.
You can select multiple iule gioups foi a paiticulai site oi page and oidei them
by piioiity. Te iule gioups aie checked in decieasing oidei of piioiity the
actions dened by the ist iule gioup that applies aie executed.
To add actions to a selected iule gioup, use the Actions Manage Actions
buuon and then click Add Action. By default, theie aie foui kinds of actions
that can be conguied foi mobile iule gioups layout template modications,
theme modications, simple iediiects, and site iediiects. Layout template mod-
ications let you change the way poitlets aie aiianged on pages deliveied to
mobile devices, and themes modications let you select a specic look and feel.
100 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Figure 3.27: You need to install the Device Recognition Provider plugin to
populate the OS list.
lf it makes moie sense foi you to cieate sepaiate mobile veisions of ceitain sites
oi pages, you can use a iediiect to make suie mobile device useis get to the
iight page. To dene a simple iediiect, you need to specify a URL. To dene a
site iediiect, you need only specify the site name and page name of the page
to which youie iediiecting. Like mobile device iules, mobile device actions aie
designed to be extensible. Youi developeis can dene customactions in addition
to the foui actions piovided by default.
To ieview, if youd like to conguie an action oi actions that take place when
mobile device iequests aie ieceived, take the following steps
1. Cieate a mobile device iule gioup to iepiesent the family of devices foi which
to dene an action oi actions.
3.8. DISPLAYING SITE PAGES TO MOBILE DEVICES 101
Figure 3.28: You can select a mobile device rule group to apply for a site or
page fromthe Site Pages section of the Control Panel.
2. Dene one oi moie iules foi youi iule gioup that desciibe the family of de-
vices iepiesented by youi iule gioup.
3. Apply youi iule gioup to an entiie page set of a site (all the public pages of
a site oi all the piivate pages) oi to a single page.
4. Dene one oi moie actions foi youi iule gioup that desciibe how iequests
should be handled.
To see how this might woik in piactice, lets discuss a few examples of how
you can use mobile device iules. liist, suppose you have a sepaiate veision
of a site on youi poital thats specically designed foi mobile phones iunning
Andioid oi Bada. loi oui example, well make a site called Andioid/Bada Lifeiay
and well conguie the default Lifeiay site to iediiect incoming iequests fiom
Andioid oi Bada mobile phones to the Andioid/Bada Lifeiay site. Oui ist step
is to cieate the Andioid/Bada Lifeiay site go to the Sites page of the Contiol
Panel and click Add Blank Site. Entei the name Android/Bada Liferay and
click Save. Ten, with Andioid/Bada selected in the context menu selectoi, click
on Site Pages. By default, the newly cieated site doesnt have any pages, so click
on Add Page, entei the name Welcome, and click the Add Page buuon. Now
oui Andioid/Bada Lifeiay site has a public Welcome page just like oui default
Lifeiay site.
102 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Next, select Liferay in the context menu selectoi and go to the Mobile De-
vice Rules page of the Contiol Panel. Click on Add Rule Group, entei the name
Android and Bada Mobile Phones, and click Save. Youll see the message, No rules
are congured for this rule group.
Figure 3.29: After adding a newrule, youll see a message indicating that
no rules have been congured for the rule group.
Click the Manage Rules link and well conguie oui iule gioup to apply only
to mobile phones iunning Andioid oi Bada. Click Add Rule, entei Rule 1 foi
the name and select Simple Rule foi the type, then click Save. Ten click on the
iule to edit it oi click Actions Edit. Undei OS, select Android and Bada OS
(hold down Contiol to make multiple selections), select False undei Tablet since
we want oui iule gioup to apply only to mobile phones, and click Save. Now
3.8. DISPLAYING SITE PAGES TO MOBILE DEVICES 103
we just need to dene the iediiect action foi oui iule gioup. Make suie Lifeiay
is still selected in the context menu selectoi and click on Site Pages. Click on
Mobile Rule Groups in the navigation menu to the iight.
Figure 3.30: To apply a mobile device rule group to a page set of a site,
select the site in the context menu selector, click on Mobile Rule Groups,
click Select Rule Group, and select the desired rule group.
Click Select Rule Group and then click the Android and Bada Mobile Phones
iule gioup that you conguied. Once youve selected youi iule gioup, click
Mobile Rule Groups again and click eithei on youi iule gioup oi Actions
Manage Actions next to it. Ten click Add Action, entei the name Android/Bada
Liferay Redirect, and select Site Redirect undei Type. Undei the Site diopdown
menu that appeais, select Android/Bada Liferay and undei the Page diopdown
menu that appeais, select the Welcome page that you cieated eailiei. Lastly,
click Save. Tats it' Now Andioid and Bada mobile phone useis aie iediiected
to the Andioid/Bada Lifeiay site fiom the Lifeiay site.
Lets look at one moie example of using mobile device iules befoie we move
on. Suppose youd like to cieate anothei iule so that when a site is accessed by
an Andioid oi iOS tablet, a dieient layout is used. To set this up, we need to
follow the same foui steps desciibed above. liist, make suie that the Lifeiay
site is selected in the Contiol Panels context menu selectoi and navigate to the
Mobile Device Rules page of the Contiol Panel. Add a new iule gioup called
Android and iOS Tablets. Add a simple iule called Rule 1 to this iule gioup. As
with the pievious example, we only need one iule to desciibe oui device family.
104 CHAPTER 3. ADVANCED WEB CONTENT MANAGEMENT
Edit Rule 1 and select Android and iPhone OS undei the OS heading and True
undei the Tablet heading, then click Save.
Next, click on Site Pages in the Contiol Panel, select Mobile Rule Groups, and
select the Android and iOS Tablets iule gioup. Notice that youve now selected
two iule gioups foi the Lifeiay sites public pages and theyve been assigned
piioiities. lf a device making a iequest belongs to both of the device families
iepiesented by the iule gioups, the piioiity of the iule gioups deteimines which
iule gioups actions aie executed. Note that in oui example, the ist iule gioup
contains only mobile phones and the second iule gioup contains only tablets,
so no devices can belong to both iule gioups. Now we just need to dene an
action foi oui Andioid and iOS Tablets iule gioup to use a dieient layout On
the Site Pages page of the Contiol Panel, click on Mobile Rule Groups, and then
on Actions Manage Actions next to Andioid and iOS Tablets. Click on Add
Action, entei the name Layout Template Modication*, and select the Layout
Template Modication action type. Lastly, select the 1 Column layout template
(oi whichevei one you like) and click Save. Good job' Now the Lifeiay sites
pages aie piesented to Andioid and iOS tablet useis with the 1 Column layout
template.
3.9 Summary
Tis chaptei has been youi guide to Lifeiay site management and advanced
Web Content Management. Weve seen how you can use Lifeiay to manage
both simple content and advanced content with stiuctuies and templates. Weve
leained how you can use Lifeiay to cieate multiple sites with dieient membei-
ship types. Weve also leained how to use page and site templates to simplify
the site cieation piocess.
Lifeiay WCMalso includes a poweiful staging enviionment, allowing you to
stage content locally on the same seivei oi iemotely to anothei seivei. You can
publish youi site when you want it, on the schedule you choose. You can even
cieate dieient vaiiations of youi site that can be woiked on simultaneously.
You saw how to allow useis to cieate peisonal customizations of site pages.
We discussed how site administiatois can cieate teams as a exible means of
delegating site peimissions. We also saw how to conguie mobile device iules
so that site pages aie piesented dieiently depending on the device making a
page iequest.
Whethei youi site is small and static oi laige and dynamic, Lifeiays WCM
enables you to plan and manage it. With tools such as the WYSlWYG editoi,
stiuctuies and templates, you can quickly add and edit content. With the Web
3.9. SUMMARY 10
Content Display and Asset Publishei, you can iapidly select and conguie what
content to display and howto display it. By using Lifeiays integiated woikow,
you can set up custom publishing iules to t youi oiganization. And by using
Lifeiays staging and scheduling mechanisms, you can manage vaiious bianches
of pages and content and contiol when they aie published to youi live poital
instance. You will nd that managing youi site becomes fai easiei when using
Lifeiays Web Content Management system.
Cu~v1rv 4
DocUxrN1 M~N~crxrN1
Lifeiays Documents and Media libiaiy piovides a mechanism foi stoiing les
online using the same type of stiuctuie that you use to stoie les locally. You
can use it to stoie les of any kind, it seives as a viitual shaied diive. Te
Documents and Media poitlet takes its name fiom the fact that it iepiesents a
iedesign of two poitlets fiom pievious veisions the Document Libiaiy and the
lmage Galleiy. liist, the Documents and Media libiaiy seives as a iepositoiy foi
all types of les, theies no need to stoie image les in a sepaiate lmage Galleiy
anymoie. Second, the Media Galleiy poitlet intioduced in Lifeiay .1 does not
seive as a iepositoiy but just displays selected content fiom the Documents and
Media libiaiy. lt can display image, audio and video les. Othei new featuies
include customizable document types and metadata sets, automatic document
pieview geneiation, and suppoit foi mounting multiple exteinal iepositoiies.
Te newdocument types and metadata sets aie an addition to, not a ieplacement
foi, the poitals system of tags and categoiies. Lets stait exploiing how to use
the Documents and Media poitlet.
10
4.1. GETTING STARTED WITH DOCUMENTS AND MEDIA 10
4.1 Getting Started with Documents and Media
Te Documents and Media poitlet is non-instanceable. Tis means that each
page on youi poital can host at most one such poitlet. luitheimoie, if you add
multiple Documents and Media poitlets to pages in the same site, these poitlets
will shaie the same data sets since they aie scoped by site by default. Howevei,
you can add multiple Documents and Media Display poitlets to a page. Ten you
can choose content fiom actual Documents and Media iepositoiies to display.
Remembei that useis, by default, have theii own peisonal sites with public and
piivate pages. Tey can use theii peisonal sites to host Documents and Media
poitlets foi stoiing oi shaiing theii own les.
Figure 4.1: Initial Viewof the Documents and Media Portlet
Te default viewof the Documents and Media poitlet displays the contents of
the Home foldei. Te links on the lef side of the poitlet windows aie lteis. You
can use these lteis to choose what you want the main window of the poitlet
to display. Recent Documents displays documents useis have iecently uploaded,
edited oi downloaded. My Documents shows your documents, in othei woids,
the documents you have uploaded. Basic Document and the document types
listed below it aie also lteis. lf you click on one of these lteis, the main
poitlet window shows only documents that belong to the selected document
type. When you add custom document types, which we discuss below, they aie
added to the ltei list. Next, lets look at how to navigate aiound Documents
and Media.
Navigating the Documents and Media Portlet
ln the main window of the Documents and Media poitlet, you can click on a
document to view details about it. lts veision numbei, veision histoiy, status,
108 CHAPTER 4. DOCUMENT MANAGEMENT
as well as its uploadei and the usei who last edited it. Depending on the doc-
ument, some automatically extiacted metadata may also be displayed, such as
the document cieatoi, authoi, title, content type, cieation date and last mod-
ication date. ln the case of audio oi video les, the duiation would also be
displayed. You can peifoim seveial actions on the document heie
Download: lets you download the document.
Get URL: displays the URL of the document on the seivei.
Get WebDAVURL: displays the WebDAVURL of the document on the seivei.
See the WebDAV access section below foi moie infoimation.
Edit: lets you change contents of a document, point it to a dieient le,
change its title, desciiption oi document type, oi add tags, categoiies oi ielated
assets.
Move: lets you choose a new location in the Documents and Media ieposi-
toiy to stoie the document.
Cheout/Chein: pievents otheis fiom modifying the document while
you aie woiking. Othei useis can still viewthe cuiient veision of the document
if they have peimission. You can check the document back in when youie done
woiking.
Permissions: allows you to conguie le-specic peimissions foi the docu-
ment.
Delete: lets you iemove the document fiom the Documents and Media li-
biaiy.
lf comments aie enabled, you can also view comments, add comments oi
subsciibe to comments about documents. Comments aie enabled by default.
Te menu at the top of the Documents and Media poitlet contains Actions,
Add, Soit By and Manage buuons. Teie aie also buuons foi switching between
icon view, desciiptive view and list view. lf theie aie lots of documents in the
Documents and Media libiaiy, the seaich eld can help you nd the documents
youie looking foi. lf youi poitlet contains moie documents than it can display
at once, you can use the navigation tool at the bouom of the poitlet window to
eithei switch youi view to anothei page oi conguie the page to display moie
documents pei page.
Actions
Te Actions menu will only be displayed if you have selected one oi moie doc-
uments with the check boxes.
Cancel Cheout: lets you check in a document that you had checked out but
did not make any changes to. Using this option will pievent the Documents and
4.1. GETTING STARTED WITH DOCUMENTS AND MEDIA 109
Figure 4.2: Viewing a Document
Media poitlet fiominciementing the documents veision numbei and saving an
identical veision of the document.
Chein: lets you check in a document that you have edited. lts veision
numbei will inciement and the pievious veision will be saved.
Cheout: lets you check out a document that you would like to edit. Tis
option pievents anyone else fiom modifying it while you aie woiking.
Move: allows you to choose a new location foi a document oi foldei within
the poitlets le system. You can move multiple documents and foldeis at the
same time. Moving documents and foldeis is also possible via diag & diop.
Delete: allows you to iemove a document oi foldei fiom the poitlet. You
can delete multiple documents and foldeis at the same time.
Add
liom the Add buuon, you can add documents, foldeis and shoitcuts just like on
youi local le system.
Folder: lets you cieate a new location in youi poitlets le system.
Shortcut: allows you to cieate a shoitcut to any document that you have
iead access foi. You can set peimissions on the shoitcut to specify who can
access the oiiginal document thiough the shoitcut.
110 CHAPTER 4. DOCUMENT MANAGEMENT
Repository: is a new featuie of Lifeiay .1. Tis option allows you to add
an entiiely new iepositoiy to youi Documents and Media poitlet. To do this
you need to specify the iepositoiy type and choose an lD. lf you aie using the
AtomPub piotocol youll also have to specify the AtomPub URL.
Multiple Documents: allows you to upload seveial documents at once.
Basic Document: allows you upload a single le that you would like the de-
fault document type, Basic Document, to apply to. By default, basic documents
aie not desciibed by any metadata sets.
Te iemaining items in the Add menu aie default document types that aie
each desciibed by a unique metadata set. When you add a document belonging
to a specic document type, youie piesented with a foim to not only specify
the le to upload but also to ll out the elds dened by the document types
metadata set. We desciibe the Contiact document type by way of example.
Contract: lets you upload a le that you would like the Contiact document
type to apply to. Tis document type is intended to be used to desciibe legal
contiacts. By default, contiacts aie desciibed by eective date, expiiation date,
contiact type, status, legal ieviewei, signing authoiity and deal name elds.
Document types aie discussed below.
Any custom documents types that have been dened also appeai in the Add
menu. lf a document type has been cieated that matches the document you
would like to upload, you can select that document type fiom the Add menu.
Tis will associate the metadata elds associated with the document type to
youi document and you will be asked to ll out the elds.
Sort
You can soit the items displayed in the main window of the Documents and
Media poitlet using the Soit By menu. You can soit by title, cieate date, modied
date, downloads oi size.
Title: lets you alphabetically soit documents by title.
Create Date: lets you soit documents by the time they weie cieated.
Modied Date: lets you soit documents by the last time they weie modied.
Downloads: lets you soit documents by the numbei of times they weie
downloaded.
Size: lets you soit documents by how much disk space they use.
Manage
Te Manage menu allows you to view the names of document types and meta-
data sets, as well as the last times they weie edited.
4.2. DOCUMENT TYPES AND METADATA SETS 111
Document Types: shows you a list of dened document types.
Metadata Sets: shows you a list of dened metadata sets as well as theii
poital lDs.
4.2 Document Types and Metadata Sets
Customizable document types and metadata sets aie newfeatuies in Lifeiay .1.
When a usei assigns a document type to a document, the usei is iequiied to ll
out the elds dened by the metadata set of the document type. Tis encouiages
useis not to foiget to entei impoitant infoimation about theii documents. loi
example, you could cieate a copyiighted document type and iequiie useis to
entei a license foi all copyiighted documents. Moie impoitantly, document
types and metadata sets can impiove document seaichability. Te values that
useis entei into the elds deteimined by theii document types metadata set be-
come seaichable entities within the poital. You can use Lifeiays seaich poitlet
to seaich foi these teims. Document types and metadata sets aie accessible fiom
the Manage Buuon at the top of the Documents and Media poitlet window.
Figure 4.3: Document Types Dialog Box
You can add a new document type using the Add buuon at the top of the
dialog box. To do so, you need to dene one oi moie metadata sets to associate
with youi document type. When cieating a new document type, you can dene
Main Metadata lields oi select Additional Metadata lields. Main metadata
elds aie diiectly tied to theii document type and cannot be made available to
112 CHAPTER 4. DOCUMENT MANAGEMENT
othei document types. Additional metadata elds, by contiast, can be dened
independently and can be used in many dieient document types. You can
dieientiate the document types that implement the same additional metadata
set by dening dieient main metadata elds foi them. Howevei, Additional
metadata elds need to be dened and saved befoie cieating a document type
that will implement them.
Figure 4.4: Adding a NewDocument Type
As an example, we could cieate a document type called Syllabus and dene
a metadata set. What metadata should we associate with syllabi` Lets choose
4.2. DOCUMENT TYPES AND METADATA SETS 113
foi oui syllabi to have couise title, piofessoi, semestei, couise desciiption and
couise iequiiements elds. All syllabi in oui poital should maintain entiies
foi these elds. Tis ensuies that a syllabus will show up in a poital seaich if
its couise title, piofessoi oi semestei is seaiched foi. Since we dont want to
use oui metadata set foi any document type othei than Syllabus, lets cieate
oui metadata set undei the Main Metadata lields aiea. Alteinatively, we could
cieate oui metadata set independently using Manage Metadata Sets Add
and then select it as an Additional Metadata lield.
Figure 4.5: Selecting Additional Metadata Sets
You can view, edit oi add metadata sets fiom the Manage Metadata win-
dow. A metadata set consists of a gioup of elds. lf you click the Add buuon,
114 CHAPTER 4. DOCUMENT MANAGEMENT
you can use same Ul foi dening a metadata set that you used in the Add Doc-
ument Type window.
Figure 4.6: Adding a NewMetadata Set
Make suie the lields tab is selected on the lef. Ten, to dene a metadata set,
just choose elds to use fiom the aiea on the lef and diag and diop them into
the aiea on the iight. Te diag and diop inteiface allows foi nested elds so you
need to be caieful about wheie you diop the elds. Default values, mouse-ovei
tips, widths and othei seuings can be conguied foi most elds. To conguie
these seuings, just double-click on a eld fiom the aiea on the iight. Tis au-
4.3. ALTERNATIVE FILE REPOSITORY OPTIONS 11
tomatically selects the Seuings tab on the lef. Ten double-click on a value to
edit. Lifeiay suppoits the following kinds of elds foi metadata sets
Boolean: is a checkbox.
Date: lets you entei a date. A valid date foimat is iequiied foi the date eld,
but you dont have to entei a date manually. When you select the date eld a
mini-calendai pops up which you can use to select a date.
Decimal: lets you entei a decimal numbei. Te value will be peisisted as a
double.
Documents and Media: lets you select a le fiom one of the poitals Docu-
ments and Media libiaiies.
File Upload: lets you select le to upload fiom youi local system.
Integer: lets you entei an integei. Te value will be peisisted as an int.
Number: lets you entei a decimal numbei oi an integei. Te value will be
peisisted eithei as a double oi an int, depending on the type of input.
Radio: displays seveial clickable options. Te default numbei is thiee but
this is customizable. Only one option can be selected at a time.
Select: is just like the iadio eld except that the options aie hidden and have
to be accessed fiom a diop-down menu.
Text: lets you entei a single line of text.
Text Box: is just like the text eld except you can entei multiple lines of text
oi sepaiate paiagiaphs.
Remembei that metadata sets cieated independently aie ieusable. Once they
have been cieated they can be included in any numbei of document types as
additional metadata sets. Next, lets take a look at tags. Tags can be auached to
most foims of web content that can be cieated in Lifeiay, including documents.
4.3 Alternative File Repository Options
By default, Lifeiay stoies documents and media les on the le system of the
seivei wheie its iunning. You can choose a specic location foi the document
libiaiy stoies ioot diiectoiy by adding the following piopeity to youi poital-
ext.piopeities le and ieplacing the default path with youi custom path
dl.store.file.system.root.dir=${liferay.home}/data/document_library
You can also use an entiiely dieient method foi stoiing documents and
media les. Te following documents and media libiaiy stoies aie available
11 CHAPTER 4. DOCUMENT MANAGEMENT
Advanced lile System Stoie
CMlS Stoie (Content Management lnteiopeiability Seivices)
DBStoie (Database Stoiage)
lile System Stoie
JCRStoie (Java Content Repositoiy)
S3Stoie (Amazon Simple Stoiage)
loi example, you can stoie documents and media les in youi Lifeiay in-
stances database using DBStoie. To enable DBStoie, add the following line to
youi portal-ext.properties le
dl.store.impl=com.liferay.portlet.documentlibrary.store.DBStore
Remembei to iestait youi Lifeiay seivei afei updating youi portal-ext.pro-
perties le in oidei foi youi customizations to take eect. Please iefei to the
Document Libiaiy Poitlet section of youi portal.properties le foi a com-
plete list of suppoited customizations. You can customize featuies such as the
maximum allowed size of documents and media les, the list of allowed le
extensions, which types of les should be indexed, and moie.
Next, lets look at mounting exteinal iepositoiies.
4.4 Using External Repositories
Adding iepositoiies in Documents and Media is a new featuie in Lifeiay .1.
Content Management lnteiopeiability Seivices (CMlS) is a specication foi im-
pioving inteiopeiability between Enteipiise Content Management systems. Doc-
uments and Media allows useis to connect to multiple thiid-paity iepositoiies
that suppoit CMlS 1.0 with AtomPub and Web Seivices piotocols.
Some of the featuies suppoited with thiid-paity iepositoiies include
Reading/wiiting documents and foldeis
Document check-in, check-out, and undo check-out
Downloading documents
Moving foldeis and documents within the iepositoiy
4.4. USING EXTERNAL REPOSITORIES 11
Geuing ievision histoiy
Reveiting to ievision
Teie aie some subtle dieiences in seuing up the dieient kinds of thiid-
paity iepositoiies foi use in Documents and Media. But theie aie plenty of
similaiities too.
Common Lifeiay conguiation steps
Adjust the poital piopeities.
Add any usei accounts iequiied by the iepositoiy.
Add the iepositoiy.
Lastly, keep in mind youi thiid-paity iepositoiy may iequiie installation
and deployment of an appiopiiate Lifeiay plugin. Plugins foi ShaiePoint and
Documentum aie available thiough Lifeiays Maiketplace.
Lets go thiough those steps, staiting with seuing oui poital piopeities.
Adjusting portal properties Te admin must ensuie that the same cieden-
tials and authentication aie being used in Lifeiay and in the exteinal iepositoiy.
Tis is noimally synchionized using a mechanism like LDAP. lf you dont have
LDAP, you need to ensuie manually that the ciedentials and authentication aie
the same. ln oidei to authenticate with the thiid-paity iepositoiy, you need to
stoie passwoids foi the usei sessions. Set the following poital piopeity in youi
portal-ext.properties
session.store.password=true
Next, we need to make suie the login and passwoid foi Lifeiay aie the same
as the exteinal iepositoiy. Tis is easily accomplished by using identical scieen
names, so in portal-ext.properties add the following
company.security.auth.type=screenName
Alteinatively, conguie these piopeities in the Contiol Panel undei Portal
Seings Authentication.
118 CHAPTER 4. DOCUMENT MANAGEMENT
Adding required repository users Once these piopeities aie set, you must
cieate a usei in Lifeiay with a scieen name and passwoid matching the admin-
istiative usei of youi exteinal iepositoiy. Be suie to assign appiopiiate ioles
(e.g. Administiatoi) to that usei. Sign out of Lifeiay and sign in again as that
new usei. See sections of the Management chaptei on adding and managing
useis.
Adding the repository You can add new iepositoiies fiom the Ul by clicking
the Add buuon fiom the Home foldei. Repositoiies can only be mounted in the
Home foldei.
Figure 4.7: Adding a newrepository
All elds in this foim aie iequiied, except foi Repository ID. Leave this eld
blank, and a iepositoiy lD is automatically geneiated by the system.
When nished, the iepositoiy is displayed in the lef side of the window in
the Home foldei.
Using this infoimation, we can now add an example iepositoiy. As noted
pieviously, theie aie seveial iepositoiies that woik well with Lifeiay using
CMlS. One that is familiai to many useis is ShaiePoint. ln the exeicise below,
well set up ShaiePoint as a Documents and Media iepositoiy.
4.4. USING EXTERNAL REPOSITORIES 119
Figure 4.8: Viewing a repository
Example Repository Setup: SharePoint
With Lifeiay Poital you can connect to an exteinal ShaiePoint seivei and add it
as a Documents and Media iepositoiy. Tis lets useis collaboiate and shaie doc-
uments moie easily between both enviionments. We will mount a ShaiePoint
iepositoiy via CMlS AtomPub and ShaiePoint SOAP web seivices.
Lifeiay uses a combination of SOAP and Repiesentational State Tiansfei
(REST), based on the Atom convention, to connect to the ShaiePoint ieposi-
toiy. ShaiePoint piovides vaiious SOAP seivices foi modifying and queiying
data fiom its document libiaiy. Lifeiay uses Axis2 to geneiate SOAP calls to the
ShaiePoint seivei.
To use ShaiePoint as a Lifeiay Documents and Media iepositoiy, well do the
following
Conguie the CMlS Connectoi on ShaiePoint.
Activate a ShaiePoint site as a CMlS Pioducei.
Acquiie youi ShaiePoint document libiaiys iepositoiy lD.
Enable Basic Authentication on the ShaiePoint host.
Add ShaiePoint as a Lifeiay Documents and Media iepositoiy.
120 CHAPTER 4. DOCUMENT MANAGEMENT
Note that this section is geaied towaids poital system administiatois and
ShaiePoint system administiatois.
Befoie you can use ShaiePoint as an exteinal iepositoiy with Lifeiay poital,
you must veiify that ShaiePoint is piopeily conguied. Seveial seivices must
be set up on the ShaiePoint seivei befoie synchionizing with Lifeiay.
Conguring the CMIS Connector on SharePoint
ShaiePoint utilizes a CMlS Connectoi and a CMlS Pioducei to inteiface with
Lifeiay Poital. Te Connectoi is installed with the ShaiePoint Administiatoi
Toolkit using a solution package called a Windows ShaiePoint le (.wsp). lf
you dont have it alieady, install the ShaiePoint Administiatoi Toolkit foi its
CMlS Connectoi. lnstall and deploy the CMlS Connectoi as a laim Solution on
ShaiePoint.
Te foldei Content Management Interoperability Services (CMIS)
Connectors contains the spscmis.wsp le. Choose the appiopiiate deploy-
ment seuings and deploy that le. When deployment completes, Solution Piop-
eities shows the solution is successfully deployed to all taiget sites. Now its
time to conguie the CMlS Pioducei.
Activating a SharePoint site as a CMIS Producer
Te Pioducei makes ShaiePoint iepositoiies available thiough the CMlS Con-
nectoi. Choose the ShaiePoint site containing the document libiaiies to be used
as document iepositoiies. Eveiy document libiaiy in this site is made available
as a iepositoiy thiough the CMlS connectoi.
Go to Site Actions Site Seings Manage Site Features. Enable the Con-
tent Management Interoperability Services (CMIS) Producer by clicking Activate.
Now any document libiaiy cieated undei this site is CMlS enabled. Befoie
we leave oui ShaiePoint console, lets take note of oui ShaiePoint document
libiaiys iepositoiy lD.
Acquiring the SharePoint document librarys repository ID
Acquiiing youi ShaiePoint document libiaiys iepositoiy lD, oi list lD, is im-
poitant as it must be specied in the AtomPub URL Lifeiay uses to connect
with the exteinal iepositoiy. linding it, howevei, can be a liule confusing. Te
easiest way to nd the iepositoiy lD is by accessing the ShaiePoint iepositoiy
using a biowsei such as Mozilla liiefox.
lollow these steps to get the iepositoiy lD
4.4. USING EXTERNAL REPOSITORIES 121
1. ln ShaiePoint, open the desiied libiaiy.
2. Undei Libiaiy Tools select Library.
3. Click on Library Seings, located to the fai iight.
4. Te biowsei window iefieshes displaying the iepositoiy lD between cuily
biaces and in the biowseis addiess bai.
Figure 4.9: The repository IDcan be found by displaying the repositorys
URL in a Firefox browser.
Te iepositoiy lD is highlighted in the guie above. loi this example, the
iepositoiy lD is 6DFDA9-B547-4D1D-BF85-976863CDF533. Teiefoie, the
AtomPub URL youd use when adding this iepositoiy in Documents and Me-
dia would iesemble this
http://liferay/CMIS/_vti_bin/cmis/rest/6DFDA9-B547-4D1D-BF85-976863CDF533?getRepositoryInfo
Be suie to copy down this URL so you can use it to conguie ShaiePoint as
a iepositoiy in Documents and Media. Next, lets enable Basic Authentication
on the ShaiePoint host.
Enabling Basic Authentication on the SharePoint host
loi the CMlS connectoi and pioducei to woik, Basic Authentication on llS must
be enabled. Tis lets Lifeiays ShaiePoint hook authenticate against the Shaie-
Point web seivices. Enable Basic Authentication on youi ShaiePoint host.
You aie now piepaied to mount ShaiePoint as an exteinal iepositoiy.
Adding SharePoint as a Liferay Documents and Media repository
With the ShaiePoint seivei conguied, we now tuin oui auention to Lifeiay.
As mentioned in the common steps foi adding an exteinal iepositoiy, be suie
to adjust the poital piopeities and add any usei accounts iequiied by the iepos-
itoiy.
Heie aie the steps specic to conguiing Lifeiay to use ShaiePoint
122 CHAPTER 4. DOCUMENT MANAGEMENT
1. Download and install the ShaiePoint hook fiom Maiketplace. See the Down-
loading and Installing Apps section of the Leveraging the Liferay Marketplace
chaptei of this document foi moie infoimation.
2. Add the Documents and Media poitlet to a page, if you havent done so al-
ieady.
3. ln the Documents and Media poitlet click Add Repository and entei the fol-
lowing infoimation
Name: Entei an aibitiaiy name foi the iepositoiy.
Description: Desciibe the iepositoiy.
Repository Type: Select SharePoint (AtomPub).
AtomPub URL: Entei the applicable URL using the foimat below, substitut-
ing the ShaiePoint seiveis host name foi [host] and the ShaiePoint docu-
ment libiaiys iepositoiy lD foi [repository ID]
http://[host]/CMIS/_vti_bin/cmis/rest/[repository ID]?getRepositoryInfo
Repository ID: Leave this eld empty. Lifeiay seaiches foi the ist ieposi-
toiy using the given paiameteis and sets this value to that iepositoiys lD.
Site Path: Entei data using the foimat below, the ShaiePoint seiveis host in-
foimation foi [host] and the ShaiePoint document libiaiys iepositoiy name
foi [repository path]
http://[host]/[repository path]
4. Click Save.
Te lef navigation panel of youi Documents and Media poitlet now lists
youi new iepositoiy.
4.5. MICROSOFT OFFICE INTEGRATION 123

ln the site path example below, notice howthe iepositoiy path


has a foldei Shared Documents consisting of two woids.
http://[host]/CMIS/Shared Documents/Forms/AllItems.aspx
Te space between the woids in the iepositoiy name must be
accounted foi when seuing the site path in Lifeiay. Replace the
empty space with the stiing %20 so the site path value now looks
like this
http://liferay-20jf4ic/CMIS/Shared%20Documents/Forms/AllItems.aspx
Tis should be done foi any multi-woid iepositoiy name.
Remembei that connecting to an exteinal ShaiePoint seivei and adding it as
a Documents and Media iepositoiy is a gieat way to give useis exibility foi
shaiing and collaboiating on Miciosof Oce documents.
To fuithei enhance youi use of Miciosof Oce documents with Documents
and Media, Lifeiay piovides integiation diiectly with Miciosof Oce. Lets
look at that next.
4.5 Microsoft Ofce integration
Lifeiay lets you open Miciosof Oce les that ieside in Documents and Media.
You can open the les fiom Miciosof lnteinet Exploiei oi open them diiectly
fiom youi Miciosof Oce applications. Lets open a le fiom youi biowsei
ist.
Lifeiay lets you launch Miciosof Oce iight fiomfoldeis in Documents and
Media. liist, nd the Miciosof Oce le that you want to edit. Ten click the
diop-down icon in the uppei-lef coinei of the documents thumbnail and click
the Open in MS Oce link. Lifeiay launches Miciosof Oce and piompts you
to log in using youi Poital ciedentials. Once logged in, the le opens in youi
Miciosof Oce application.
When you save the le, it is stoied automatically in the Documents and Me-
dia foldei fiom which you opened it.
Tis featuie cuiiently limits you to opening Documents and Media les
whose titles end in theii les extension (e.g., .doc, .docx, .xls, .xlsx, .ppt,
oi .pptx). See the ielated issue
1
foi moie infoimation.
1
hup//issues.lifeiay.com/biowse/LPS-31223
124 CHAPTER 4. DOCUMENT MANAGEMENT
Note that 4-bit Miciosof lnteinet Exploiei and 4-bit Miciosof Oce vei-
sions do not cuiiently suppoit this featuie. lt is only suppoited on 32-bit Mi-
ciosof lnteinet Exploiei veisions with 32-bit veisions of Miciosof Oce. See
the ielated issue
2
foi moie infoimation.
Next well show you how to navigate youi Documents and Media foldeis
and open a le fiom the Miciosof Oce application.
Lifeiay lets you access Miciosof Oce les in Documents and Media di-
iectly fiom youi Miciosof Oce applications. Lifeiay implements the MS-
DWSS ShaiePoint piotocol to allow saving and ietiieving documents fiom Lif-
eiay Poital as if it weie a ShaiePoint seivei. You can conveniently update youi
Miciosof Oce (Oce) les without having to exit youi Oce piogiam.
loi example, if you aie woiking in Miciosof Woid locally on youi machine,
you can open a le fiom Documents and Media to view oi edit it. Simply select
File Open in Woid and entei http://localhost:8080/sharepoint/ in
the le name eld. Click Open and log in using youi Poital ciedentials.
Figure 4.10: Enter the URL of your sharepoint location on Liferay to
access Documents and Media.
ln the list of foldeis displayed, navigate to guest document_library and
select All Files to see youi Documents and Media les. Open the desiied Woid
le to make changes. Click Save when you aie nished and close the le.
Now anyone with appiopiiate peimission can see the latest veision of the
le with these updates. Lifeiay takes caie of veision contiol as well as le check
out and check in. Useis can add comments, iatings, and tags.
Lifeiays integiation with Miciosof Oce lets useis leveiage Documents
and Media in managing theii Oce les. Collaboiation is simplied as useis
shaie theii most up-to-date veisions of Oce les.
Now lets look at conguiing the Documents and Media poitlet.
2
hup//issues.lifeiay.com/biowse/LPS-2818
4.6. CONFIGURING THE DOCUMENTS AND MEDIA PORTLET 12
4.6 Conguring the Documents and Media portlet
To conguie the Documents and Media poitlet, click on the wiench icon at the
top of the poitlet window and select Conguration. Te poitlet-specic cus-
tomizations appeai on the Setup tab. To change youi Documents and Media
poitlets top-level foldei, click Select next to Root Folder, biowse to the foldei
youd like to be youi new top-level foldei, and click Save. Te ioot foldei is the
highest-level foldei thats accessible fiomthe Documents and Media poitlet. loi
example, suppose you cieated a foldei called My Documents in the Documents
and Media poitlets default Home foldei. lf you set the My Documents foldei
to be youi poitlets new ioot foldei, the oiiginal Home foldei would no longei
be accessible.
By default, the Documents and Media poitlet contains a seaich bai to help
useis quickly nd ielevant les. lf youd like the seaich bai not to appeai,
uncheck the ShowSearch box. Te MaximumEntries to Display diopdown menu
lets you set a limit on how many foldeis and les can be displayed in the poitlet
window at once. By default, the Documents and Media poitlet contains thiee
display style views icon, list, and desciiptive. lcons foi each appeai in the poit-
let window, allowing useis to select the display style with which theyie most
comfoitable. Undei the Display Style Views heading, you can select which dis-
play styles useis aie able to choose and you can aiiange the oidei of the selected
display styles. Te topmost display style in the list becomes the poitlets default
display style.
Related assets aie enabled by default foi Documents and Media les. Related
assets allow useis to link assets togethei even if the assets dont shaie any tags
oi categoiies. To disable ielated assets foi les in youi Documents and Media
poitlet, uncheck the Related Assets box. loi moie infoimation on ielated assets,
see the section on dening content ielationships in chaptei .
Undei the ShowColumns heading, you can customize which columns appeai
when youi Documents and Media poitlet uses the list display style. By default,
le names, sizes, downloads, and actions aie displayed. You can also conguie
the poitlet to display les cieate dates and modied dates. To add oi iemove
columns fiombeing displayed, move themto the Cuiient box oi to the Available
box. You can aiiange the columns in the Cuiient box to contiol the oidei in
which the columns appeai in the poitlet the topmost column in the box appeais
as the lefmost column in the poitlet.
Comment iatings aie also enabled by default foi Documents and Media les.
lf useis decide that a ceitain comment about a le is useful oi infoimative, they
can iate it as good by clicking on the thumbs up icon next to the iating. lf they
12 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.11: To make portlet-specic congurations for Documents and
Media, click on the wrench icon at the top of the portlet windowand select
Conguration.
4.7. AUTOMATIC PREVIEWS AND METADATA 12
think the comment is unhelpful oi misleading, they can click on the thumbs
down icon. lf youd like to disable comment iatings foi les within youi poitlet,
uncheck the Enable Comment Ratings box.
4.7 Automatic Previews and metadata
Whenevei possible, Lifeiay .1 geneiates pieviews of documents added to the
Documents and Media libiaiy. Out of the box, Lifeiay only ships with Java-
based APls to geneiate pieviews foi documents. Te only tool available that is
100 Java and has a compatible license to be distiibuted with Lifeiay is PDl-
Box. liom a vanilla installation of Lifeiay .1, if you upload a PDl le to the
Documents and Media poitlet, Lifeiay will piocess the PDl in a sepaiate thiead
to geneiate a pieview. Tis piocess may last only a few seconds foi a small le.
Te laigei the le is, the longei it takes.
Te ist time you iun a conveision like this, look foi a console message that
indicates something like the following
Liferay is not configured to use ImageMagick for generating Document Library
previews and will default to PDFBox. For better quality previews, install
ImageMagick and enable it in portal-ext.properties.
While a default implementation of image geneiation foi document pieviews
and thumbnails is piovided via PDlBox, youll need to install and conguie
some additional tools to hainess the full powei of Lifeiays Documents and Me-
dia libiaiy. Tese tools include OpenOce oi LibreOce, ImageMagick, which
iequiies Ghostscript, and Xuggler. With these tools installed and conguied,
Documents and Media content is displayed using a customized viewei depend-
ing on the type of content. Conguiing Lifeiay to use OpenOce oi LibieOf-
ce in seivei mode allows you to geneiate thumbnails and pieviews foi sup-
poited le types (.pdf, .docx, .odt, .ppt, .odp, etc.), lets you view documents in
youi biowsei and lets you conveit documents. lmageMagick allows foi fastei
and highei-quality pieviews and conveisions. Xugglei allows foi audio and
video pieviews, lets you play audio and video les in youi biowsei and extiacts
thumbnails fiom video les. Please see the External Services section of chaptei
1 foi instiuctions on how to conguie Lifeiay to use these tools.
With the above tools installed and enabled, the Documents and Media libiaiy
looks like this
You can view a document with a customized viewei that allows you to nav-
igate thiough the dieient pages of the document and iead its content.
128 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.12: Previews in Documents and Media
You can view a multimedia document (audio oi video) and play it online. lf
the biowsei suppoits HTML, it uses the native playei of the biowsei. Othei-
wise it falls back to a llash playei.
Document pieviews aie poweiful and help useis biowse media moie suc-
cessfully to nd what theyie looking foi.
Automatic extraction of RAWMetadata
When adding new documents oi viewing existing documents, a piocess is tiig-
geied automatically that extiacts the les metadata. Te libiaiy used by this
piocess is TlKA and its alieady included in Lifeiay out of the box.
You can see the metadata when viewing the document, in the iight side of
the window.
Document type restrictions and workowper folder
You can foice useis to add only ceitain document types to a foldei. By default,
child foldeis inheiit the iestiictions of theii paient foldei. You can change this
behavioi by editing the foldei and selecting the allowed document types.
4.7. AUTOMATIC PREVIEWS AND METADATA 129
Figure 4.13: Viewing an ofce document
lf woikow is enabled, you can specify dieient woikow denitions pei
foldei. luitheimoie, you can specify dieient woikow denitions pei docu-
ment type and pei foldei. You can set this by editing the foldei. Ten the Ul
will look like this
Document types aie a poweiful way to enfoice iules foi documents uploaded
by useis. Next, well see a way to make it inciedibly easy foi useis to access
documents stoied in Lifeiays Documents and Media iepositoiies.
130 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.14: Playing a video
WebDAVaccess
Wouldnt it be gieat if you could access documents and foldeis belonging to
Lifeiays Documents and Media libiaiy fiom youi own machines le managei`
You can, thanks to the Documents and Media libiaiys WebDAV integiation.
WebDAV stands foi Web-based Distiibuted Authoiing and Veisioning. lts a
set of methods based on HTTP that allows useis to cieate, edit, move oi delete
les stoied on web seiveis. WebDAV is suppoited by most majoi opeiating
systems and desktop enviionments, including Linux (both KDE and GNOME),
Mac OS and Windows.
Suppose youve cieated an Image Gallery foldei using a Documents and Me-
4.7. AUTOMATIC PREVIEWS AND METADATA 131
Figure 4.15: Restrict Marketing folder to use specic document types
dia poitlet and uploaded some images to it. Poital useis with the appiopii-
ate peimissions can access this foldei, and the image les it contains, using a
biowsei and Lifeiays web inteiface. WebDAV piovides an alteinative way to
do this using a le managei instead of a web biowsei. To access a foldei stoied
in a Documents and Media poitlet on a iemote seivei, youll need log in cie-
dentials foi the poital and the WebDAV URL of the foldei youd like to access.
Next, navigate to the Documents and Media poitlet hosting the foldei youd
like to access. Mouse ovei the foldei (Image Gallery foi oui example) and select
Access from Desktop.
Copy the WebDAV URL. On Windows, iight-click on My Computei and se-
lect Map Network Drive. Select an unused diive, paste the WebDAV URL, and
click Finish. Youie piompted to entei youi Lifeiay ciedentials and then, pio-
vided you have the iequiied peimissions, the Image Gallery foldei appeais. You
can now add, edit, move oi delete les in this diiectoiy.
132 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.16: Restrict Marketing folder to use specic document types and
workow
Figure 4.17: Select Access fromDesktop to get the WebDAVURL of a folder.
4.8. LIFERAY SYNC 133
On Mac OS X, select Go Connect to Server in lindei. Ten entei the Web-
DAV URL of the foldei youd like to access in the Seivei Addiess eld, click
Connect and you should be piompted foi youi Lifeiay ciedentials.
On Linux, you must slightly modify the WebDAV URL of youi foldei in youi
le managei. loi KDEs Dolphin, change the URLs piotocol so that it says
webdav:// instead of http://. loi GNOMEs Nautilus, change the URLs pio-
tocol so that it says dav:// instead of http://. Ten piess Enter and youie
piompted foi youi Lifeiay ciedentials.
Note that Lifeiay inciements the veision numbeis of les edited and up-
loaded via WebDAV so you dont have to woiiy that using youi le managei
will bypass the functionality of Lifeiays web inteiface. Te Documents and
Media application is a poweiful way to manage any types of les youi useis
need to use. Next, lets look at how you can leveiage Lifeiay Poitals Asset
fiamewoik.
Now you know just how easy it is to stoie youi les using Lifeiays Docu-
ments and Media poitlet. ln the next section well ieviewsome ways to oiganize
and manage youi assets so youie geuing the most out of youi content.
4.8 Liferay Sync
Lifeiay Sync, ieleased in Septembei 2012, is an add-on pioduct foi Lifeiay .1 CE
and EE that synchionizes les between youi Lifeiay seivei and useis desktop
and mobile enviionments. With Lifeiay Sync, youi useis can publish and ac-
cess shaied documents and les fiom theii native enviionments without using
a biowsei. Windows and Mac OS desktops and Andioid and iOS-based mobile
platfoims aie cuiiently suppoited. As useis add and collaboiate on documents
and les, Lifeiay Sync automatically synchionizes them acioss all conguied
Sync clients. Lifeiay Sync is fully integiated into the Lifeiay Platfoim so that
featuies such as authentication, veisioning, woikow, and social collaboiation
function in the suppoited enviionments. Lifeiay Sync stoies les locally so that
theyie always available, even when youie oine. lt automatically synchio-
nizes youi les upon ieconnection.
Howdoes it work?
Lifeiay Sync manages documents and site infoimation thiough Lifeiay .1s
built-in web seivices. Clients secuiely communicate to Lifeiay using usei-supplied
ciedentials such that each usei can only access those documents and sites foi
134 CHAPTER 4. DOCUMENT MANAGEMENT
which they have peimission. Changes made thiough Lifeiay Sync aie imme-
diately available to the iest of the Lifeiay Platfoim, including useis accessing
Lifeiay thiough tiaditional web-based inteifaces.
loi desktop enviionments, a new foldei stiuctuie is cieated and used foi
synchionizing les. liles found theiein can be tieated as any oidinaiy le. Cie-
dentials, sync fiequency, and othei foldei options can be conguied in-client.
Native desktop notication events keep you abieast of what Sync is doing, and
native menu and taskbai integiation keep Sync contiols within easy ieach.
Mobile enviionments aie natuially dependent on the way in which docu-
ments aie handled. loi Andioid and iOS, documents aie maintained in a le
list, and can be viewed by clicking on the les themselves. Exteinal les ac-
cessible fiom othei apps can be opened using Lifeiay Sync, theieby diopping
them into youi Sync foldei and synchionizing them acioss othei Sync clients.
ln iOS devices, pulling down on the Sync le list foices a iefiesh. ln Andioid,
click on the Refresh icon within the menu.
Lifeiay Sync is designed to woik with both Lifeiay .1 Community Edition
and Enteipiise Edition. Using Sync with Lifeiay CE limits useis to syncing one
site. Using Sync with Lifeiay EE enables useis to synchionize documents and
les acioss all the sites which they can access.
Lifeiay Sync is also designed to woik with Lifeiay Social Oce. You can
sync one site fiom Social Oce CE as well as one site fiom Lifeiay Poital CE.
lf youve installed Social Oce CE on Lifeiay Poital EE, then you can sync any
site fiom Poital, but only one fiom Social Oce. lf youve installed Social Oce
EE on Lifeiay Poital EE, then you can sync any and all sites.
Installing Liferay Sync
loi Windows oi Mac OS, visit the Lifeiay Sync pioduct page Lifeiay Sync Piod-
uct Page, and click Get it Now (on the iight-side navigation menu) to download
the client application foi youi desktop enviionment. loi Windows, the client
application installei should be named liferay-sync-<version>-<date>.exe.
loi Mac OS, it should be liferay-sync-<version>-<date>.dmg. lollow the
on-scieen instiuctions of the installei wizaid to conguie youi client to connect
to an existing Lifeiay .1 deployment using youi Lifeiay ciedentials.
Windows
Upon launching the Windows application installei, youll be piompted to choose
an installation location foi Lifeiay Sync. Biowse to an appiopiiate location on
youi machine and click Next.
4.8. LIFERAY SYNC 13
Figure 4.18: Use the Liferay Sync Installation wizard to choose an
installation location.
Leave the Run Liferay Sync buuon checked to automatically stait Lifeiay
Sync afei you click Finish.
Te ist time you iun Lifeiay Sync, youll have to entei some account in-
foimation. Sync needs to know wheie youd like to locally stoie the les its
supposed to sync with youi Lifeiay seivei. And, of couise, it needs to know
youi seiveis URL and the account ciedentials with which it should authenti-
cate.
Te options foi the Mac OS application installei aie similai.
Mac OS
Lifeiay Sync foi Mac is packaged in a DMG le. Double-clicking on a DMG
mounts it as a disk image, and opens a window showing the contents of the
image. To install Sync, diag the Lifeiay Sync icon to the Applications foldei.
Once its installed, go to youi Applications foldei to iun it.
When you launch Lifeiay Sync, the ist thing you need to do is piovide it
with the URL foi the Lifeiay seivei that youll be using Sync with, along with
youi Lifeiay ciedentials. Afei that, youll need to iun thiough the biief setup
piocess that was desciibed above foi Windows.
13 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.19: Youll see the following screen once Liferay Sync has been
installed. Click Finish to exit the installation wizard.
Figure 4.20: The rst time you run Liferay Sync, youll have to tell it howto
communicate with your Liferay server.
4.8. LIFERAY SYNC 13
Figure 4.21: Drag the Liferay Sync icon to the Applications folder.
Once youve nished youi conguiation and have clicked OK, Lifeiay Sync
staits iunning in the backgiound, and an icon appeais in youi top menu bai.
lf you wish to change any of youi seuings, click the icon to open the Lifeiay
Sync menu and click on Preferences. Note that on Windows, the Sync menu says
Properties, not Preferences.
Mobile
loi iOS, visit the App Stoie, seaich foi Lifeiay, and install the Lifeiay Sync App.
loi Andioid, go to Google Play, seaich foi Lifeiay, and install the Lifeiay
Sync App.
Once the mobile apps aie installed, follow the on-scieen instiuctions as be-
low.
Using Liferay Sync on the Desktop
Once installed, youll see a Lifeiay Sync icon in youi taskbai whenevei its iun-
ning. Agieen checkmaik means Lifeiay Sync has a woiking connection to youi
Lifeiay seivei and is updating the les in youi Sync foldei accoiding to the in-
teival you specied in the wizaid. Click the Lifeiay Sync icon in youi taskbai
to biing up the menu.
Open Sync Folder opens youi Lifeiay Sync foldei in youi native le managei.
Open Website piovides links to the pages containing the Documents and Me-
dia poitlets which you have peimission to access. By default, you can nd links
138 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.22: You can provide the same information requested by the
Windows application installer.
to youi peisonal Documents and Media iepositoiy as well as links to the Doc-
uments and Media iepositoiies of all the othei sites you belong to.

Note foi administiatois lf you dont have a


Documents and Media poitlet anywheie on a site
thats been selected foi syncing, youll have to add
the poitlet. Otheiwise, useis will get a e re-
quested resource was not found eiioi when they
tiy to use the Open Website link fiom theii Sync
menus.
4.8. LIFERAY SYNC 139
Figure 4.23: Open the Liferay Sync taskbar menu to access the following
options.

Recent Files shows a list of iecently cieated oi modied les fiom all the
iepositoiies you can access.
Properties (Preferences, on Mac OS) lets you change piopeities like staiting
on login, desktop notications, and sync fiequency. lt also allows you to edit the
account infoimation you piovided when you staited Sync foi the ist time. loi
example, you can entei a new URL foi youi Lifeiay seivei and entei a dieient
set of Lifeiay ciedentials.
Teie aie thiee items listed in the General Seings section. Start Liferay Sync
on Login is checked by default. lf you dont want Sync to stait automatically,
uncheck this. Show Desktop Notications is also checked by default. Unless
you uncheck this, when a le that you have synced is changed, a small noti-
cation will appeai in the coinei of youi scieen. Te Check Server For Updates
Every: eld enables you to set how fiequently it will check to see if anything
has changed. Tis can be set anywheie between seconds and 30 minutes.
Click the Edit Seings buuon in the Account Seings section to specify youi
seiveis URL and entei youi Lifeiay ciedentials. Use the Test Connection but-
ton to make suie Lifeiay Sync can communicate with the seivei. Editing youi
seuings also allows you to specify youi Sync foldei, the foldei wheie Sync will
stoie les on youi machine. By default, les aie stoied in the liferay-sync sub-
140 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.24: Open the Liferay Sync menu and select Properties (Preferences,
on Mac OS) to edit the settings you congured during setup.
foldei of youi peisonal Documents foldei.
linally, the Site Seings section allows you to choose which sites you wish
to sync media fiom. By default, it will list all of the sites that you aie a membei
of, but you can uncheck any of those sites if you dont want to sync those les.
Sync Now instiucts Lifeiay Sync to check the Lifeiay seivei foi updates im-
mediately.
Pause Syncing instiucts Lifeiay Sync to suspend syncing until fuithei notice.
lf someone added a veiy laige le to one of youi shaied foldeis thats taking a
veiy long time to sync, you might want to use this option and iesume syncing
at a latei time.
About displays Lifeiay Sync veision infoimation, copyiight infoimation, and
4.8. LIFERAY SYNC 141
a link to Lifeiays home page.
Check for Updates checks to see if a new veision of Lifeiay Sync is avail-
able fiom lifeiay.com and allows you to set whethei oi not Lifeiay Sync should
automatically check foi updates.
Using your Sync folder
Once Lifeiay Sync has been conguied and is iunning, any les you add to oi
modify in youi Sync foldei aie automatically detected and uploaded to youi
Lifeiay seivei. Also, changes fiom othei useis aie downloaded to youi Sync
foldei.
Lifeiay Sync handles deletions via a special liferay-sync.deletions le.
Tis mechanism pievents useis fiom accidentally deleting shaied les. When
you delete les fiom youi Sync foldei, a .liferay-sync.deletions le is
cieated theie with the names of the les you deleted. Tis lets Lifeiay Sync
know that you dont want these les in youi Sync foldei, so it wont down-
load them the next time it syncs. Note that the les listed in youi .liferay-
sync.deletions le aie only local deletions. You can iemove entiies fiom
youi .liferay-sync.deletions le to have Lifeiay Sync download themthe
next time it syncs. Of couise, you can use Sync foi moie than just local dele-
tions. lf you have the iequiied peimissions, you can delete les fiom the seivei.
You can iun thiough the following exeicise to familiaiize youiself with how
to cieate, edit, download, and upload les with Lifeiay Sync. liist, open youi
Lifeiay Sync foldei in youi le managei (use the Open Sync Folder option of the
Lifeiay Sync menu fiom the taskbai), and cieate a new le called README.txt.
Edit this le and entei the woid test. Ten use the Sync now option of the Lif-
eiay Sync menu to make suie that youi README.txt le gets uploaded to youi
Lifeiay seivei. Next, check that you can access this le fiom youi Lifeiay site.
Open youi biowsei, navigate to youi Lifeiay site, and sign in with youi Lifeiay
account ciedentials. Ten, navigate to the contiol panel. Make suie the site
you chose to sync with is selected in the context menu selectoi and click on
Documents and Media. You should see youi README.txt le listed theie.
Download the le (click the small tiiangle icon at the top iight coinei of
the README.txt icon and select Download) to a convenient location on youi
machine and check that it still says test. Now open the README.txt le in youi
Sync foldei and edit it so that it says second test. Choose Sync now again, and
then go back to youi biowsei and iefiesh youi Documents and Media page.
Click on the README.txt icon, look at the infoimation displayed to the iight,
and youll see that its veision numbei has inciemented.
142 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.25: You can access the same les fromLiferay Sync that you can
fromLiferays web interface.
Download the le again, and youll see that it now says second testyoui
edit was uploaded to the seivei. You can be condent that this edit was also
downloaded by all othei Lifeiay Sync clients connected to youi site.
Demonstrating Liferay Sync Permissions
Lifeiay Sync uses the default Lifeiay peimissions to deteimine which les and
foldeis aie synced to the useis machine. Tis means that whatevei les a usei
can access fiom a ceitain site aie the ones that will be pulled down by Lifeiay
Sync if that site is selected in the Sync client. You can test the functionality of
Lifeiay Sync peimissions by peifoiming the following steps. liist, cieate a new
le on youi desktop called secret.txt. Entei the text classied information into
this le. Ten use youi biowsei to log into Lifeiay and cieate a new usei called
secretagent with the email addiess secretagent@liferay.com and the passwoid
test. Also, cieate a new piivate site called Secret Site. Ten assign the secretagent
usei to the Secret Site and giant the Site Administrator iole to this usei. Teie will
be no othei membeis of this site unless they aie assigned by an administiatoi.
Log in as the secretagent and use Go to Control Panel, select Secret Site in
the context menu selectoi, and click on Documents and Media. Ten upload the
4.8. LIFERAY SYNC 143
Figure 4.26: Updating a le through Liferay Sync increments the les
version number. You can viewa les version number through the web
interface.
secret.txt document.
Next, well conguie oui Lifeiay Sync client to log in with the secretagent
useis ciedentials and access the Secret Site. Open the Lifeiay Sync menu fiom
the taskbai and select Properties. Click on the Edit Seings buuon, choose a new
Sync foldei, entei youi seiveis URL, and entei the seciet agents ciedentials
secretagent@liferay.com and test. Lastly, uncheck all Lifeiay sites except the Se-
cret Site, and click OK. Conim that the secret.txt le that you uploaded to the
Secret Site, is downloaded to youi new Sync foldei. Open it and check that it
says classied information. lf you ieconguie youi Sync client connect to youi
Lifeiay instance using the ciedentials of anothei usei who doesnt belong to the
Secret Site, the secret.txt will not be downloaded. Congiatulations' Youve suc-
cessfully set up a Lifeiay Sync foldei that can only be accessed by the secretagent
usei and youi administiatois.
144 CHAPTER 4. DOCUMENT MANAGEMENT
Using Liferay Sync Mobile
Once youve installed Lifeiay Sync on youi Andioid oi iOS mobile enviionment,
youll be able to access the same functionality thats available when using Sync
on a desktop enviionment. Howevei, the inteiface dieis fiom that of the Sync
desktop clients.
Android
Afei installing Lifeiay Sync foi Andioid, an empty scieen appeais asking you
to set up the app. Tis scieen appeais whenevei piefeiences aie missing.
Figure 4.27: First screen
Touch the scieen and it displays the Seings view. You can always go back
to Seings by clicking on the wiench icon at the top iight coinei of the scieen.
Entei youi Lifeiay seivei ciedentials by lling in youi Login, Password, and
Server infoimation. Youi Login is eithei youi usei accounts email addiess oi
scieen name. Use the same ciedentials you use to log in to the poital in a
biowsei. ln the Server eld, entei youi poitals URL. ln this example, the seivei
URL is hp://www.liferay.com. Click the key icon on the top iight to test youi
connection and check if eveiything is coiiect.
Note foi Gingeibiead useis lf you cant see some of the featuies desciibed
heie, click on the menu buuon to viewa list of all possible actions. Tis includes
options to iefiesh, open the seuings menu, upload les, take photos, test youi
connection, etc.
Afei you have successfully tested youi connection, hit the back buuon and
youll see a list of Lifeiay sites you have access to.
4.8. LIFERAY SYNC 14
Figure 4.28: Android settings
Figure 4.29: Gingerbread
Figure 4.30: Sites
14 CHAPTER 4. DOCUMENT MANAGEMENT
You can biowse the les of a site by tapping on any of them. Tis opens a list
of the foldeis and les belonging to the site that you have peimission to view.
Figure 4.31: Folder and les
liom heie, you can click on a foldei and biowse deepei into the foldei hiei-
aichy oi click the Back buuon to navigate back to paient foldeis up to the initial
Sites list.
Single-tap on a le to open it. lf the le has nevei been downloaded befoie,
Sync will download it and open afei it has nished downloading. You can only
view the les contents if youi device has an app installed that can open the
le type. loi example, in oidei to open a PDl, you must have at least one PDl
viewei app installed. Otheiwise, you will see a message infoiming you that no
viewei is available and you need to install an app that can open the le.
Long-piess on any foldei oi le to nd a list of actions you can take on it
Add to Favorites, View Details, Download, Rename oi Delete. Tis actions menu
vaiies depending on which entiy type is selected le oi foldei.
On Gingeibiead, the actions menu looks like this
On lce Cieam Sandwich and above, you can nd the action icons and menu
at the top iight
Clicking on Add to Favorites (Gingeibiead) oi the giay stai (lce Cieam Sand-
wich) adds the selected le to the Favorites list. Favorites aie special les that
can be accessed and viewed even when you aie oine (moie details below). lf
a le is alieady maiked as a favoiite, youll see a Remove from Favorites oi blue
stai instead. Clicking on it iemoves the selected le fiom the Favorites list.
Clicking on View Details (Gingeibiead) oi the iound icon with the leuei i
(lce Cieam Sandwich) opens the details view, which displays the entiys meta-
data such as cieation date, authoi, veision, desciiption, etc.
4.8. LIFERAY SYNC 14
Figure 4.32: Gingerbread menu
Figure 4.33: ICS menu
Figure 4.34: Viewdetails
148 CHAPTER 4. DOCUMENT MANAGEMENT
lf you click on Download (oppy disk icon on lce Cieam Sandwich), it down-
loads and oveiwiites the local le copy.
You can iename a foldei oi le by clicking on the Rename option. Tis ie-
names the entiy in the poital.
Clicking on Delete deletes the le/foldei fiom the iemote poital, and othei
useis wont be able to view oi download it. On lce Cieam Sandwich and above,
you can select multiple entiies foi deletion
Figure 4.35: Actions
Some actions aie not ielated to a specic foldei oi le. You can nd these
actions in the menu on the top action bai when no entiy is selected (Gingeibiead
useis need to click on the device menu buuon). Depending on the device scieen
width, some icons may oveiow to the thiee dots buuon on the iight. Click on
this buuon to see all of the available actions.
Te Refresh buuon fetches and updates the list of foldeis and les that have
been changed in the poital.
Te Camera buuon allows you to quickly take a pictuie and upload the image
to the cuiient foldei. Te image le name is automatically geneiated with a time
stamp.
Te New Folder buuon asks you foi the name of the foldei you want to cieate
in the poital.
Te Upload buuon displays the types of local les you can upload to the
poital. Choosing Image, foi example, shows all images that aie stoied locally
on youi device. Once you choose the les and conim, these les aie uploaded
to the poital and aie placed in the cuiient foldei. By default, you can upload
images, videos, and audio les. lf you have installed an app on youi device that
4.8. LIFERAY SYNC 149
Figure 4.36: More options
can open and biowse any type of le, you will also see an option called Other
les.
Figure 4.37: Upload local les
Te Favorites menu option opens the favoiites list. All les that have been
maiked as favoiites show up in this list. You should maik youi most impoitant
les as favoiites because, as mentioned eailiei, the Favorites featuie gives you
quick oine access to them. You can view the contents of items in the Favorites
list, view theii metadata and, of couise, iemove them fiom the list.
Next, lets look at the iOS Sync app.
10 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.38: Favorites
iOS
Afei installing Lifeiay Sync foi iOS, an empty scieen appeais asking you to set
up the app. Tis scieen appeais whenevei piefeiences aie missing.
Figure 4.39: iOS Settings
Click on Seings in the toolbai and entei youi Lifeiay seivei ciedentials by
lling in youi Login, Password, and Server infoimation. Youi Login is eithei youi
usei accounts email addiess oi scieen name, whichevei you use to log in to the
poital in a biowsei. ln the Server eld, entei youi poitals URL. ln this example,
the seivei URL is hp://www.liferay.com. Click on Test Connection to check if
youi conguiation is coiiect.
Afei you have successfully tested youi connection, tap on the Documents
toolbai section and youll see a list of Lifeiay sites you have access to.
You can biowse the les of a site by tapping on its name oi icon. Tis opens
a list of the foldeis and les belonging to the site that you have peimission to
4.8. LIFERAY SYNC 11
Figure 4.40: iOS Settings
Figure 4.41: Sites
view.
liom heie, you can click on a foldei to biowse deepei into the foldei hiei-
aichy. You can also click on the Back buuon to navigate back to paient foldeis
up to the initial Sites list.
You can iefiesh the list by pushing it down. Tis updates all the les and
foldeis that have been changed in the poital.
When you click on a le, this le is downloaded fiom the iemote poital and,
if a pieviewei foi this le type is available, you can view the contents of the le.
Te next time you open a le, it wont download it again, instead, it opens the
local copy.
Teie aie thiee icons at the bouomof the scieen when you open a le. Click-
ing on the lefmost iound icon with the leuei i opens the details view, which
displays the entiys metadata such as cieation date, authoi, veision, desciiption,
etc.
Clicking on the stai icon at the centei adds the selected le to the Favorites
12 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.42: Folder and les
Figure 4.43: Refreshing
Figure 4.44: Opening a le
4.8. LIFERAY SYNC 13
Figure 4.45: Viewdetails
list. Favorites aie special les that can be accessed and viewed even when you
aie oine (moie details below). lf a le has alieady been maiked as a favoiite,
clicking on the stai icon iemoves the le fiom the Favorites list.
Clicking on the iightmost icon displays shaiing options. You can, foi ex-
ample, send the le as an email auachment, piint the le, oi copy it to youi
clipboaid. Some exteinal apps may also appeai in this list. loi example, you
can shaie youi le with social apps and messengeis if they aie available.
Figure 4.46: Share options
ln the le list, theies an Edit buuon. Clicking on it switches the app to the
edit mode as shown below
Selecting one oi moie les oi foldeis and clicking on the Delete buuon deletes
the selected les oi foldeis fiom the iemote poital. Once you delete les oi
foldeis fiom the iemote poital, othei useis wont be able to view oi download
them.
14 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.47: Edit mode
Selecting only one le oi foldei enables the Rename buuon. Click on it to
change the entiys name locally and iemotely.
To quickly delete a le oi foldei fiom the poital, you can also swipe iight
and click on the Delete buuon in the le list view
Figure 4.48: Deleting a le
lf you want to upload an image oi video to the poital, click the Plus buuon
at the top iight coinei. You should see thiee options
Take a photo or video opens youi cameia app and lets you take a photo oi
iecoid a video and upload it.
Choose Existing allows you to upload multiple photos oi videos stoied on
youi device.
Create New Folder lets you type the name of the foldei and cieates it in the
poital.
Te Favorites toolbai section opens the favoiites list. All les that have been
maiked as favoiites show up in this list. You should maik youi most impoitant
4.9. SUMMARY 1
Figure 4.49: Upload photos and videos
les as favoiites because, as mentioned eailiei, the Favorites featuie gives you
quick oine access to them. You can view the contents of items in the Favorites
list, view theii metadata and, of couise, iemove them fiom the list.
Figure 4.50: Favorites
All downloaded les aie stoied on youi device indenitely.
lf you want to delete downloaded les locally but dont want to iemove them
fiom the poital, go to Seings and click on the Clear Cache buuon.
4.9 Summary
ln this chaptei, we examined Lifeiays Documents and Media Libiaiy, a pow-
eiful and customizable viitual shaied diive. Lifeiay .1 intioduced the ability
to mount multiple exteinal iepositoiies to the Documents and Media libiaiy.
Te Documents and Media libiaiy can be used to stoie les of any kind. Te
1 CHAPTER 4. DOCUMENT MANAGEMENT
Figure 4.51: Deleting local copies
Documents and Media Display poitlet is meant to be conguied to show cho-
sen hieiaichies of foldeis and les fiom the Documents and Media libiaiy. Te
Media Galleiy is meant foi piesenting media les such as images oi videos.
Document types and metadata sets piovide a exible way to distinguish be-
tween dieient types of les and to dene custom metadata elds foi them.
Document pieviews aie automatically geneiated by default, but Lifeiay sup-
poits integiation with exteinal tools that oei gieatei speed, highei quality, and
additional functionality. linally, we discussed Lifeiay Sync, an add-on pioduct
foi Lifeiay .1 that allows youi Lifeiay seivei to diiectly synchionize les on
useis desktop and mobile enviionments.
Cu~v1rv
Lrvrv~ciNc 1ur Assr1 lv~xrvovx
Any type of content in Lifeiay is consideied an asset. ln chapteis 2 and 3, we al-
ieady examined Lifeiays most common type of asset web content. Othei types
of assets include blog posts, wiki aiticles, message boaid posts, bookmaiks, and
documents. lts possible foi developeis to dene custom asset types that uti-
lize Lifeiays asset fiamewoik. Oiiginally, the asset fiamewoik was cieated to
piovide a mechanism foi adding tags to blog entiies, wiki aiticles, and web con-
tent without ieimplementing the same functionality multiple times. Te asset
fiamewoik has been gieatly extended since then and it now suppoits tags, cat-
egoiies, vocabulaiies, comments, iatings, and asset ielationships.
Tis chaptei coveis the following topics
Tagging and categoiizing content
Using taigeted, single value, and multi-value vocabulaiies
Using laceted Seaich
Using the Asset Publishei
Seuing up display pages
Adding ielationships between assets
1
18 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
Te Asset Publishei poitlet is designed to display multiple assets. lt has
quite a few conguiation options which well covei in this chaptei. By default,
abstiacts (pieviews) of iecently published assets aie displayed by the Asset Pub-
lishei poitlet and links to theii full views aie piovided. You can conguie the
Asset Publishei poitlet to display a table of assets, a list of asset titles, oi the full
content of assets. You can also conguie the Asset Publishei to display only
ceitain kinds of assets and you choose how many items to display in a list. Te
Asset Publishei poitlet is veiy useful foi displaying chosen types of content, foi
displaying iecent content, and foi allowing useis to biowse content by tags and
categoiies. Te Asset Publishei is designed to integiate with the Tags Naviga-
tion and Categoiies Navigation poitlets to allow this.
5.1 Tagging and Categorizing Content
Tags and categoiies aie two impoitant tools you can use to help oiganize in-
foimation on youi poital and make it easiei foi youi useis to nd the content
theyie looking foi thiough seaich oi navigation. Tagging and categoiizing web
content is easy. You can do it at the bouom of the same foim you use to add
content. lf you open the Categorization section of the foim, youll be piesented
with an inteiface foi adding tags and categoiies.
Figure 5.1: Tagging and categorizing content can be done at the same time
you create it.
Te Contiol Panel contains an inteiface foi managing tags and categoiies foi
each site in the poital. Tis inteiface can be used to manage all youi tags and
categoiies in one place. lt is impoitant that you both tag and categoiize youi
content when you entei it. Lets take a closei look at tags and categoiies.
5.1. TAGGING AND CATEGORIZING CONTENT 19
Tags
Tags aie an impoitant tool that you can use to help oiganize infoimation on youi
poital and make it easiei foi youi useis to nd content that theyie looking foi.
Tags aie woids oi phiases that you can auach to any content on the website.
Tagging content will make youi seaich iesults moie accuiate, and enable you
to use tools like the Asset Publishei to display content in an oiganized fashion
on a web page. Teie aie two ways to cieate tags you can do it thiough the
administiative console in the Contiol Panel, oi on the y as content is cieated.
Figure 5.2: The Add Tag Dialog
To cieate tags in the Contiol Panel, select the site that you want to cieate tags
foi, and select Tags. liom this scieen, you will be able to view any existing tags
and make new ones. To cieate a new tag, simply click Add Tag. Youll then be
asked foi the name of the tag, and youll have the ability to set peimissions foi
viewing oi managing the tag. You can also add piopeities to a tag. Piopeities
10 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
basically act like tags foi youi tags. Stiuctuially, piopeities aie key-value paiis
associated with specic tags that piovide infoimation about youi tags. You can
edit existing tags fiomthe Tags windowof on the Contiol Panel. You can change
the tag name, change the tags peimissions, delete the tag, oi add piopeities.
Tags aie not the only poital-wide mechanism foi desciibing content you
can also use categoiies.
Categories
Categoiies aie similai in concept to tags, but aie designed foi use by administia-
tois, not iegulai useis. Hieiaichies of categoiies can be cieated, and categoiies
can be giouped togethei in vocabularies. While tags iepiesent an ad hoc method
foi useis to gioup content togethei, categoiies exist to allow administiatois to
oiganize content in a moie ocial, hieiaichical stiuctuie. You can think of tags
like the index of a book and categoiies like its table of contents. Both seive the
same puipose to help useis nd the infoimation they seek.
Adding vocabulaiies and categoiies is similai to adding tags. Once youve
selected the site you want to woik on, select Categories fiomthe content section
of the Contiol Panel, and you will be piesented with the categoiies administia-
tion page.
Figure 5.3: Categories Administration Page
Clicking on a vocabulaiy on the lef displays any categoiies that have been
cieated undei that vocabulaiy. You can cieate newvocabulaiies simply by click-
ing Add Vocabulary and pioviding a name foi it. You can cieate categoiies in
a similai fashion by choosing a vocabulaiy on the lef, and then selecting Add
Category. Like tags, you can also piovide piopeities foi categoiies. Once you
5.2. TARGETED VOCABULARIES 11
have cieated some vocabulaiies and categoiies, you can take advantage of the
full capabilities of categoiies by cieating a nested hieiaichy of categoiies. To
nest categoiies, select what you want to be the paient categoiy, then diag any
categoiy that you want to become a child categoiy onto it. You will see a plus
sign appeai next to the name of the categoiy you aie diagging if you can add it
to the selected paient categoiy, if you see a ied x that means that you cannot
add that categoiy as a subcategoiy of paient categoiy that you have selected.
Once you have cieated a hieiaichy of categoiies, youi content cieatois will
have them available to apply to content that they cieate. Navigate to the Web
Content page of the Contiol Panel and click Add Content. Click the Categoiiza-
tion link fiom the iight-side menu and click Select on the vocabulaiy you would
like to use. A dialog box will appeai with youi categoiies. Select any ielevant
categoiies by checking the box next to them, and they will be applied to the
content.
Teie aie a seveial new enhancements to vocabulaiies and categoiies in Lif-
eiay .1. Te thiee main featuies aie taigeted vocabulaiies, single/multi-valued
vocabulaiies, and sepaiated widgets foi eveiy vocabulaiy.
5.2 Targeted Vocabularies
Taigeted Vocabulaiies allow you to decide which vocabulaiies can be applied to
an asset type and which vocabulaiies aie iequiied foi an asset type. To cong-
uie these seuings, go to the categoiies administiation page and mouse ovei the
vocabulaiy in the list until you see the edit icon to the iight. Select the icon to
ieveal a dialog box like the one below.
Te default value foi Associated Asset Types is All Asset Types. You can ne
tune youi choices by using the + and - buuons, which naiiows the scope of the
vocabulaiy to specic assets. ln the scieenshot above, notice how the vocabu-
laiy Famous Noses is conguied to be available foi Blogs and Web Content,
but it is not iequiied. lt is mandatoiy, howevei, foi Documents and Media Doc-
uments.
Single and Multi-valued Vocabularies
You can nowdecide if the usei can choose one oi moie categoiies fiomthe same
vocabulaiy to categoiize an asset. lf a vocabulaiy is single-valued you can only
choose one, and if it allows moie, you can choose seveial categoiies.
Seuing vocabulaiy values is done thiough the categoiies administiation page.
Edit a vocabulaiy and deselect the AllowMultiple Categories checkbox to set sin-
12 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
Figure 5.4: You can target vocabularies by checking the AllowMultiple
Categories checkbox and then selecting the Asset Types.
Figure 5.5: Single-valued vocabularies, on the left, use radio buttons while
multi-valued vocabularies use checkboxes.
5.3. USING FACETED SEARCH 13
gle value vocabulaiies oi use the default option to set multi-value vocabulaiies.
Separated Widgets
Te thiid impoitant impiovement is eveiy vocabulaiy has its own sepaiated
widget. Tese widgets appeai in the Categoiization section of eveiy asset and
they allow useis to easily select appiopiiate categoiies foi that asset.
Figure 5.6: Nowthat vocabularies have their own widgets, its easy to
select available categories.
lts impoitant to use tags and categoiies with all youi content, so that content
is easiei foi useis to nd. Lets look at one of the ways useis will make use of
tags and categoiies seaiching foi content.
5.3 Using Faceted Search
To stay oiganized, l (RS) used to use a papei-based plannei. lt had vaiious sec-
tions foi vaiious aieas of my life. lts initial incaination came fiom a commeicial
14 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
company, but ovei the yeais l tweaked it into something that woiked foi me.
Tis nal veision (befoie l went digital) had dieient tabs foi dieient aieas of
my life that l wanted to keep tiack of daily items like tasks, notes, a spiiitual
section, and agenda pages that kept tiack of things l needed to go ovei with
specic people. A Planning section had tabs foi piojects, family, futuie items,
and iefeience.
Of couise, since this was papei-based, it had its limitations. lt was kind of
haid to nd stu. Did l put the note ld wiiuen about that new toy my daughtei
wanted in the Notes section oi in the lamily section` Oi maybe it was on my
While Out list, so l would iemembei to buy it befoie hei biithday`
Lifeiay content can be like this. Tat impoitant infoimation you iemembei
seeingwas it in a wiki aiticle, a message boaids post, oi web content` Did you
iemembei to tag it` lf you dont have this kind of infoimation, biowsing to
the content youie looking foi could be dicult. Tankfully, Lifeiay includes
a poweiful, faceted seaich function, which means you can diill down thiough
the dieient types of content, tags, and categoiies to iene youi seaich and nd
what you want. Lets see how to use it.
Searching for Portal Content
To get staited, diop the Seaich poitlet on a page and seaich foi something. Youll
see a page with iesults on the iight and a collection of facets on the lef.
Figure 5.7: The rst set of facets is content types. You can drill down to
specic types of content that contain the search terms you entered.
A facet is a combination of the infoimation about a specic indexed eld, its
teims, and theii fiequency. lacets aie typically named by the eld in question.
Te default facets aie asset types (pictuied above), asset tags, asset categoiies,
and modied time iange.
Te fiequency in which the teim was found foi each facet is listed in paien-
theses afei the facet. lt may jog youi memoiy to see that the teimyou seaiched
foi appeais in a blog entiy, and that may be all you need to nd what you weie
looking foi. lf, howevei, youi memoiy is moie foggy than that, oi youie seaich-
ing foi something youie not suie is actually theie, then the asset tags oi asset
categoiies facets may be moie helpful to you.
5.3. USING FACETED SEARCH 1
Figure 5.8: Asset tag facets provide you with more information list, and
the results to the right are rened by the facet you selected.
Figure 5.9: Drilling down creates a list of what you selected at the top of
the screen.
1 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
Heie we can see that weve selected one of the tags, liferay, to fuithei iene
the seaich. Te tag appeais in a list at the top, and theies a ied X next to it
that lets us iemove it fiom oui ltei as we woik to inciease the ielevancy of oui
seaich. But maybe selecting only the tag isnt enough to ltei oui seaich into
something small enough to soit thiough. ln this case, we can fuithei iene the
seaich by selecting anothei facet, as below.
Figure 5.10: Selecting another facet further renes the search.
Nowweve selected web content, which is one paiticulai content type within
Lifeiay, and the list of potential hits on oui seaich teims has been diamatically
ieduced. ln this way, you can inteiactively tweak the seaich iesults to naiiow
them down, making it easiei to nd that pioveibial needle within the haystack.
Asset Types
Seaiching can only be done on assets. As has alieady been desciibed in this
chaptei, just about any entity in the poital is an asset and can be indexed and
seaiched. Undei the hood, this means that these entities use Lifeiays Asset APl
and have an lndexei dened.
Developeis can cieate custom seaichable assets within the poital. Tis is
desciibed in the Developeis Guide. loi this ieason, you may have additional
asset types dened in youi poital beyond the ones that Lifeiay ships with by
default. lf this is the case, you may wish to tweak the frequency threshold
and the max terms seuings to inciease the numbei of asset types displayed past
the default of 10. Tis is coveied in the section below on seaich options.
5.3. USING FACETED SEARCH 1
Asset Tags
lf tags have been applied to any asset that appeais in the iesult set, it may be
displayed in the Asset Tag facet. Tags aie handled in a similai way to how asset
types aie handled not all tags may appeai. Teie may be many moie than the
10 tags listed, but the default conguiation foi this facet is to show the top 10
most fiequent teims. As with asset types, this can be modied by seuing max
terms piopeity.
Asset Categories
lf categoiies have been applied to any asset that appeais in the iesult set, they
may be displayed in the Asset Categoiies facet. Yadda, yadda, yadda, same thing
as the two sections above. Tat last sentence was wiiuen to check if youie still
ieading.
Lets move on to advanced seaiching.
Advanced Searching
Te Seaich poitlets seaich box is deceptively simple. Tough you have only a
single eld foi seaich, theies a seaich syntax inheiited fiom Lucene that lets
you cieate veiy poweiful seaich queiies. Lets look at some ways you can use
seaich queiies.
Searing for specic elds: By default, seaiches aie peifoimed against a
long list of elds. Sometimes you want iesults foi a teim within a paiticulai
eld. Tis can be achieved using the eld seaich syntax [field]:[term]. loi
example, to seaich in the Title eld foi Liferay, use the following syntax
title:liferay
lf you seaich foi a phiase within a eld, suiiound the teim with double
quotation maiks
title:"Liferay Portal"
Wildcards: You can use wildcaids in exactly the way you use them with
youi opeiating system foi a single chaiactei wildcaid, use ?, foi the multiple
chaiactei wildcaid, use *.
Boolean operators: You can use logic opeiatois, such as AND, OR, NOT, +,
and - in youi seaiches. Te AND opeiatoi matches assets in which the teims
between the AND opeiatoi exist. loi example, to seaich foi both Lifeiay and
Kaleo Woikow, use this queiy
18 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
"liferay" AND "kaleo workflow"
Te OR opeiatoi is the default, if theies no opeiatoi between two teims, the
OR opeiatoi takes eect. OR nds matches if any teim exists in an asset.
Te + opeiatoi iequiies that the teim exists somewheie in some eld in the
asset. lf you wanted to seaich foi something that must contain liferay and may
contain portal, use this queiy
+liferay portal
Te NOT opeiatoi excludes assets that contain the teimafei the NOT opeiatoi.
lt iequiies that at least two teims be piesent
"Liferay Portal" NOT "Liferay Social Office"
Te - opeiatoi is similai it excludes assets that contain the teim afei the -
symbol
"Liferay Portal" - "Liferay Social Office"
Grouping: You can use paientheses within youi queiies to foimsub-queiies,
in a similai fashion to an SQL statement. loi example, to seaich foi liferay oi
social oce and website, use this queiy
(liferay OR "social office") AND website
As you can see, the seaich syntax is veiy poweiful. Teies moie you can
do with it than what is listed heie, to view the full syntax, visit the Lucene URL
above.
Next, well look at how the Seaich poitlet can be conguied.
Setting Search Options
As with Lifeiays othei poitlets, you can conguie the Seaich poitlet via the
conguiation scieen, which looks like the below illustiation.
Display Asset Type Facet: Toggles whethei the Asset Type facet appeais.
Display Asset Tags Facet: Toggles whethei the Asset Tags facet appeais.
Display Asset Categories Facet: Toggles whethei the Asset Categoiies facet
appeais.
Display Modied Range Facet: Toggles whethei the date modied iange
facet appeais.
Display Results in Document Form: Nevei use this in pioduction. Develop-
eis use this featuie to view seaich iesponses in theii geneiic, Document-based
5.3. USING FACETED SEARCH 19
Figure 5.11: Basic search conguration is pretty straightforward.
foimat. Pait of a developeis job when wiiting seaich indexeis is to conveit
Documents (the objects that get indexed) to the actual object and back again.
Tis option allows developeis to see how theii objects aie being indexed.
View in Context: When an asset is clicked, show it in the poitlet to which
it belongs.
Display Main ery: Showthe exact seaich queiy that the poitlet geneiated
to the seaich engine. Again, nevei use this in pioduction, this is foi development
puiposes only.
Display Open Sear Results: Shows iesults fiom thiid paity Open Seaich
plugins, if they aie installed. Tis is foi backwaid compatibility only developeis
aie encouiaged to ie-design theii seaich code as desciibed in Liferay in Action,
and then custom assets aie aggiegated with native poital assets seamlessly.
Tese aie the basic options, but suiely you didnt miss the fact that theie aie
also advanced options.
Conguiing advanced seaich iequiies a bit moie technical acumen than you
might expect, because theie aie so many piopeities to tweak. Tankfully, in
most instances, you shouldnt need to change a thing. lf you do, howevei, the
conguiation is done thiough a JSON object.
10 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
lf you dont know what a JSON object is, dont woiiy its not a dicult
concept. JSON stands foi JavaSciipt Object Notation. An Object is a sofwaie
development teim foi anything that can be iepiesented in code. Objects have
aributes, oi sometimes these aie called elds, and they aie veiy similai to elds
youd nd on a foim that youie lling out. Sofwaie developeis use the woid
object to iefei geneiically to anything like this that they can desciibe in the
sofwaie, foi all intents and puiposes, objects could just as easily have been
called Tings. loi example, one type of object used in Lifeiay is a Usei. A Usei
can be iepiesented in code, and it has many elds, such as a name, an email
addiess, and moie. JSON is one way of desciibing objects like this.
Te object weie conceined with is called facets. Heies what it looks like,
in all its gloiy, in JSON. Explanation of the seuings follows the object below.
{"facets": [
{
"displayStyle": "asset_entries",
"weight": 1.5,
"static": false,
"order": "OrderHitsDesc",
"data": {
"values": [
"com.liferay.portlet.bookmarks.model.BookmarksEntry",
"com.liferay.portlet.blogs.model.BlogsEntry",
"com.liferay.portlet.calendar.model.CalEvent",
"com.liferay.portlet.documentlibrary.model.DLFileEntry",
"com.liferay.portlet.journal.model.JournalArticle",
"com.liferay.portlet.messageboards.model.MBMessage",
"com.liferay.portlet.wiki.model.WikiPage",
"com.liferay.portal.model.User"
],
"frequencyThreshold": 1
},
"label": "asset-type",
"className": "com.liferay.portal.kernel.search.facet.AssetEntriesFacet",
"fieldName": "entryClassName"
},
{
"displayStyle": "asset_tags",
"weight": 1.4,
"static": false,
"order": "OrderHitsDesc",
"data": {
"maxTerms": 10,
"displayStyle": "list",
"frequencyThreshold": 1,
"showAssetCount": true
},
"label": "tag",
"className": "com.liferay.portal.kernel.search.facet.MultiValueFacet",
"fieldName": "assetTagNames"
},
{
5.3. USING FACETED SEARCH 11
"displayStyle": "asset_tags",
"weight": 1.3,
"static": false,
"order": "OrderHitsDesc",
"data": {
"maxTerms": 10,
"displayStyle": "list",
"frequencyThreshold": 1,
"showAssetCount": true
},
"label": "category",
"className": "com.liferay.portal.kernel.search.facet.MultiValueFacet",
"fieldName": "assetCategoryTitles"
},
{
"displayStyle": "modified",
"weight": 1.1,
"static": false,
"order": "OrderHitsDesc",
"data": {
"ranges": [
{
"range": "[past-hour TO *]",
"label": "past-hour"
},
{
"range": "[past-24-hours TO *]",
"label": "past-24-hours"
},
{
"range": "[past-week TO *]",
"label": "past-week"
},
{
"range": "[past-month TO *]",
"label": "past-month"
},
{
"range": "[past-year TO *]",
"label": "past-year"
}
],
"frequencyThreshold": 0
},
"label": "modified",
"className": "com.liferay.portal.kernel.search.facet.ModifiedFacet",
"fieldName": "modified"
}
]}
Now that youve seen the object, dont be daunted by it. Heie aie all the
seuings within the object that you can tweak.
className: Tis eld must contain a stiing value which is the lQCN (fully
qualied class name) of a java implementation class implementing the lacet
12 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
inteiface. Lifeiay piovides the following implementations by default
com.liferay.portal.kernel.search.facet.AssetEntriesFacet
com.liferay.portal.kernel.search.facet.ModifiedFacet
com.liferay.portal.kernel.search.facet.MultiValueFacet
com.liferay.portal.kernel.search.facet.RangeFacet
com.liferay.portal.kernel.search.facet.ScopeFacet
com.liferay.portal.kernel.search.facet.SimpleFacet
data: Tis eld takes an aibitiaiy JSONobject (a.k.a. ) foi use by a specic
facet implementation. As such, theie is no xed denition of the data eld. Each
implementation is fiee to stiuctuie it as needed. Te value dened heie matches
the implementation thats selected in the className auiibute above.
displayStyle: Tis eld takes a stiing value and iepiesents a paiticulai
template implementation which is used to iendei the facet. Tese templates aie
noimally JSP pages (but can also be implemented as Velocity oi lieemaikei tem-
plates piovided by a theme if the poital piopeity theme.jsp.override.en-
abled is set to true). Te method of matching the stiing to a JSP is simply done
by piexing the stiing with /html/poitlet/seaich/facets/ and appending the .jsp
extension.
loi example, "displayStyle": "asset_tags" maps to the JSP
/html/portlet/search/facets/asset_tags.jsp
Aimed with this knowledge a ciafy developei could cieate custom display
styles by deploying custom (new oi oveiiiding) JSPs using a JSP hook. See the
Developers Guide oi Liferay in Action foi moie infoimation on hook plugins.
eldName: Tis eld takes a stiing value and denes the indexed eld on
which the facet opeiates.
loi example, "fieldName": "entryClassName" indicates that the speci-
ed facet implementation opeiates on the entryClassName indexed eld.
Note: You can identify available indexed elds by enabling the Seaich poit-
lets Display Results in Document Formconguiation seuing and then expanding
individual iesults by clicking the [] to the lef of theii titles.
label: Tis eld takes a stiing value and iepiesents the language key that
is used foi localizing the title of the facet when its iendeied.
order: Tis eld takes a stiing value. Teie aie two possible values
OrderValueAsc Tis tells the facet to soit its iesults by the teim values,
in ascending oidei.
OrderHitsDesc Tis tells the facet to soit its iesults by the teimfiequency,
in descending oidei.
static: Tis eld takes a boolean value (true oi false). Te default value
is false. A value of true means that the facet should not actually be iendeied
5.3. USING FACETED SEARCH 13
in the Ul. lt also means that it should use pie-set values (stoied in its data eld)
iathei than inputs dynamically applied by the end usei. Tis allows foi the
cieation of pie-conguied seaich iesults.
lmagine you would like to cieate a pie-conguied seaich that ietuins only
images (i.e. the asset type is DLFileEntry and the indexed eld extension should
contain the values bmp, gif, jpeg, jpg, odg, png, oi svg). We would need two
static facets, one with eldName entiyClassName and anothei with eld-
Name extension. Tis could be iepiesented using the following facet con-
guiation
{
"displayStyle": "asset_entries",
"static": true,
"weight": 1.5,
"order": "OrderHitsDesc",
"data": {
"values": [
"com.liferay.portlet.documentlibrary.model.DLFileEntry"
],
"frequencyThreshold": 0
},
"className": "com.liferay.portal.kernel.search.facet.AssetEntriesFacet",
"label": "asset-type",
"fieldName": "entryClassName"
},
{
"displayStyle": "asset_entries",
"static": true,
"weight": 1.5,
"order": "OrderHitsDesc",
"data": {
"values": ["bmp", "gif", "jpeg", "jpg", "odg", "png", "svg"],
"frequencyThreshold": 0
},
"className": "com.liferay.portal.kernel.search.facet.MultiValueFacet",
"label": "images",
"fieldName": "extension"
}
weight: Tis eld takes a oating point (oi double) value and is used to
deteimine the oideiing of the facets in the facet column of the seaich poitlet.
lacets aie positioned with the laigest values at the top. (yes, the cuiient imple-
mentation is countei-intuitive and peihaps could be ieveised in futuie veisions).
Conguiing seaich using a JSON object is a bit unusual, but as you can see,
its not as haid as it looks initially.
14 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
Summary
Seaich is a poweiful component of Lifeiay Poitals asset fiamewoik. Te pio-
clivity of assets means that theie is an extensible, iobust, and conguiable seaich
mechanism thioughout the poital that allows administiatois to optimize the
seaich expeiience of theii useis. Useis also get an easy to use seaich inteiface
that makes use of the tags and categoiies that they themselves apply to vaiious
pieces of content, iegaidless of the type of content. Tis makes Lifeiays seaich
tiuly foi the people.
Powei useis can leain an extended seaich syntax that lets them ciaf veiy
specic seaiches. Tese seaiches can be used on laige installations with lots of
data to nd the pioveibial needle in the pioveibial haystack. Administiatois
can tune the conguiation of seaich poitlets so that they aie optimized foi the
contents of theii communities.
Next, well look at how the Asset Publishei poitlet makes even moie exten-
sive use of Lifeiays asset fiamewoik to biing ielevant content to useis.
5.4 Using the Asset Publisher
As we cieate web content, its impoitant to keep in mind that to Lifeiay, the
pieces of content aie assets, just like message boaid entiies and blog posts. Tis
allows you to publish youi web content using Lifeiays Asset Publishei.
You can use the Asset Publishei to publish a mixed gioup of vaiious kinds of
assets such as images, documents, blogs, and of couise, web content. Tis helps
in cieating a moie dynamic web site you can place usei-cieated wiki entiies,
blog posts oi message boaid messages in context with youi content. Lets look
at some of its featuies.
Querying for Content
Te Asset Publishei poitlet is a highly conguiable application that lets you
queiy foi mixed types of content on the y. By giving you the ability to contiol
what and how content is displayed fiom one location, the Asset Publishei helps
you to bubble up the most ielevant content to youi useis.
To get to all the poitlets options, click the Conguration link in the poitlets
menu (the wiench icon).
Te ability to conguie how content is displayed and selected by youi useis
fuithei demonstiates the exibility of the Asset Publishei. You get to choose
how content is displayed. You can select it manually foi display in a similai
5.4. USING THE ASSET PUBLISHER 1
way to the Web Content Display poitlet oi you can set up piedened queiies
and lteis and let the poital select the content foi you, based on its type oi its
tags and categoiies.
Lets ist look at how we might select content manually. Youll see that its
veiy similai to the Web Content Display poitlet.
Selecting assets manually By selecting Manual fiom the select box beneath
Asset Selection, you tell the Asset Publishei that you want to select content man-
ually. You can select what you want to be published within the poitlet, oi you
can cieate new content fiom within the Asset Publishei.
Figure 5.12: Selecting assets manually is very similar to the Web Content
Display portlet, except you have many other content types to choose from.
Clicking Add New gives you a menu of options, enabling you to cieate the
content iight wheie you aie. You can cieate blogs, bookmaiks, calendai entiies,
1 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
documents, images, and of couise, web content. Anything you cieate heie is
added to the list below of assets that aie displayed by the poitlet.
Clicking Select Existing gives you a similai menu, except this time you can
pick fiom existing content in the poital that eithei you oi youi useis have cie-
ated. Has someone wiiuen an excellent wiki page that you want to highlight`
Select it heie, and it will be displayed.
Te Asset Publishei enables you to mix and match dieient content types in
the same inteiface. Once you have youi content selected, you can move on to
the display types to conguie how the content appeais.
Most of the time, howevei, youll likely be using the Asset Publishei to select
content dynamically.
Selecting assets dynamically Te Asset Publisheis default behavioi is to se-
lect assets dynamically accoiding to iules that you give it. Tese iules can be
stacked on top of each othei so that they compliment each othei to cieate a
nice, iened queiy foi youi content. You have the following options foi cieat-
ing these iules
Scope: Choose the sites oi oiganizations fiom which the content should be
selected.
Asset Type: Choose whethei youll display any asset oi only assets of a
specic type, such as only web content, only wiki entiies, oi any combinations
of multiple types.
Filter Rules: Add as many lteis on tags oi categoiies as you like. You can
choose whethei the content contains oi does not contain any oi all categoiies
oi tags that you entei.
Once youve set up youi ltei iules foi dynamically selecting youi content,
you can then decide how the content will be displayed.
Te Display Seuings section gives you piecise contiol ovei the display of
youi assets. Teie aie a multitude of options available to conguie how you
want youi content to appeai. You can conguie the style, length of abstiacts,
behavioi of the asset link, maximum items to display, pagination type and le
conveisions. Additionally, you can enable piinting, ags, iatings, comments
and comment iatings, and these woik the same way they do in the Web Content
Display poitlet.
You can display the content ietuined by the lteis above in oidei by title,
cieate date, modied date, view count and moie in ascending oi descending
oidei. loi instance, you may have a seiies of How To aiticles that you want
displayed in descending oidei based on whethei the aiticle was tagged with the
hammer tag. Oi, you may want a seiies of video captuies to display in ascending
5.5. SETTING UP DISPLAY PAGES 1
Figure 5.13: You can lter by tags and categories, and you can set up as
many lter rules as you need.
oidei based on a categoiy called birds. You can also gioup by Asset, Type oi
Vocabularies. Vocabulaiies aie gioups of categoiies dened by administiatois
in the Categories section of the Contiol Panel.
ln the Ordering and Grouping section of the Asset Publishei, you have gieat
contiol ovei how content is oideied and giouped in the list, but this is only
one aspect of how youi content will be displayed. You can iene the display
thiough many othei display seuings.
5.5 Setting up Display Pages
Te Display Seuings section gives you piecise contiol ovei the display of youi
assets. Teie aie a multitude of options available to conguie how you want
youi content to appeai. You can conguie the style, length of abstiacts, behav-
ioi of the asset link, maximum items to display, pagination type and le con-
veisions. Additionally, you can enable piinting, ags, iatings, comments and
comment iatings, and these woik the same way they do in the Web Content
Display poitlet.
18 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
Display Style Abstracts: Shows the ist 200-00 chaiacteis of the content,
dened by the Abstract Length eld.
Table: Displays the content in an HTML table which can be styled by a theme
developei.
Title List: Te contents title as dened by the usei who enteied it.
Full Content: Te entiie content of the entiy.
Other Settings Asset Link Behavior: Te default value is Show Full Content.
With this value selected, when the link to an asset is clicked, the full asset is
displayed in the cuiient Asset Publishei. lf the value View in a Specic Portlet is
selected, clicking on an asset causes that asset to be displayed in the poitlet to
which the asset belongs. loi example, a blog entiy would be displayed in the
Blogs poitlet wheie it was cieated. Likewise, a foium post would be displayed
in the Message Boaids poilet wheie it was cieated. Similaily, a geneiic Web
Content aiticle would be displayed in the Asset Publishei of its conguiated
Display Page. See the secton below on Display Pages foi moie infoimation.
Maximum Items to Display: You can display 1-100 items.
Pagination Type: Select Simple oi Regulai. Simple shows pievious and next
navigation, iegulai includes a way of selecting the page to which youd like to
navigate.
Exclude Assets with 0 Views: lf an asset has not been viewed, exclude it
fiom the list.
ShowAvailable Locales: Since content can be localized, you can have diei-
ent veisions of it based on locale. Tis will show the locales available, enabling
the usei to view the content in the language of his oi hei choice.
Enable Conversion To: lf you have enabled Lifeiay Poitals OpenOce.oig
integiation, you can allow youi useis to conveit the content to one of seveial
foimats, including PDl.
Below these options aie the same ones in the Web Content Display poitlet
enable piint, enable comments, enable iatings, etc.
ShowMetadata: Allows you to select fiom the available metadata types (see
below).
Enable RSS Subscription: Tis lets useis subsciibe to the content via RSS
leeds.
Te Display Seuings section of the Asset Publishei has numeious options
to help you conguie how youi content selections aie displayed to youi useis.
Even though theie aie many choices, its easy to go thiough the options and
quickly adjust the ones that apply to you. Youll want to use the Asset Publishei
5.5. SETTING UP DISPLAY PAGES 19
Figure 5.14: Available metadata types
to queiy foi mixed assets in the poital that have ielevant infoimation foi youi
useis.
Next, well look at Display Pages, an addition to the asset fiamewoik intio-
duced by Lifeiay .1.
Display Page
lf youve been using Lifeiay foi a while, oi youve just spent a liule bit of time
with this guide, you might have noticed something about how Lifeiay handles
web contentcontent is nevei tied diiectly to a page. While this can be useful
(because it means that you dont have to iecieate content if you want to display
the same thing on multiple pages), it also means that you dont have a static
URL foi any web content, which is bad foi seaich engine optimization.
As an impiovement, Lifeiay has intioduced the concept of Display Pages
and Canonical URLs. Each web content entiy on the poital has a canonical
URL, which is the ocial location of the content that is iefeienced any time the
content is displayed. A Display Page can be any page with an asset publishei
conguied to display any content associated with the page. When adding oi
editing web content aiticles, you can select a Display Page, but only pages with
a conguied asset publishei aie available foi selection.
To cieate a Display Page, you can cieate a page youiself, add an Asset Pub-
lishei poitlet and conguie it youiself. Alteinatively, you can use the Content
180 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
Display Page page template included with Lifeiay. lf youie cieating a Display
Page manually, once youve added an Asset Publishei poitlet to the page, open
its conguiation window. Ten check the Set as the Default Asset Publisher for
is Page box.
You may now be thinking, Wait, you just told me that each Web Content
item has its own URL, and that this is somehow ielated to pages wheie we
display a whole bunch of content on the same page` Yes. Tats exactly what
l said. Just watchcieate a display page called My Web Content Display Page
somewheie on youi poital, using the Content Display Page template. Now, on a
dieient page, add a Web Content Display poitlet. Click the Add Web Content
buuon, entei a title and some content, click on Display Page at the iight, and
select the Display Page you just cieated. Ten click Publish.
Figure 5.15: Selecting a Display Page
ln the Asset Publishei of the My Web Content Display Page, you can nowclick
the Read More link to display the content. Notice that the canonical URL foi
content appeais in youi biowseis addiess bai. lf you cieate youi own custom
display page, any additional poitlets that you place on the page aie displayed
along with the content when you access it via the canonical URL. lf you used the
Content Display Page page template foi youi Display page, it not only featuies
a conguied Asset Publishei poitlet but also a Tags Navigation, a Categoiies
Navigation, and a Seaich poitlet. Tese tools help useis to quickly identify
ielevant content.
5.6. DEFINING CONTENT RELATIONSHIPS 181
Figure 5.16: The Canonical URL
Lets move on to anothei new featuied intioduced by Lifeiay .1.
5.6 Dening content relationships
Related Assets is a new featuie in Lifeiay .1 that enables you to connect any
numbei of assets within a site oi acioss the poital, even if they dont shaie any
tags and aient in the same categoiy. Weve alieady seen that you can show
ielated assets within the display foi a specic asset, and with the Related Assets
poitlet you can show links to any assets which aie ielated to content displayed
on that page.
Te Related Assets poitlet is based on the Asset Publishei and possseses
essentially the same inteiface with one key dieience. Te Asset publishei dis-
plays any content that meets the ciiteiia selected in the poitlet conguiation.
Te Related Assets poitlet only displays content that meets the ciiteiia, and also
is listed as a ielated asset foi a piece of content that is cuiiently published on
the page wheie it is placed. Lets take a look at the the Related Assets poitlet.
As a pieiequisite foi the Related Assets poitlet to display ielated assets, you
conguie it to show the content you want displayed. To do this, go to the Asset
Publishei poitlet and select the wrench icon in the uppei iight coinei of the
poitlet. Undei the Setup tab, set type of asset(s) to display using the Asset Type
menu. Te default value is set to Any. You can naiiow the scope of the poitlet
to display any single categoiy of asset type oi select multiple assets fiom the
menu.
liltei options let you set minimum iequiiements foi displaying assets by
theii categoiies, tags, and custom elds. Oideiing and Giouping allows you to
oiganize assets using the same ciiteiia. Display seuings allow you to customize
how asssets aie shown in the poitlet. Tey can be listed by title, in a table,
by abstiact oi full content. You can conveit assets to dieient document types
like ODT, PDl, and RTl. You can choose to show vaiious metadata elds such
as authoi, modication date, tags, and view count. You can even enable RSS
subsciiptions and customize theii display seuings.
When you aie nished seuing the Souice and liltei options, click Save. But
hold on a minute. You saw the message that says, You have successfully
182 CHAPTER 5. LEVERAGING THE ASSET FRAMEWORK
updated the setup, but theie still aient any assets displayed in the ielated
assets poitlet. Why` You cannot see any ielated assets until you select an asset
in the Asset Publishei.
Figure 5.17: Select an asset in the Asset Publisher to see its related assets
displayed in the Related Assets portlet.
Once you select an asset, its ielated assets will display in the Related Assets
poitlet, similai to the image above.
5.7 Summary
ln this chaptei, we exploied Lifeiays asset fiamewoik. Any type of content in
Lifeiay is consideied an asset and can utilize the featuies piovided by the asset
fiamewoik tags, categoiies, comments, iatings, and ielationships. We exam-
ined the Asset Publishei poitlet and looked at the many conguiation options
foi choosing what kinds of assets to display and how to display them. We saw
that the Asset Publishei poitlet is designed to integiate with the Tags Naviga-
tion and Categoiies navigation poitlets to allow useis to biowse content moie
easily. We also leained about the Display Page auiibute of web content, the
Content Display Page page template, and canonical URLs foi assets. Assets can
have display page associated with them so that the full view of the asset is dis-
played on the display page. Te display page of an asset is used in the assets
canonical URL.
Cu~v1rv
PrvsoN~iiz~1ioN ~Nu CUs1oxiz~1ioN
ln this chaptei, we discuss seveial ways Lifeiay useis can customize pages, ap-
plications, and the way they use youi poital. Well covei the following topics
Peisonal Sites
Customizable Pages and Applications
Using a Rules Engine
Peisonal sites allow each poital usei to manage and customize a set of public
and/oi piivate pages and any associated content oi applications. Public pages
piovide a means of making content publicly available while piivate pages pio-
vide a means of hiding infoimation fiomothei useis. Lifeiay .1 intioduced cus-
tomizable pages and applications. Administiatois can designate ceitain pages
oi applications as customizable, which allows each usei to make and save theii
own customizations. Lifeiay Enteipiise Edition piovides a iules engine which
allows administiatois to cieate custompoital iules and simplify complex blocks
of code containing lots of if-else statements. Lets stait by discussing pei-
sonal sites.
183
184 CHAPTER 6. PERSONALIZATION AND CUSTOMIZATION
6.1 User Personal Sites
By default, newly cieated useis in Lifeiay aie each gianted a peisonal site. Each
usei functions as the site administiatoi of his oi hei peisonal site. Peisonal sites
aie fully customizable but cannot have moie than one membei. Te public pages
of peisonal sites piovide a space foi useis to publish content that theyd like to
make accessible to anyone, including guests. Usei blogs aie ofen placed on
public peisonal site pages. Content and applications that useis would like to
ieseive foi peisonal use aie ofen placed on the piivate pages of peisonal sites.
loi example, each usei can add a Documents and Media poitlet to his oi hei
piivate pages and use it as an online piivate le iepositoiy.
lf youd like to disable peisonal sites foi youi poital, just add the following
piopeities to youi portal-ext.properties le
layout.user.public.layouts.enabled=false
layout.user.private.layouts.enabled=false

Note that the public and piivate


page sets of peisonal sites aie han-
dled sepaiately. You can leave one
page set enabled while disabling the
othei.
What if you initially had usei peisonal sites enabled foi youi poital but then
disabled them` Each existing useis peisonal site iemains on youi poital until
the next time they log in, at which point its iemoved.
You can allow useis to cieate peisonal sites but not have them automatically
cieated foi new useis. To do this, ist make suie that layout.user.pub-
lic.layouts.enabled and layout.user.private.layouts.enabled aie
not set to false. You dont need to explicitly set them to truetrue is the
default. Ten add the following piopeities to youi portal-ext.properties
le
layout.user.public.layouts.auto.create=false
layout.user.private.layouts.auto.create=false
lf all of these piopeities aie set to true, which is the default, then useis will
have peisonal sites and public and piivate pages will be automatically cieated
foi new useis. Teie aie numbei of poital piopeities you can use to customize
the automatically cieated pages. You can customize the names of the default
6.2. PAGE CUSTOMIZATIONS 18
pages, the poitlets that appeai on the pages, the themes and layout templates
of the default pages, and moie. Please iefei to the Default Usei Public Layouts
and Default Usei Piivate Layouts sections of chaptei 20 foi details.

Piioi to Lifeiay .1, administiatois could disallow useis fiom


being able to modify the pages and poitlets of theii peisonal sites
by seuing the following piopeities
layout.user.public.layouts.modifiable=true
layout.user.private.layouts.modifiable=true
As of Lifeiay .1, this piopeity is obsolete. Howevei, you can
customize the modiable poitions of peisonal sites thiough Lif-
eiays peimissions system by iemoving peimissions fiom ioles.
To disallow all poital useis fiom modifying something, iemove the peimis-
sion fiom the Usei iole.
Histoiically (piioi to Lifeiay .1), only powei useis ieceived peisonal sites.
Back then, they weie called peisonal communities. lf youd like only powei
useis to ieceive peisonal sites, add the following piopeities to youi portal-ext.-
properties le
layout.user.public.layouts.power.user.required=true
layout.user.private.layouts.power.user.required=true
Peisonal sites aie a dynamic featuie of Lifeiay Poital. Tey allow useis to
manage and customize theii own pages and content on youi poital. Next, lets
look at how useis can customize applicatons.
6.2 Page Customizations
Lifeiay .1 intioduced the concept of page customizations. Administiatois can
designate public pages oi sections of public pages to be customizable. When
a usei visits such a page, a notication will appeai stating that the usei can
customize the page. Useis can make customizations only in the sections of
pages designated by administiatois. Customizations aie based on the iows and
columns of a page layout. Page customizations aie only visible to the usei who
made the customizations. By default, site membeis can make page customiza-
tions but non-site membeis and guests cant.
18 CHAPTER 6. PERSONALIZATION AND CUSTOMIZATION
To enable page customizations as an administiatoi, ist navigate to the page
youd like to let site membeis modify. Ten select Manage Page Customiza-
tions fiom the Dockbai.
Figure 6.1: To enable page customizations, select Manage Page
Customizations fromthe Dockbar.
Once youve selected Manage Page Customizations, youll see one oi moie
ied iegions, depending on the layout template of youi page. Check one oi moie
of the Customizable boxes to allow site membeis to customize ceitain sections
of the page. Regions that youve designated as customizable aie coloied gieen.
Figure 6.2: Check one or more of the Customizable boxes to allowsite
members to customize certain sections of the page.
When site membeis visit youi customizable page, theyll see a notication
saying, You can customize this page. Site membeis can toggle between view-
ing theii customized page and viewing the default page by clicking the View
Default Page oi View My Customized Page links just below the Dockbai. Teies
6.2. PAGE CUSTOMIZATIONS 18
also a Reset My Customizations link that iestoies a useis customized page to the
match the default page. Tis allows useis to discaid one set of customizations
and stait a new set without having to manually undo each customization that
theyd pieviously made.
Note that non-administiatoi site membeis can access the Add menu fiomthe
Dockbai when viewing theii customizable page even if they dont oidinaiily
have peimission to view this menu. Tis allows them to add poitlets to the
sections of the page that theyie allowed to customize. lf they click View Default
Page, the Add menu will disappeai fiom the Dockbai since theyie not allowed
to modify the default page.
Figure 6.3: Non-administrator site members can customize their own
versions of customizble pages but cant modify the default page.
Administiatois of customizable pages have the same two views as site mem-
beis the default page view and the customized page. Changes made to the de-
fault page aect all useis, wheieas changes made to the customized page aect
only the administiatoi who made the changes. Changes made by administiatois
to non-customizable sections in the default view aie immediately applied foi all
useis. Howevei, changes made by administiatois to customizable sections do
not oveiwiite useis customizations.
Useis can make two kinds of customizations to customizable iegions. liist,
they can conguie any poitlet applications within the customizable iegions.
Second, they can add poitlets to oi iemove poitlets fiom the customizable ie-
gions. As a simple example, suppose that you, as an administiatoi, selected the
iight column of the default poital homepage to be customizable. A membei of
the default site could take the following steps to make a peisonal customization
of the poital homepage
1. Navigate to the poital homepage by clicking Go To Liferay fiomthe Dock-
bai. (Te poital homepage belongs to an automatically cieated site called
Liferay, by default.)
2. Remove the Hello Woild poitlet iemove fiom the iight column of the page.
3. Add the Language poitlet to the iight column by clicking Add More in the
Dockbai, expanding the Tools categoiy, and clicking Add next to Language.
188 CHAPTER 6. PERSONALIZATION AND CUSTOMIZATION
4. Conguie the Language poitlet by clicking on the wiench icon and select-
ing Conguration and then opening the Display Style diopdown menu and
choosing Select Box.
Te Language poitlet is useful to have on youi poital homepage if you expect
useis who speak dieient languages to access youi poital. Useis can select theii
language in the Language poitlet to view a tianslation of the poital into theii
native language. Afei closing the Conguiation dialog box of the Language
poitlet, the customized poital homepage looks like this
Figure 6.4: In this example, Joe Bloggs removed the Hello World portlet,
added the Language portlet, and changed the display style fromicons to a
select box.
To allow useis to customize a page, administiatois must giant useis pei-
mission to Customize pages undei the Site section. Tis can be achieved by
assigning peimission to a iole, then assigning this iole to the appiopiiate useis.
loi example, if we want any logged usei to be able to customize oui customiz-
able pages, we could assign the Customize peimission to the iole User. lf we
want site membeis to be able to customize the customizable pages of theii sites,
we would accept the default seuing. By default, the Customize peimission is
assigned to the iole Site Member.
ln addition to gianting the ability to customize poitlet conguiations, the
Customize peimission allows useis to customize the look and feel of poitlets
and to impoit oi expoit poitlet seuings. Next, lets look at how to use Lifeiays
iules engine.
6.3. USING LIFERAYS RULES ENGINE 189
EE Only Feature
6.3 Using Liferays rules engine
Lifeiay Poital Enteipiise Edition piovides an implementation of a JSR-94 com-
pliant iules engine. Tis iules engine is piovided as a Web Plugin and is based
on the populai open souice Diools pioject.
Why use a rules engine?
lf you aie not familiai with iules engines, you may be wondeiing why you
would want to use one. ln most applications, complex iule piocessing ofen
takes the foim of nested if-else blocks of code which can be veiy dicult to
deciphei and to maintain. lf iules change, a developei must woik with a busi-
ness usei to dene the new iules. Te developei must then iead thiough the
existing logic to undeistand what is happening and make the necessaiy modi-
cations. Te changes must then be iecompiled, tested, and iedeployed. A iules
engine piovides a means to sepaiate the iules oi logic of an application fiomthe
iemaining code. Sepaiating these iules piovides seveial distinct advantages.
A iule engine allows foi a moie declaiative style of piogiamming wheie
the iules dene what is happening, without desciibing how it is happen-
ing. Tis makes it much easiei to iead than nested if-else blocks of code.
lts also easiei to make changes without intioducing bugs in youi code.
Te iules aie wiiuen in a language that is easiei foi non-developeis to
undeistand. Tis makes it easiei foi business useis to validate and even
modify the iules without having to involve developeis.
Aiule engine allows foi changes to be made to the iules without iequiiing
that you iecompile youi application. lf youi code must pass thiough a
stiict deployment woikow, this can be a huge time savei and can also
save a signicant amount of money.
Afei all this, you may be inteiested in using Lifeiays iules engine, so lets
get staited with it.
190 CHAPTER 6. PERSONALIZATION AND CUSTOMIZATION
Installation
Te Diools Web Plugin is available to Lifeiay Enteipiise Edition customeis
thiough Lifeiay Maiketplace. lts name is Drools EE, and youll nd it cate-
goiized as a Utility app.
Te Diools Web Plugin piovides a iules engine implementation, but by itself
it doesnt piovide any obseivable changes to the poital usei inteiface oi any
additional functionality. To see the iules engine in action, you can download
and install a Sample Diools Poitlet that contains two iule denitions that illus-
tiate how to leveiage the iules engine in youi custom code. Te Sample Diools
Poitlet is available thiough the Customei Poital.
Lets examine the sample poitlet to see how it woiks.
Conguring the sample Drools portlet
Begin by downloading and installing the Sample Diools Poitlet. Te Sample
Diools Poitlet is available to Lifeiay Enteipiise Edition customeis thiough the
customei poital. Te name is sample-drools-portlet, and youll nd it in
the list of web plugins.
Afei installation is complete, add the poitlet to a page. lnitially, the poitlet
indicates the name of the cuiiently logged in usei and a message that says theie
aie no iesults. To see iesults in the poitlet well need to cieate and tag assets in
the site to which you added the poitlet.
Log in as an administiative usei and navigate to the Contiol Panel. Once in
the Contiol Panel, add a new Web Content entiy to youi site. Befoie publishing
the Web Content entiy, tag the aiticle with west coast symposium. While still
in the contiol panel, navigate to My Account and select the Addiess link on the
iight side of the scieen. Entei a Canadian, Mexican, oi US based addiess and
save the iecoid. Now, navigate back to the lifeiay.comsite and the Web Content
should be displayed in the Sample Diools Poitlet.
Te default iule thats being evaluated displays a list of assets based on
the cuiient useis addiess. loi example, if the cuiient useis countiy is set to
Canada, Mexico, oi the United States, the Sample Diools Poitlet displays a list
of assets that have been tagged with the west coast symposium tag.
Te Sample Diools Poitlet plugin also contains a second iule that ietuins
peisonalized content based on the useis net woith set in the My Account
Custom lields section of the Contiol Panel. To see this iule in action, add a
second instance of the Sample Diools Poitlet to a page. Once added to the page,
select the Options icon (the wrench) and then select Conguration. You need to
ieplace the iules dened in the Rules section of the Conguiation scieen with
6.3. USING LIFERAYS RULES ENGINE 191
contents of the rules_user_custom_aribute_content.drl le. Te iule le can be
found in the deployed poitlet at
sample-drools-portlet/WEB-INF/src/com/liferay/sampledrools/dependencies/rules/_user/ \
_custom/_attribute/_content.drl
ln the same Conguiation scieen, add networth to the usei-custom-auiibute-
names eld. Save youi changes and close the pop-up window. Navigate to
the Contiol Panel and add a Custom lield on the Usei object with the Key
networth. Navigate to My Account and select the Custom lields link on the
iight side of the scieen. Entei a net woith of 10000 and save the iecoid.
While still in the Contiol Panel, add a new Web Content entiy to the default
lifeiay.com site. Befoie publishing the Web Content entiy, tag the aiticle with
high net worth and then save the entiy. Now, navigate back to the lifeiay.com
site and the Web Content should be displayed in the second Sample Diools Poit-
let added to the page.
Now that you can see how it woiks in piactice, lets look closei at the iules
themselves.
Rules Denitions
Rule denitions can be wiiuen using Diools declaiative language. Rule les
aie text les that ofen have a .dil extension. A iule le can contain multiple
iules. ln addition to the standaid Diools declaiative language, a domain specic
language (DSL) can be cieated foi youi specic pioblem domain. Cieating a
DSL can make youi iules even easiei foi business useis to cieate and maintain
youi applications iules but does iequiie some additional woik up fiont. loi
additional infoimation on cieating a DSL foi youi pioblem domain please iefei
to the Domain Specic Languages section of the ocial Diools Documentation
at docs.jboss.oig.
To see examples of a iules denition le, access the following diiectoiy in
the Sample Diools Poitlet
sample-drools-portlet/WEB-INF/src/com/liferay/sampledrools/dependencies
To see howiules woik in action well look at the iule dened in rules/_user/_ad-
dress/_content.drl.
At ist glance, this .dil le looks a lot like a Java class le. Tis example staits
with a comment desciibing the iule. Single line comments can begin with eithei
a # oi // and multi-line comments begin with /* and end with */.
## ## Rules ## ## This sample program will return personalized content
192 CHAPTER 6. PERSONALIZATION AND CUSTOMIZATION
based on the useis -- addiesses set in the My Account section of the Contiol
Panel. -- -- loi example, suppose the cuiient usei has an addiess in the United
States and -- is a membei of the Lifeiay site. All assets within the Lifeiay site
-- that aie tagged with West Coast Symposium will be ietuined. --
lollowing the comments is a package declaiation. Te package declaiation
is optional in a Diools, but if it appeais, it must be at the beginning of the le.
Te package denotes a collection of iules. Unlike Java, the package name does
not iepiesent a foldei stiuctuie, its only a unique namespace. Te ; at the end
of the package declaiation and all othei statements is optional.
package com.liferay.sampledrools.dependencies;
Afei the package declaiation aie a seiies of import statements. lmpoit
statements in the iule le aie used the same as the impoit statements in Java
classes. Classes that aie impoited can be used in the iules.
import com.liferay.portal.kernel.util.KeyValuePair; import
com.liferay.portal.kernel.util.StringUtil; import
com.liferay.portal.model.Address; import com.liferay.portal.model.Contact;
import com.liferay.portal.model.User; import
com.liferay.portal.service.AddressLocalServiceUtil; import
com.liferay.portlet.asset.model.AssetEntry; import
com.liferay.portlet.asset.service.persistence.AssetEntryQuery; import
com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil; import
com.liferay.portlet.asset.service.AssetTagLocalServiceUtil;
import java.util.ArrayList; import java.util.List;
Te next line declaies the dialect foi the package. ln this case, we will
be using Java foi any of the code expiessions that well encountei. Te othei
possible value foi dialect is MVEL. lf necessaiy, the dialect can also be specied
at the iule level to oveiiide the package level dialect.
dialect "java"
ln this iule le, we have only a single function, which is listed next. lunc-
tions allow you to inseit Java code that can be evaluated at iun time into youi
iule le. lunctions aie commonly used as a as pait of the consequence clause
of the iule statement. lunctions aie similai to Java methods, but to dene a
function you use the function keywoid. Te functions paiameteis and the ie-
tuin type aie declaied as they would be in a Java method. ln this example, the
getAssetEntries function ietuins a java.util.List object that contains
AssetEntry objects based on the groupIds, classNameIds, and names pio-
vided in the function call.
6.3. USING LIFERAYS RULES ENGINE 193
function List getAssetEntries( long[] groupIds, long[] classNameIds,
String[] names) {
long[] assetTagIds =
AssetTagLocalServiceUtil.getTagIds(groupIds, names);
List<AssetEntry> assetEntries = new ArrayList<AssetEntry>();
if (assetTagIds.length > 0) { AssetEntryQuery assetEntryQuery =
new AssetEntryQuery();
assetEntryQuery.setAnyTagIds(assetTagIds);
assetEntryQuery.setClassNameIds(classNameIds);
assetEntryQuery.setGroupIds(groupIds); assetEntryQuery.setVisible(true);
assetEntries.addAll(AssetEntryLocalServiceUtil.getEntries(assetEntryQuery));
}
return assetEntries; }
Alteinatively, this function couldve been wiiuen in a helpei class and then
impoited using a function import. So if we had cieated a helpei class called
AddressContentHelper the impoit would look like this
import function
com.liferay.sampledrools.dependencies.AddressContentHelper.getAssetEntries;
Te last section of the iules le contains the actual iules. Te syntax of a
iule is veiy stiaightfoiwaid.
rule "name" attribute when condition then consequence end
Te iule name is iequiied and it must be unique within the package as de-
claied above. Names with spaces must be enclosed in double quotes. lt is con-
sideied a best piactice to always enclose youi iule names in double quotes.
rule "Initialize Rules"
Te auiibutes section is optional. ln oui ist iule, we have a single auiibute
called salience. Te salience auiibute is an integei value that acts as a piioiity
weighting. Te numbei can be positive oi negative and defaults to the value of
0. Rules with a highei salience value aie given a highei piioiity. lt is consideied
a best piactice to wiite auiibutes one to a line. ln oui example, the ist iule
is one that should be evaluated befoie any othei so it is given a high salience
value of 1000. None of oui othei iules have a salience auiibute set, so they all
default to a value of 0.
194 CHAPTER 6. PERSONALIZATION AND CUSTOMIZATION
salience 1000
Te when keywoid maiks the conditional section of the iule. lt is also ie-
feiied to as the Lef Hand Side (LHS). Te when keywoid is followed by zeio
oi moie condition elements that must be met befoie the consequence will be
called. lf theie aie no condition elements, then the condition is always evalu-
ated as tiue.
Te most common type of conditional element is a paern. Paueins match
against facts. lacts aie statements that aie known to be tiue. lacts can be
inseited by the Java code that invokes the iules engine oi they can be declaied
in the iule le itself.
ln the ist iule of oui iule le (Initialize Rules), the only condition is
that the iule must opeiate on a Usei object.
when user : User();
ln moie complex iules, the pauein may include constiaints oi may eval-
uate the piopeities of Java objects. loi example, the second iule of this iule
le is called Get European Symposium Content. Tis iule includes the following
pauein which ensuies that a useis addiess contains the countiy name liance,
Geimany, oi Spain.
userAddress : Address(country.name in ("France", "Germany", "Spain"));
Te consequence section of the iule follows the conditional section. lts also
known as the Right Hand Side (RHS) oi action pait of the iule. Te consequence
section begins with the keywoid then and it is intended to modify the woiking
memoiy data. Diools piovides some convenience methods that make it easiei to
modify the woiking memoiy. ln this iule, we use the insertLogical method
which places a new object into the woiking memoiy and ietiacts it when theie
aie no moie facts suppoiting the tiuth of the cuiient iule. Afei the consequence
section of the iule, the iule is teiminated with the keywoid end.
then List<Address> userAddresses = AddressLocalServiceUtil.getAddresses(
user.getCompanyId(), Contact.class.getName(), user.getContactId());
for (Address userAddress : userAddresses) {
insertLogical(userAddress); } end
lollowing the initial iule in oui example, theie aie thiee additional iules
that will be evaluated. Each of these iules evaluates the userAddress that was
inseited into the woiking memoiy to deteimine what type of content should be
displayed to the end usei.
6.4. SUMMARY 19
loi additional documentation on the Diools iules language, please see the
ocial Diools documentation.
1
6.4 Summary
ln this chaptei, we discussed peisonal sites foi poital useis. We showed how to
enable oi disable them, howto set whethei oi not pages should be automatically
cieated, and how to customize automatically cieated pages. We also examined
geneial customizable pages that dont belong to peisonal sites. Administiatois
can designate ceitain pages oi poitions of pages to be customizable and site
membeis can conguie these poitions of the pages, add oi iemove poitlet ap-
plications, and save theii conguiations.
We also discussed how you can use Lifeiays iules engine with Lifeiay EE.
As you can see fiom the Sample Rules Poitlet, using a iules engine can be a
poweiful way to decouple the iules of youi application fiom the fiont-end and
back-end code. Tese iules aie wiiuen in a declaiative language that business
useis can iead and veiify. Additionally, iule denitions can be modied without
modifying the undeilying Java code, ie-compiling, oi iedeploying youi appli-
cations.
1
hup//docs.jboss.oig/diools/ielease/.2.0.linal/diools-expeit-docs/html/
Cu~v1rv
Coii~nov~1ioN SUi1r
Lifeiay Poital ships with a iobust suite of collaboiation applications which you
can use to build communities of useis foi youi site. Tese applications piovide
all the featuies that you would expect of standalone veisions outside of a poital
seuing. Te dieience with Lifeiays collaboiation suite, howevei, is that all of
the applications shaie a common look and feel, secuiity model and aichitectuie.
Tey inheiit the stiengths of being pait of Lifeiays development platfoim so
you can use them in combination with Lifeiays usei management and content
management featuies to build a well-integiated, featuie-iich web site.
Tis chaptei focuses on how to use Lifeiays collaboiation suite. We explain
how to set up and administei
Blogs
Calendais
Message Boaids
Wikis
Polls
Chat
19
7.1. UNDERSTANDING LIFERAYS COMMON CONFIGURATION OPTIONS 19
Mail
Well discuss howthese featuies woik togethei to facilitate infoimation ow
within youi poital and piovide an enhanced expeiience foi youi useis.
7.1 UnderstandingLiferayscommoncongurationoptions
Just like siblings have common featuies inheiited fiom theii paients, applica-
tions that ship with Lifeiay also shaie common featuies. Tese include look and
feel, communication, scoping, shaiing, peimissions, aichive conguiations, and
expoiting/impoiting poitlet data. So befoie we get into the niuy giiuy of the
applications themselves, its best to covei these common featuies ist, staiting
with the look and feel conguiation options.
Look and Feel
An administiatoi can access the look and feel conguiation menu of any Lifeiay
poitlet by clicking on the wiench icon at the top iight coinei of the poitlet and
selecting Look and Feel. Te location of the wiench icon and othei poitlet icons
(minimixe, maximize, and iemove) may vaiy, depending on youi theme. Lifeiay
poitlets look and feel dialog boxes contain seven tabs
Poitlet Conguiation
Text Styles
Backgiound Styles
Boidei Styles
Maigin and Padding
Advanced Styling
WAP Styling
Afei making customizations on any tab, iemembei to click the Save buuon
to apply youi changes. To see the eect of youi changes, you may have to
iefiesh the page. lf you dont like the eect of youi changes, click the Reset
buuon to discaid them.
198 CHAPTER 7. COLLABORATION SUITE
On the Poitlet Conguiation tab, you can check the Use Custom Title box to
iename youi poitlets title. Te value you entei in the Poitlet Title box will be
displayed at the top of the poitlet windowon the page. You can also select a lan-
guage fiomthe Poitlet Title diopdown menu. lf youve piovided a language key
tianslation foi the language you select, the youi poitlets title will be displayed
in the selected language.
Figure 7.1: The Portlet Conguration tab of the Look and Feel Box allows
you to dene a customportlet title, link porlet URLs to a specic page, and
select whether or not portlet borders should be displayed.
lf you select a page in the Link Portlet URLs to Page diopdown menu, all
poitlet URLs will point to the page you selected. Te cuiient page is the default.
Note that you can use the Asset Publisheis Viewin a Specic Poitlet featuie and
web content aiticles Display Page auiibute to achieve a moie elegant solution
foi displaying the full view of web content aiticles on specic pages. Please see
the Display Page section of chaptei foi details.
You can also choose whethei oi not to display boideis aiound youi poitlet.
By default, boideis aie displayed. Be caieful about tuining poitlet boideis o,
some themes assume that poitlet boideis aie tuined on and may not display
coiiectly with them tuined o.
Te Text Styles tab allows you to conguie foimat of the text that appeais in
the poitlet. Te fonts you can choose fiom include Aiial, Geoigia, Times New
Roman, Tahoma, Tiebuchet MS, and Veidana. Aiial is the default. You can set
the text to bold, italics, oi both. You can set the font size anywheie fiom 0.1
em to 12 em, with 0.1 em inciements. 1 em is the default. You can set the text
coloi to any six digit hex coloi code. lf youd like help choosing a coloi, click on
7.1. UNDERSTANDING LIFERAYS COMMON CONFIGURATION OPTIONS 199
the pencil icon to open the coloi paleue. You can set the text alignment to lef,
centei, iight, oi justied. (Justied text is both lef and iight aligned.) You can
set an undeiline, oveiline, oi stiikethiough as the text decoiation. Te default
text decoiation is none.
Figure 7.2: The Text Styles tab lets you congure the format of the text
that appears in the portlet.
You can set the woid spacing anywheie fiom -1 em to 0.9 em, with 0. em
inciements. 0 em is the default. You can set the line height anywheie fiom 0
em to 12 em, with 0.1 em inciements. 0 em is the default. linally, you can set
the leuei spacing anywheie fiom -10 px to 0 px, with 1 px inciements. 0 px is
the default.
Te Backgiound Styles tab allows you to specify the poitlets backgiound
coloi. You can entei any six digit hex coloi code oi you click on the pencil icon
to use the coloi paleue.
On the Boidei Styles tab, you can conguie youi poitlets boidei width,
boidei style, and boidei coloi. loi each of these auiibutes, leave the Same for
All box checked to apply the same seuings to top, iight, bouom, and lef boideis.
loi boidei width, you can specify any value, em value, oi px value. loi
boidei style, you can select dashed, double, doued, gioove, hidden, inset, outset,
200 CHAPTER 7. COLLABORATION SUITE
Figure 7.3: The Background Styles tab lets you specify the portlets
background color.
Figure 7.4: The Border Styles tab lets you specify a border width, style,
and color for each side of the portlet.
7.1. UNDERSTANDING LIFERAYS COMMON CONFIGURATION OPTIONS 201
iidge, oi solid. loi boidei coloi, you can entei any six digit hex coloi code, just
like foi the text coloi and backgiound coloi. You can also use the coloi paleue.
Te Maigin and Padding tab allows you to specify maigin and padding lengths
foi the edges of youi poitlet. Just like foi boidei styles, leave the Same for All
box checked to apply the same seuings to each side (top, iight, bouom, and lef)
of the poitlet.
Figure 7.5: The Margin and Padding tab allows you to specify margin and
paddings lengths for the sides of your portlet.
loi both padding and maigin, you can specify any value, em value, oi px
value.
Te Advanced Styling tab displays cuiient infoimation about youi poitlet,
including youi poitlets Lifeiay lD and CSS classes.
On this tab, you can also entei custom CSS class names foi youi poitlet and
custom CSS code. Clicking the Add a CSS rule for just this portlet oi Add a CSS
rule for all portlets like this one links adds the CSS code shells into youi custom
CSS text box. lf you check the Update my styles as I type box, youi CSS code will
be dynamically applied to youi poitlet so you can see the eects of youi edits.
Te WAP Styling tab allows you to specify a custom poitlet title that will be
displayed when mobile devices using the Wiieless Application Piotocol make
page iequests. You can also set the initial windowstate to noimal oi minimized.
Noimal is the default.
Next, lets discuss expoiting and impoiting poitlet data.
202 CHAPTER 7. COLLABORATION SUITE
Figure 7.6: The Advanced Styling tab displays your portlets Liferay IDand
allows you to enter CSS code to customize the look and feel of your portlet.
Figure 7.7: The WAP Styling tab lets you enter a customportlet title to be
displayed to devices making page requests via WAP; it also allows you to
specify an initial windowstate.
7.1. UNDERSTANDING LIFERAYS COMMON CONFIGURATION OPTIONS 203
Export/Import
Some Lifeiay poitlets allow you to expoit oi impoit poitlet data. Tese include
many of Lifeiays collaboiative applications, such as the Blogs, Wiki, and Mes-
sage Boaids poitlets. To expoit oi impoit poitlet data, iight-click on the wiench
icon of youi poitlet and select Export/Import. Expoiting poitlet data pioduces
a .lar le that you can save and impoit into anothei poitlet applicaton of the
same type. To impoit poitlet data, you must select a .lar le. Be caieful not to
confuse poitlet-specic .lar les with site-specic .lar les. See the Backing
up and Restoiing Pages section of chaptei 2 foi a discussion of expoiting and
impoiting data acioss an entiie site.
Figure 7.8: When exporting portlet data, you can choose which categories
of information to include.
Each poitlet has dieient conguiation options. Checking the Setup box
selects the poitlets saved conguiation foi expoit. Checking the User Prefer-
ences box selects saved poitlet conguiations of specic useis. Te Data box is
the most impoitant onecheck this to select youi poitlets data (like blog en-
tiies, message boaid posts, oi wiki aiticles, foi example) foi expoit. When you
check the Data box, moie options appeai, allowing you to choose specic kinds
of metadata to include and to select a data iange. Check the Permissions box
if youd like to expoit youi the peimissions dened foi youi poitlet. When
you check this box, a subbox called Permissions Assigned to Roles appeais. lf
you wish, you can expoit youi poitlets peimissions but not the peimissions
assigned to ioles. linally, you can check the Categories box to include cate-
204 CHAPTER 7. COLLABORATION SUITE
goiies foi expoit. When selected, all categoiies iefeienced by poitlet data will
be expoited oi impoited, keeping theii hieiaichy.
Figure 7.9: When importing portlet data, you can choose which categories
of information to use.
When you impoit poitlet data, only the data types you select will be ovei-
wiiten. lf youd like to impoit poitlet data, you have to select a .lar le. You
can impoit any items that weie included when youi .lar le was cieated. Note
that usei piefeiences can only be successfully impoited when the usei UUlDs
match. Additionally, you can impoit any aichived setups into youi poitlet, if
any. Aichived setups piovide a means to save multiple poitlet conguiations
and to switch between them. We discuss aichived setups below. lf you check
the Delete portlet data before importing box, all data cieated by the poitlets will
be deleted just befoie the impoit piocess. Be caieful, some poitlets on otheis
pages may be iefeiencing this data.
7.1. UNDERSTANDING LIFERAYS COMMON CONFIGURATION OPTIONS 20
Next, lets discuss the concept of a poitlets scope.
Scope
As we leained eailiei, ioles can be scoped by the poital, by a site, oi by an oi-
ganization. A iole only takes eect within its scope. loi example, a Message
Boaids Administiatoi iole with complete access to the Message Boaids poitlet
has dieient peimissions based on the ioles scope. lf its a poital iole, membeis
have peimission to administei message boaids acioss the entiie poital. lf its a
site iole, membeis only have peimission to administei message boaids within
the site wheie theyve been assigned the iole. loi oiganizations with sites, site
ioles aie automatically assigned to oiganization membeis based on the oigani-
zation ioles they have. So foi an oiganization-scoped Message Boaids adminis-
tiatoi iole, membeis only have peimission to administei message boaids within
the site of the oiganization that assigned the iole to them.
We also use the woid scope to iefei to the data set of a poitlet. By default,
when a poitlet is added to a page in a site, it is scoped foi that site. Tis means
that its data belongs to that site. lf the poitlet is added to a page in a dieient
site, it employs a completely dieient data set. Tis enables you to place a Mes-
sage Boaids poitlet in one site with one set of categoiies and thieads, and place
anothei Message Boaids poitlet in dieient site with a dieient set of categoiies
and thieads.
Scoping by site means that you can only have one Message Boaids poitlet pei
site. lf you add one Message Boaids poitlet to a page in a site and add anothei
Message Boaids poitlet to a dieient page in the same site, the second Message
Boaids poitlet contains exactly the same data as the ist. Tis is because, by
default, the Message Boaids poitlet is scoped by site. Most of Lifeiays othei
poitlets also default to being scoped by site.
To avoid this limitation, many Lifeiay poitlets can be scoped by page. ln
this case, the data sets of page-scoped poitlets seive a single page, not an entiie
site. lf you set the scope of a poitlet to page instead of site, you can add any
numbei of these poitlets to dieient pages, and then they have dieient sets
of data. Tis allows you to have moie than one message boaid pei site if you
wish. Most poitlets, howevei, default to the native conguiation, and have
theii scopes set to the site wheie they aie placed.
Unless otheiwise noted, all the poitlets in this chaptei suppoit scoping by
poital (global), site (default), oi page (select layout cuiient page). Tis giants
you some exibility in how you want to set up youi poital. You can conguie
the scope of a poitlet with just a few simple steps.
20 CHAPTER 7. COLLABORATION SUITE
1. Click the Menu icon in the poitlet window (the wiench).
2. Select Conguration.
3. Select the Scope tab.
4. Use the diop-down menu to set the scope.
. Click Save.
Figure 7.10: Changing the scope of a portlet
Tats all it takes to change the scope foi a paiticulai poitlet instance. By
seuing the scope to Current Page, you can add as many of these poitlets to a site
as you want, piovided they aie all added to sepaiate pages.
Anothei useful featuie of Lifeiays poitlets is Aichived Setups.
Archived Setups
Once youve conguied a poitlet, Aichived Setups enables you to save those
seuings in an aichive. lf someone goes in and changes the seuings of a paitic-
ulai poitlet, it then becomes easy to ieveit those changes back to the oiiginal,
aichived conguiation.
To cieate an aichived setup, click the Conguration option fiom the menu
in the poitlets title bai. lf the cuiient seuings of the poitlet youie conguiing
aie the ones you want to aichive, click the Archive/Restore Setup link. lf not,
change and save the seuings until you have the poitlet conguied the way you
want it, and then click the Archive/Restore Setup link.
Teie is only one eld to ll out. Entei a name foi youi aichive and click
Save. You should now see youi aichive in the list. lf you evei need to ieveit the
poitlet to these aichived seuings, you can click Actions Restore next to the
aichived setup you want to iestoie.
7.1. UNDERSTANDING LIFERAYS COMMON CONFIGURATION OPTIONS 20
Unless otheiwise noted, all of the poitlets in this chaptei suppoit this featuie.
Tis is paiticulaily useful foi poitlets that have a lot of conguiation options,
such as the Message Boaids poitlet.
Next, well see how peimissions apply to Lifeiay poitlets in geneial.
Permissions
All of Lifeiays poitlets suppoit Lifeiays iobust, ne-giained peimissions sys-
tem. Some highei level peimissions can be conguied in the peimissions tab of
the poitlet conguiation dialog box. You can giant ioles peimission to add the
poitlet to a page, conguie the poitlet, oi view the poitlet. To set these peimis-
sions, go to the Conguration menu and click on Permissions. Tis shows you
a table of ioles dened in the poital. Use the check boxes to giant ceitain pei-
missions to dieient ioles. Click Submit afei you have made youi selections.
Beyond this, specic peimissions aie geneially dened foi specic applica-
tions. loi example, the message boaids poitlet contains a Ban User peimission.
Tis makes no sense in the context of anothei poitlet, say, the blogs poitlet.
Well go ovei peimissions foi specic applications in the sections foi those ap-
plications. loi now, lets move on to shaiing applications.
Communication
Lifeiay implements seveial communication mechanisms acioss poitlets includ-
ing those specied by the JSR-28 standaid public iendei paiameteis and events.
Public iendei paiameteis aie easy to use and can be quite poweiful. Some Lif-
eiay poitlets piovide a conguiation Ul to help you get the most out of this
communication mechanism. To access this Ul, open youi poitlets conguia-
tion window by clicking on the wiench icon and selecting Conguration. Ten
click on the Communication tab.
Te scieenshot above is foi the Wiki poitlet, which has six public iendei
paiameteis categoiyld, nodeld, nodeName, iesetCui, tag, title. loi each of
these paiameteis, you can conguie the poitlet to ignoie the values coming
fiom othei poitlets to iead the value fiom anothei paiametei.
Why might it be useful to ignoie the values foi ceitain paiameteis that come
fiomothei poitlets` Considei a common use case foi the Wiki poitlet. Te Wiki
poitlet is ofen used along with the Tags Navigation poitlet so that when a usei
clicks on a tag of the lauei, the Wiki poitlet shows a list of pages with that tag.
ln some cases, an administiatoi may want the Wiki poitlet to always show the
fiont page independently of any tag navigation done thiough othei poitlets.
208 CHAPTER 7. COLLABORATION SUITE
Figure 7.11: You can congure portlets to communicate with each other
using public render parameters.
Tis can be achieved by checking the Ignore checkbox so that the values of the
paiametei coming fiom those othei poitlets aie ignoied.
Reading the value of a paiametei fiom anothei poitlet is an advanced but
veiy poweiful option that allows poitlets to communicate with each othei even
if theii developeis didnt intend them to. loi example, imagine that the Wiki
poitlet is being used to publish infoimation about ceitain countiies. lmagine
fuithei that theies anothei poitlet that allows biowsing countiies foi adminis-
tiative ieasons. Te second poitlet has a public iendei paiametei called country
with the name of the countiy. Wed like the Wiki to show the infoimation fiom
the countiy thats selected in the administiation poitlet. Tis can be achieved
by seuing the value of the title paiametei of the Wiki poitlet to be iead fiom
the countiy paiametei of the administiation poitlet. Cool, isnt it`
Sharing
Te web was once thought of as a numbei of islands of applications in a vast
univeise of cybeispace. Many web sites auempted to make theii island the
biggest. Some succeeded to a laige extent and some failed. Moie iecently, the
concept of the web as an application itself has taken hold, and so widgets have
become veiy populai nowadays. Tis concept is pait of the Web 2.0 concept
and is veiy much enabled by widgets. What is a widget` A widget is a small
7.1. UNDERSTANDING LIFERAYS COMMON CONFIGURATION OPTIONS 209
piece of code which piovides a piece of functionality, can be included on any
web site, but does not necessaiily have to be hosted by that web site. lf you
have evei embedded a YouTube video on youi own web site so that useis could
watch a video without actually having to visit hup//youtube.com, then youve
alieady used a widget.
Lifeiay suppoits seiving its poitlets as widgets. You can embed a paiticulai
instance of a poitlet iunning on youi site into anothei site, such as lacebook.
Tis opens up a whole new avenue of exposuie to youi web site that you would
not have had otheiwise. ln fact, this is how all those lacebook games woik.
Figure 7.12: Sharing Tab of the Portlet Conguration Dialog Box
To shaie one of youi poitlets as a widget, open the Conguration dialog box
fiom the poitlets title bai and select the Sharing tab. Teie aie ve subtabs
undei shaiing Any Web Site, lacebook, Google Gadget, Netvibes, and liiends.
Any Web Site
Copy and paste the piovided snippet of JavaSciipt code into the web site to
which you want to add the poitlet as a widget. Tats all you need to do. When
a usei loads the page on the othei web site, the code will pull the ielevant poitlet
fiom youi site and display it.
210 CHAPTER 7. COLLABORATION SUITE
Facebook
You can add any Lifeiay poitlet as an application on lacebook. To do this, you
must ist get a developei key. A link foi doing this is piovided to you in the
lacebook tab. Youll have to cieate the application on lacebook and get the key
and canvas page URL fiom lacebook. Once youve done this, you can copy and
paste theii values into the lacebook tab. Youi poitlet will now be available on
lacebook as a lacebook application.
Figure 7.13: Liferays Forums on Facebook
lncidentally, this makes Lifeiay a fantastic platfoim upon which to build ap-
plications foi lacebook. See the Liferay Developers Guide oi Liferay in Action
foi moie details.
7.2. EXPRESSING YOURSELF USING BLOGS 211
OpenSocial Gadget
OpenSocial compiises a containei and a set of APls foi social netwoiking and
othei web applications. iGoogle is a seivice piovided by Google that lets useis
cieate a customizable page and add Gadgets to that page. Lifeiay can seive up
poitlets to be used as Open Social Gadgets on iGoogle oi othei OpenSocial-
compatible pages.
To seive a Lifeiay poitlet on iGoogle, check the box labeled Allowusers to add
[portlet-name] to iGoogle. Ten copy and paste the URL piovided into Googles
Add a feed or gadget featuie on the iGoogle conguiation page. Youi Lifeiay
poital instance will seive that poitlet diiectly onto youi iGoogle page. Te URL
piovided is unique to the specic instance of the poitlet, so you could seive
multiple instances of the same poitlet as dieient Google Gadgets.
You could use this featuie to allow useis to view whats happening on youi
poital at a glance, using asset publisheis oi custom RSS feeds. You could also
use Lifeiays APl to build youi own poitlet and piovide the URL foi useis to
place on theii iGoogle pages.
Netvibes
Netvibes oeis a similai seivice to iGoogleuseis can log in, cieate theii own
peisonal poital, called a dashboard, and add customizable widgets to the dash-
boaid that they cieate. To set up Netvibes suppoit foi a paiticulai poitlet, check
the Allow users to add [portlet-name] to Netvibes pages box. You can then use the
piovided URL to cieate a custom Netvibes widget based on the instance of the
poitlet that youie using.
Friends
Te nal sub-tab of the Sharing tab is called Friends. Tis tab has a single check
box that allows you to give youi fiiends peimission to add the application as a
widget to anothei web site. Tis could be paiticulaily useful foi youi blog oi
calendai if you wish to shaie them.
Now that weve seen all the common options available in Lifeiays poitlet
applications, we can move on to specic applications, staiting with blogs.
7.2 Expressing yourself using Blogs
Te woid Blog is an apostiophe-less contiaction of the two woids web and log.
Blogs weie ist populaiized by web sites such as Slashdot (hup//slashdot.oig)
212 CHAPTER 7. COLLABORATION SUITE
which have the foimat of a iunning list of entiies to which useis could at-
tach comments. Ovei time, moie and moie sites such as Digg, del.icio.us, and
Newsvine adopted the foimat, empoweiing useis to shaie theii opinions and
geneiating lively discussions.
Ovei the couise of time, blogging sites and applications began to appeai,
such as bloggei.com, blogspot.com. TypePad, WoidPiess, and Web Rollei. Tese
applications allow individuals to iun theii own web sites in the same foimat a
iunning list of shoit aiticles to which ieadeis who aie iegisteied with the site
can auach thieaded comments. People who iun a blog aie called bloggers, and
sometimes they build a whole community of ieadeis who aie inteiested in theii
blog posts. Anyone can have a blog, in fact, theie aie seveial famous people who
iun theii own blogs. lt gives people an outlet foi self-expiession that they would
not otheiwise have, and the ubiquity and wide ieach of the lnteinet ensuies that
if you have something impoitant and inteiesting to say, somebody will iead it.
Figure 7.14: Slashdot, one of the rst blogs on the Internet
Lifeiay Poital has a Blogs poitlet which allows you to piovide a blogging
seivice to useis of youi web site. ln fact, Lifeiay extensively uses the Blogs
poitlet on hup//www.lifeiay.comto piovide employees with blogs of theii own.
ln addition to the Blogs poitlet, theies also a Blogs Aggiegatoi poitlet which
can take entiies fiom multiple useis blogs and put them all in one laigei list.
We will go ovei how to use both of these poitlets to cieate a blogging site foi
7.2. EXPRESSING YOURSELF USING BLOGS 213
youi useis.
The Blogs Portlet
Te Blogs poitlet is available fiom the Collaboration section of the Add More
menu. Notice that it is an instanceable poitlet, meaning that it suppoits scopes.
Tis allows you to use the Blogs poitlet to cieate a shaied blog to build a site like
Slashdot oi to cieate multiple peisonal blogs to build a site like hup//bloggei.com.
Whats the dieience` Adding the Blogs poitlet to a site page cieates a shaied
blog foi membeis of the site that the page belongs to. Adding the Blogs poitlet
to a useis peisonal site cieates a blog just foi that usei. Te Blogs poitlet woiks
the same way in both cases. And of couise, you can change the Blog poitlets
scope to have dieient blogs on dieient pages in the same site.
Figure 7.15: Initial Viewof the Blogs Portlet
By default, the Blogs poitlet displays the latest entiy in its entiiety. When
you ist add the poitlet to a page, it has no entiies, so the poitlet is empty. Teie
aie seveial display options to let you conguie it to look the way you want it to
look. Befoie we stait adding entiies, lets conguie the poitlet so that it displays
entiies the way you want them.
Conguring the Blogs Portlet
Te Blogs poitlet is easy to conguie. Click on the Menu icon in the poitlets
title bai and select Conguration. Beneath the Setup tab, theie is anothei iow
of options.
Email From: denes the From eld in the email messages that useis ieceive
fiom the Blogs poitlet.
Entry Added Email: denes a subject and body foi the emails sent out when
a new Blog entiy has been added.
Entry Updated Email: denes a subject and body foi the emails sent out
when a new Blog entiy has been updated.
214 CHAPTER 7. COLLABORATION SUITE
Display Settings: changes vaiious display options foi the Blogs poitlet. To
choose the iight seuings, you should think about the best way to display youi
entiies as well as how you want useis to inteiact with bloggeis.
Figure 7.16: Blogs Conguration
MaximumItems to Display: choose the total numbei of blog entiies to display
on the initial page. You can select up to one hundied to be displayed.
Display Style: choose between full Content, abstiact, oi just the title. Seuing
this to Abstiact shows the abstiact, oi if theie isnt one, only the ist 30 woids
of youi blog entiies, with a Read Moie link at the bouom of each that expands
to the whole entiy.
Enable Flags: ag content as inappiopiiate and send an email to the admin-
istiatois.
Enable Related Assets: select ielated content fiom othei poitlets to pull into
theii blog entiy foi ieadeis to view.
Enable Ratings: lets ieadeis iate youi blog entiies fiom one to ve stais.
Enable Comments: lets ieadeis comment on youi blog entiies.
7.2. EXPRESSING YOURSELF USING BLOGS 21
Figure 7.17: Related Assets
Enable Comment Ratings: lets ieadeis iate the comments which aie posted
to youi blog entiies.
Enable Social Bookmarks: lets useis tweet, lacebook like, oi 1 (Google Plus)
about blog posts.
Maximum Items to Display: deteimine how many blog entiies will be dis-
played at once. Te default is set to twenty.
Display Style: select a simple, veitical, oi hoiizontal display style foi youi
blog posts.
Display Position: choose a top oi a bouom position foi youi blog posts.
RSS: choose how blogs aie displayed to RSS ieadeis. Heie, you can choose
how you want youi blog entiies to be published as feeds to ieadeis and outside
web sites.
Maximum Items to Display: choose the total numbei of RSS feeds to display
on the initial page. You can choose up to one hundied to be displayed.
Display Style: choose between full content, abstiact, and title. Tese options
woik just like the ones above foi blog entiies.
Format: choose which foimat you want to delivei youi blogs RSS 1.0, RSS
2.0, oi Atom 1.0.
Nowthat you have the Blogs poitlet looking the way you want it, youll want
to ieview peimissions foi itespecially if youie woiking on a shaied blog.
Permissions
lf you have a peisonal blog, the default peimissions should woik well foi you.
lf you have a shaied blog, you may want to modify the peimissions on the blog.
Te default seuings make it so only the ownei of the site to which the poitlet
has been added is able to add entiies. Tis, of couise, is gieat if the Blogs poitlet
21 CHAPTER 7. COLLABORATION SUITE
has been added to a useis peisonal pages, but doesnt woik so well foi a shaied
blog. But dont woiiy its easy to shaie a blog with multiple useis.
liist, cieate a iole foi youi bloggeis and add them to the iole (ioles aie cov-
eied in chaptei 12 of Pait 2). Next, click the Permissions buuon on the Blogs
poitlet. A list of both poital and site ioles is displayed, and cuiiently only the
ownei is checked. Check o any othei iole oi team that should have the ability
to add blog entiies, and then click Save. Once this is done, useis in the ioles oi
teams that you selected aie able to post to the shaied blog.
Now that eveiyones able to post, lets look at how posts woik.
Adding Blog Entries
Nowyouie ieady to begin adding blog entiies. Click the Add Blog Entry buuon.
Te following data entiy scieen appeais
Teie isnt much dieience between this scieen and any othei data entiy
scieen within Lifeiay Poital. You get a title, a way of scheduling when the
entiy is to appeai, and a iich editoi that allows you to foimat youi entiy the
way you want, complete with embedded images, videos, and the like. Note also
that as you type, the entiy is automatically saved as a diaf at peiiodic inteivals.
Tis gives you peace of mind in using the poitlet fiom within youi biowsei,
since you wont lose youi entiy in the event of a biowsei ciash oi netwoik
inteiiuption. You can also tag youi entiies using the same tagging mechanism
found eveiywheie else in the poital.
Te Blogs poitlet also suppoits tiackbacks and pingbacks. Tiackbacks aie
special links that let you notify anothei site that you linked to them. loi exam-
ple, if you wanted to wiite an entiy in youi blog and iefeience some othei sites
entiy, you might put the URL to the othei entiy in the Trackbacks to Send eld.
lf you have multiple URLs you want to send tiackbacks to, sepaiate them with
spaces.
lf you want otheis who link to youi blog to let you know about the link via
tiackbacks, leave the Allow Trackbacks box checked. Tis geneiates a URL that
is displayed with youi blog entiy. Otheis who want to link to youi entiy can
use this URL foi the link, to send tiackbacks to youi blog.
Note that tiackbacks only woik when the piotocol is suppoited by both the
linkei and the linkee. Anewei way to suppoit similai link notication function-
ality is pingbacks. Pingbacks aie XML-RPC iequests that aie similai to tiack-
backs except theyie automatically sent when you link to anothei site. Teyie
easiei to use because you dont have to do anything extia if you link to anothei
site in youi blog entiy, Lifeiay sends a pingback to the othei site to notify that
7.2. EXPRESSING YOURSELF USING BLOGS 21
Figure 7.18: Adding a Blog Entry
218 CHAPTER 7. COLLABORATION SUITE
site that you linked to it. Similaily, if someone links to youi blog entiy, Lifeiay
can ieceive a pingback fiom that peisons site and iecoid the link.
You can entei a desciiption of youi post beneath the Abstiact heading, and
this can be used by the Abstiact display style. Below this is the Categoiization
heading, wheie you can auach tags and/oi categoiies to youi blog entiy. You
should denitely considei doing this it impioves seaich iesults foi blog entiies,
and it gives you moie navigation options that you can pass on to youi useis. loi
example, you can add the Tags Navigation poitlet to anothei column on youi
blogs page, allowing useis to biowse blog entiies by tag.
Belowthis is the Related Assets heading. lf theies some othei content in the
poital thats ielated to youi blog, you can choose it heie. loi example, you might
want to wiite a blog entiy talking about a paiticulai discussion that happened
on the foiums. To link those two assets togethei, select the foium thiead undei
Related Assets.
Once youve nished youi blog entiy, click Publish. Youll go back to the list
of entiies, and now youi entiy is displayed. Heie is what it looks like when the
display style is set to Full Content and the numbei of entiies is set to ten
Figure 7.19: First Blog Entry Added
You can see that in the summaiy view, you dont see the tiackback/pingback
link, and you only see the numbei of comments that have been added. lf you
weie to click the Read More link, you would see the entiiety of the aiticle, all
the comments in a thieaded view, and the tiackback/pingback link which otheis
can use to link back to youi blog entiy.
7.2. EXPRESSING YOURSELF USING BLOGS 219
Te full viewof the blog entiy also contains links to shaie blog entiies on so-
cial netwoiks, such as Twiuei, lacebook, and Google Plus. Tis gives youi iead-
eis an easy way to shaie blog entiies with fiiends, potentially diiving fuithei
tiac to youi site. As you can see, the Blogs poitlet is a full-featuied blogging
application that gives you and youi useis the ability to entei the blogospheie
with an application that suppoits anything a bloggei needs.
Of couise, Lifeiay is a poital, and as a poital, it excels at aggiegating infoi-
mation fiom multiple places. loi that ieason, it also includes the Blogs Aggie-
gatoi poitlet so that you can bubble up blog entiies fiom multiple useis and
highlight them on youi site. Lets look next at how that woiks.
Aggregating Blog Entries
You can set up a whole web site devoted just to blogging if you wish. Te Blogs
Aggiegatoi poitlet allows you to publish entiies fiom multiple bloggeis on one
page, giving fuithei visibility to blog entiies. Tis poitlet is also veiy stiaight-
foiwaid to set up. You can add it to a page fiom the Collaboiation categoiy in
the Dockbais Add More menu.
lf you click Conguration fiom the menu buuon in the title bai of the poit-
let, the Blogs Aggiegatois conguiation page appeais. liom heie, you can set
seveial conguiation options.
Figure 7.20: Blogs Aggregator Conguration
220 CHAPTER 7. COLLABORATION SUITE
Selection Method: select Useis oi Scope heie. lf you select Useis, the Blogs
Aggiegatoi aggiegates the entiies of eveiy bloggei on youi system. lf you want
to iene the aggiegation, you can select an oiganization by which to ltei the
useis. lf you select Scope, the Blogs Aggiegatoi contains only entiies of useis
who aie in the cuiient scope. Tis limits the entiies to membeis of the site
wheie the Blogs Aggiegatoi poitlet iesides.
Organization: select which oiganizations blogs you want to aggiegate.
Display Style: select fiomseveial dieient styles foi displaying blog entiies
title, abstiact, body, image, oi quote.
Maximum Items to Display: select maximum numbei of entiies the poitlet
displays.
Enable RSS Subscription: cieates an RSS feed out of the aggiegated entiies.
Tis lets useis subsciibe to an aggiegate feed of all youi bloggeis.
Show Tags: foi each entiy, displays all the tags associated with the blogs.
When youve nished seuing the options in the poitlet, click Save. Ten
close the dialog box. Youll notice the Blogs Aggiegatoi looks veiy much like
the Blogs poitlet, except that the entiies come fiom moie than one authoi. Tis
makes it nice and familiai foi youi useis to navigate.
7.3. ORGANIZING AND SHARING EVENTS WITH THE CALENDAR 221
The Blogs Admininistrator Portlet
Figure 7.21: The Blogs Administrator portlet lets you delete large sets of
blog entries.
ln the Contiol Panel theies a poitlet foi managing youi sites blog entiies. Most
of the time, the Blogs poitlet is the only tool youll need to manage youi blog
entiies. lf, howevei, you need to massively delete blog entiies, the blogs admin-
istiatoi poitlet is the peifect tool foi you.
Note that its only foi batch piocessing of blog entiies, foi the full set of tools
foi managing blog entiies, youi best bet is to use the Blogs poitlet.
Weve alieady talked a liule bit about connecting content acioss the poital
by using Related Assets, now lets take a look at the Related Assets poitlet.
7.3 Organizing and sharing events with the Calendar
Lifeiays Calendai poitlet is a complete calendaiing solution. You can schedule
any numbei of events of dieient types, ieceive alaims via email oi text mes-
sage, impoit and expoit youi calendai, and much moie. Additionally, you can
impoit and expoit the calendai to and fiom the populai iCalendai foimat foi
use in othei applications.
222 CHAPTER 7. COLLABORATION SUITE
ln a similai way to the Blogs poitlet, you can use the Calendai poitlet as a
shaied calendai on a web site oi as a peisonal calendai oi both. Lets look at
how to conguie it.
Conguring the Calendar Portlet
Open the Conguration dialog box fiom the menu in the poitlets title bai. Te
Setup tab allows you to conguie thiee dieient options in subtabs Email From,
Event Reminder Email, and Display Seings.
Email From: set the Name and Email Address system geneiated emails come
fiom. Te addiess that you entei in the Email Addiess eld must be piopeily
foimaued, but it doesnt need to be an addiess that actually exists.
Event Reminder Email: customize the email message the Calendai sends
foi event iemindeis. lt contains the same iich text editoi that you see eveiy-
wheie else in Lifeiay, and this allows you to HTML foimat the message foi
easy iecognition. As with othei Lifeiay email notications, theie aie seveial
vaiiables which allow you to inseit iuntime values into the message, and these
aie listed undeineath the text editoi so that you can use them in the appiopiiate
place in youi template. loi example, you might want the event stait date and
time and the event title included in the email iemindei that you ieceive. Use
the vaiiables to inseit that infoimation in the appiopiiate place.
Display Settings: customize how the poitlet shows itself to the usei. Teie
aie seveial seuings heie
Default Tab: select which tab of the calendai poitlet is displayed to the
usei by default.
Summary Tab: select whethei it has a hoiizontal oi veitical layout. You
can also use checkboxes to choose whethei oi not the calendai poitlet
shows a mini month, shows todays events, oi enables ielated assets, com-
ments, oi iatings.
Now that youve successfully set up youi calendai, lets look at how to use
it.
Using the Calendar Portlet
Te Calendai poitlet inheiits its inteiface fiom the iest of Lifeiays poitlet li-
biaiy, so you should nd shaied featuies in the same place that you nd them
in othei Lifeiay poitlets.
7.3. ORGANIZING AND SHARING EVENTS WITH THE CALENDAR 223
Figure 7.22: The Liferay Calendar Portlet
To get staited, you may want to click the Permissions buuon. Heie youll nd
an inteiface that should be becoming familiai a list of ioles with check boxes.
loi the Calendai, these denote whethei the iole has the Add Event oi the Export
All Events peimission. By default, only the ownei has peimission to do these
things, which means that the Calendai poitlet is set up foi peisonal use. Te
ieason foi this is that out of the box, Lifeiay puts a Calendai poitlet on all useis
piivate pages. lf you want to use the Calendai as a shaied calendai, youll need
to make an additional conguiation.
liist, cieate a poital oi site iole. Ten add the useis iesponsible foi main-
taining the calendai to this iole. Tis piocess is desciibed in chaptei 12. You
can add multiple ioles if you like. Once you have the iole oi ioles set up, come
back to the Calendai poitlet and click the Permissions buuon. Check the boxes
next to the ioles that should have access to one oi both of the functions Add
Event and Export All Events. Ten click Submit.
Nowyou aie ieady to begin using youi calendai. Click the Add Event buuon.
A foim appeais that allows you to ll out all the infoimation foi youi event.
Start Date/Time: entei a date and time foi the event.
Duration: specify how long the event will last.
All Day Event: disassociate time fiom the event and make it last all day.
Time Zone Sensitive: make suie that the poital keeps tiack of the event
iegaidless of time zone.
Title: piovide a title foi the event.
Description: desciibe youi event.
Location: specify the physical location of the event.
224 CHAPTER 7. COLLABORATION SUITE
Type: select a pie-conguied event type. You can change these in the por-
tal-ext.properties le.
Permissions: manage who can view and edit the event.
Categorizations: tag and categoiize the event.
Related Assets: auach a piece of content fiom anothei poitlet to the event.
Repeat: select the schedule (daily, weekly, monthly. etc.) foi iepeatable
events.
End Date: entei the end date foi events that iepeat on a schedule but have
a specied last meeting.
Reminders: select whethei to send a iemindei, how long befoie the event
to send it, and thiough what medium (email, SMS text message, oi instant mes-
sage) to send it. Note that this featuie is integiated with useis pioles on the
poital, so useis need theii infoimation lled out and cuiient in oidei to ieceive
notications.
When you have nished adding youi event, click Save. You can view calen-
dai events by day, week, month, yeai, oi in a simple list.
As you can see, the Calendai poitlet is easy to use and convenient foi useis of
the poital. Next, lets look at one of the most widely used applications piovided
by Lifeiay its message boaids.
7.4 Discuss, ask and answer using the Message Boards
Lifeiays Message Boaids poitlet is a state of the ait foiumapplication similai to
many foiums in which you may have paiticipated. Te dieience, of couise, is
that Lifeiays message boaids can inheiit the abilities of the Lifeiay development
platfoim to piovide an integiated expeiience that otheis cannot match.
Teie aie countless web sites out theie wheie it is cleaily evident that theie
is no link whatsoevei between the main site and the message boaids. ln some
cases, useis aie even iequiied to iegistei twice once foi the main site and once
foi the message boaids. Sometimes it is thiee times foi the site, foi the message
boaids, and foi the shopping cait. By pioviding a message boaids poitlet along
with all of the othei applications, Lifeiay piovides a unique, integiated appioach
to building web sites. You can concentiate on building youi site while Lifeiay
does the integiation woik foi you.
Te Message Boaids poitlet has a lot of conguiation options, but they aie
stiaightfoiwaid to use and aie the ieason why this poitlet is a full-featuied
foiumapplication foi youi web site. To get staited, add a Message Boaids poitlet
to youi site. Once it is added, click the Menu icon in the poitlets title bai and
click Conguration. Teie aie two iows of tabs. Te ist tab in the top iow is
7.4. DISCUSS, ASK AND ANSWER USING THE MESSAGE BOARDS 22
titled Setup. Tis is wheie you can conguie the application the way you want
it to behave on youi site.
General
Te ist tab beneath Setup is labeled General. Heie, you can enable anonymous
posting, subsciibe by default, ags, iatings, and thiead as question by default.
You can also choose whethei you want the message foimat to be BBcode oi
HTML. Anonymous posting, subsciibe by default, ags, and iatings aie selected
by default and the default message foimat is BBcode.
Enabling Allow Anonymous Posting allows useis without an account on the
system to post messages to youi message boaids. Whethei oi not you youll
want to do this depends on the type of community you aie building. Allow-
ing anonymous posting opens youi site to anyone who might want to spam
youi foiums with unwanted oi o topic adveitising messages. loi this ieason,
most of those who implement message boaids tuin anonymous posting o by
unchecking this box.
Enabling the Subscribe by Default option automatically subsciibes useis to
thieads they paiticipate in. Whenevei a message in a thiead is added oi updated,
Lifeiay sends a notication email to each usei who is subsciibed to the thiead.
You can set the Message Format to eithei BBCode oi HTML. Tis deteimines
the maikup language of useis actual message boaid posts. Dieient WYSlWYG
editois aie piesented to useis depending on which option is enabled. Both edi-
tois have a Source buuon which allows useis to view the undeilying BBCode oi
HTML of a message. Useis can compose messages using eithei the WYSlWYG
oi Souice view and can switch between views duiing message composition by
clicking on the Source buuon.
Enabling Enable Flags allows youi useis to ag content which they considei
to be objectionable. lf you aie allowing anonymous posting, you might use ags
in combination with it if you have someone administeiing youi message boaids
on a day-to-day basis. Tat way, any unwanted messages can be agged by
youi community, and you can ieviewthose agged messages and take whatevei
action is necessaiy. Using ags is also a good piactice even if youie not allowing
anonymous posting.
Enabling Enable Ratings enables youi useis to give ceitain posts a scoie. Tis
scoie is used by Lifeiay Poitals social activity systemto iank youi site membeis
by how helpful theii contiibutions aie. You can iead moie about social activity
latei in this chaptei and in chaptei 9.
Enabling the read as estion by Default option automatically checks the
maik as question box in the new thiead window. Tieads maiked as questions
22 CHAPTER 7. COLLABORATION SUITE
display the ag waiting foi an answei. Subsequent ieplies to the oiiginal mes-
sage can be maiked as an answei.
Email From
Tis tab allows you to conguie the name and email addiess fiom which mes-
sage boaid email notications aie sent. Te default name and email addiess
aie those of the default administiatoi account the name is Test Test and the
email addiess is test@liferay.com. Make suie to update this email addiess
to a valid one that can be dedicated to notications.
Message Added Email
Tis tab allows you to customize the email message that useis ieceive when a
message is added to a topic to which they aie subsciibed.
Enabled: allows you to tuin on the automatic emails to subsciibed useis.
Uncheck the box to disable the message added emails.
Subject Prex: lets you choose a piex to be piepended to the subject line
of the email. Tis is usually done so that useis can set up message lteis to ltei
the notications to a specic foldei in theii email clients.
Body: allows you to wiite some content that should appeai in the body of
the email.
Signature: lets you add some content to appeai as the signatuie of the email.
Below the elds is a section called Denition of Terms which denes ceitain
vaiiables which you can use in the elds above to customize the email message.
Some of these vaiiables aie foi the message boaid categoiy name, the site name,
and moie.
Message Updated Email
Te Message Updated Email tab is identical to the Message Added Email tab, ex-
cept it denes the email message that useis ieceive whenevei a topic is updated.
Thread Priorities
You can dene custom piioiities foi message thieads on this tab. Tese allow
administiatois to tag ceitain thieads with ceitain piioiities in oidei to highlight
them foi useis. By default, thiee piioiities aie dened Uigent, Sticky, and
Announcement. To dene a thiead piioiity, entei its name, a URL to the image
7.4. DISCUSS, ASK AND ANSWER USING THE MESSAGE BOARDS 22
icon that iepiesents it, and a piioiity numbei which denotes the oidei in which
that piioiity should appeai.
Teie is also a eld on this foimthat allows you to select a localized language
foi youi piioiities. lf you need to do this, you can select the language fiom the
selection box.
User Ranks
On this tab, useis can be ianked accoiding to the numbei of messages they have
posted. You can set up custom ianks heie. Defaults have been piovided foi you,
going fiom zeio messages all the way up to one thousand.
ln addition to ianks, you can also choose labels foi ceitain useis to have
displayed in theii pioles as shown by the Message Boaids application. Tese
labels coiiespond to membeiships these useis have in youi poital. Below aie
examples of using the label Moderator. Te Modeiatoi label in this conguiation
is applied foi anyone who is a pait of any of the Message Boaids Administiatoi
gioups the site iole, the oiganization, the oiganization iole, the iegulai iole, oi
the usei gioup. Of couise, you piobably wouldnt want to cieate a iole, oiga-
nization, oiganization iole, site iole, and usei gioup all with the same name in
youi poital, but you get the idea.
Moderator=site-role:Message Boards Administrator
Moderator=organization:Message Boards Administrator
Moderator=organization-role:Message Boards Administrator
Moderator=regular-role:Message Boards Administrator
Moderator=user-group:Message Boards Administrator
As you can see, all you need to do is set the iank, the collection type, and
the name of the type. ln the example above, anyone who has a site iole, an
oiganization iole, a iegulai iole, oi is in a usei gioup called Message Boards
Administrator, oi anyone who is the oiganization ownei gets the modeiatoi
iank.
As with thiead piioiities, on this tab you can dene whethei youi ianks aie
localized in a paiticulai language.
RSS
Message boaid thieads can be published as RSS feeds. Tis tab allows you to
dene how the feeds aie geneiated.
228 CHAPTER 7. COLLABORATION SUITE
Maximum Items to Display: lets you select the numbei of items to display
in the feed.
Display Style: lets you select the style. You can publish the full content, an
abstiact, oi just the title of a thiead.
Format: allows you to choose the foimat RSS 1.0, RSS 2.0, oi Atom 1.0.
Permissions
Te default page that the Message Boaids poitlet displays has thiee buuons on
it. Click the one labeled Permissions. Tis allows you to dene which ioles have
the ability to add a categoiy of thieads oi to ban abusive useis fiomthe message
boaids. Select the ioles and peimissions you want to conguie and then click
Submit.
Adding Categories
You aie now ieady to add categoiies to youi message boaids. Click the Add
Category buuon. You may meige with a Paient Categoiy by enabling the Merge
with Parent Category check box and clicking the Select buuon. Entei a name foi
the categoiy and a desciiption of the categoiy.
Staiting with Lifeiay .1, categoiies can have dieient display styles. Te
available categoiies must be set in poital piopeity message.boards.cate-
gory.display.styles and the default categoiy in message.boards.category.dis-
play.styles.default. When cieating a new categoiy, you can select the dis-
play style you like foi that categoiy. By default, Lifeiay piovides two piedened
display styles, although many moie can be easily added
Default: classic display style foi geneial puipose and discussions.
estion: designed foi discussions in a foimat of questions and answeis.
You can add as many categoiies to youi message boaids as you wish. As
we saw above, categoiies can have subcategoiies. You can add any numbei of
top-level categoiies to a message boaid. You can also edit any categoiy and
add subcategoiies to an unlimited level. loi usability ieasons, you dont want
to nest youi categoiies too deep, oi youi useis will have tiouble nding them.
You can always add moie categoiies as youi message boaids giow. linally, each
categoiy can have any numbei of thieads.
At the bouom of the foim foi cieating oi editing a message boaid categoiy
is a check box foi enabling the mailing list function. lf dont want to add a
mailing list to the categoiy youie cieating, click Save now. You can always edit
an existing categoiy to add, edit, oi iemove a mailing list.
7.4. DISCUSS, ASK AND ANSWER USING THE MESSAGE BOARDS 229
Figure 7.23: Editing a Message Boards Category
Lifeiays Message Boaids poitlet suppoits two dieient mechanisms foi send-
ing email notications usei subsciiptions and mailing lists. Lets discuss usei
subsciiptions ist and then mailing lists.
User Subscriptions and Mailing Lists
Te ist mechanism Lifeiay uses foi sending email notications is usei sub-
sciiptions. Useis can subsciibe to paiticulai categoiies and thieads. Lifeiay
uses the message boaids conguied Email From addiess to send email noti-
cations to subsciibed useis whenevei a new post is cieated oi an existing post
is updated. Lifeiay can impoit email ieplies to message boaid notications di-
iectly into the message boaid. Tis is a veiy useful featuies since it allows
useis to inteiact on the message boaid via email without needing to log in to
the poital and view the message boaid page diiectly. Howevei, this featuie is
not enabled by default. To enable this featuie, add the following line to youi
portal-ext.properties le
230 CHAPTER 7. COLLABORATION SUITE
pop.server.notifications.enabled=true
As this piopeity suggests, Lifeiays message boaids usei subsciiption mech-
anism uses the POP mail piotocol. When an email ieply to a message boaid
notication is iead by Lifeiay, the ieply is posted to the message boaid and
then deleted fiom the mail seivei. Deleting the message fiom the mail seivei
is the POP piotocols default behavioi and Lifeiay assumes that youi POP mail
seivei behaves this way. Most POP clients oei an option to leave mail on the
mail seivei afei its been downloaded but you shouldnt exeicise this option.
lf you conguie mail to be lef on the mail seivei, Lifeiay will iepeatedly send
copies of each ietained message along with each new email notication thats
sent to subsciibed useis.
When enabling message boaids to impoit ieplies to email notications, you
should decide whethei oi not you want to you a mail seivei subdomain to han-
dle notications. By default the following line is set in youi poital piopeities
pop.server.subdomain=events
Tis piopeity cieates a special MX (mail exchange) subdomain to ieceive
all poital-ielated email (e.g., events.lifeiay.com). lf you dont want to use the
subdomain appioach, you can unset this value to tell Lifeiay to use the Email
From addiess specied in the poitlet piefeiences to ieceive message boaid no-
tication email ieplies. loi example, the Email From addiess could be set to
replies@liferay.com.
lf you dont want to use a mail seivei subdomain, add the following line to
youi portal-ext.properties le
pop.server.subdomain=
lf youie not using a mail subdomain, Lifeiay paises the message headeis of
emails fiom the Email From addiess to deteimine the message boaid categoiy
and message lD. lf you keep the pop.server.subdomain=events default, the
email notication addiess takes the following foim
mb.[category_id][message_id]@events.liferay.com
ln this case, Lifeiay paises the email addiess to nd the categoiy and mes-
sage lD. Paising the email addiess is safei than paising message headeis since
dieient email clients tieat message headeis dieiently. Tis is why the events
subdomain is enabled by default.
7.4. DISCUSS, ASK AND ANSWER USING THE MESSAGE BOARDS 231
Additionally, you can conguie the inteival on which the POPNotifica-
tionListener iuns. Te value is set in one minute inciements. Te default
seuing is to check foi new mail eveiy minute, but you can set it to whatevei
you like
pop.server.notifications.interval=1
Te second mechanism Lifeiay uses foi sending email notications is mail-
ing lists. Any categoiy in a Lifeiay message boaid can have its own mailing
list. Lifeiays mailing list mechanism, unlike its usei subsciiption mechanism,
suppoits both the POP and the lMAP piotocols. POP is the default piotocol but
each message boaids mailing list is conguied independently. lf you choose the
lMAP piotocol foi a categoiys mailing list, make suie to conguie the lMAP
inbox to delete messages as they aie pulled by the email client that sends mes-
sages to the useis on the mailing list. Otheiwise, each email message thats
ietained on the seivei is sent to the mailing list each time theies a new post oi
an update in the categoiy.
When a mailing list is enabled foi a message boaid categoiy, Lifeiay listens
to the specic email inbox thats conguied foi the mailing list. Enabling the
mailing list function allows useis on the mailing list to simply ieply to the no-
tication messages in theii email clients. Lifeiay pulls the messages fiom the
email inbox its conguied to listen to and automatically copies those ieplies to
the appiopiiate message boaid thiead.
With both usei subsciiptions and mailing lists, useis can ieply to message
boaid notication emails and Lifeiay impoits theii ieplies to the message boaid.
Howevei, with mailing lists, useis ieply to the mailing list and Lifeiay listens
to the specic inbox conguied foi the mailing list and copies messages to the
appiopiiate message boaid categoiy. With usei subsciiptions, by default, email
ieplies to message boaid notications aie not impoited to the message boaids.
Tis featuie has to be enabled in youi portal-ext.properties le. Once
this featuie has been enabled, useis can ieply to a specic addiess and have
theii ieplies copied to the message boaid.
Note Since any numbei of sites can use a globally scoped message boaid,
globally scoped message boaids do not suppoit usei subsciiptions oi mailing
lists. Make suie to use a site-scoped oi page-scoped message boaid if you need
usei subsciiptions oi a mailing list with youi message boaid.
To enable the mailing list functionality foi a categoiy, you need a dedicated
email addiess foi the categoiy. Once you click the Active check box, a numbei of
othei options appeai. When a mailing list is activated, Lifeiay impoits messages
it ieceives fiomthe mailing list to the message boaid. Lifeiay looks foi a Lifeiay
232 CHAPTER 7. COLLABORATION SUITE
usei with the sendeis email addiess. lf the sendei isnt a Lifeiay usei and the
AllowAnonymous Emails box is unchecked, the message is thiown away and not
posted to the message boaid. lf the Allow Anonymous Emails box is checked,
anyone can send email to the message boaid categoiys dedicated email account
and Lifeiay copies the messages to the message boaid.
Email Address: lets you entei the email addiess of the account that will
ieceive the messages.
Next, theie aie two sections Incoming and Outgoing. Tese dene the mail
seuings foi ieceiving mail and foi sending mail. Te lncoming tab has the fol-
lowing options
Protocol: lets you select POP oi lMAP.
Server Name: lets you entei the host name of the mail seivei you aie using.
Server Port: allows you to specify the poit on which youi mail seivice is
iunning.
Use a Secure Network Connection: lets you use an enciypted connection if
youi seivei suppoits it.
User Name: lets you entei the login name on the mail seivei.
Password: lets you entei the passwoid foi the account on the seivei.
Read Interval (Minutes): allows you to specify how ofen Lifeiay will poll
the seivei looking foi new messages to post to the message boaid.
Te Outgoing section has the following options
Email Address: lets you entei the email addiess that messages fiom this
categoiy should come fiom. lf you want youi useis to be able to ieply to the
categoiies using email, this should be the same addiess conguied on the In-
coming tab.
Use CustomOutgoing Server: allows you to use a dieient mail seivei than
the one that is conguied foi the poital. lf you check this box, moie options
appeai.
Server Name: lets you entei the host name of the SMTP mail seivei you aie
using.
Server Port: allows you to specify the poit on which youi mail seivice is
iunning.
Use a Secure Network Connection: allows you to use an enciypted connec-
tion if youi seivei suppoits it.
User Name: lets you entei the login name on the mail seivei.
Password: lets you entei the passwoid foi the account on the mail seivei.
When youie nished conguiing the mailing list foi youi categoiy, click
Save.
7.4. DISCUSS, ASK AND ANSWER USING THE MESSAGE BOARDS 233
Using the Message Boards
Upon seeing Lifeiays Message Boaids poitlet, youi useis will immediately iec-
ognize that the inteiface is similai to many othei implementations theyve seen
befoie. Message boaids aie nothing new to the lnteinet, and many people have
been using themfoi quite a long time. loi that ieason, Lifeiays message boaids
will seem veiy familiai to youi useis.
Tieads can be viewed in many ways. At the top of the poitlet is a set of tabs
Recent posts, My Posts, My Subscriptions, and foi administiative useis, Statis-
tics and Banned Users. Te Recent Posts tab shows all posts fiom all categoiies
by date, so you can keep up on all the most iecent discussions in the message
boaids. Te My Posts tab shows all of the posts foi the usei that is cuiiently
logged in. Tis is a convenient way to get back to a pievious conveisation in
oidei to ietiieve some peitinent infoimation. Te My Subsciiptions tab allows
a usei to manage thiead subsciiptions. lf you lose inteiest in a paiticulai topic,
you may want to visit this tab and unsubsciibe fiom a thiead.
loi administiatois, the Statistics tab shows the numbei of categoiies, the
numbei of posts, and the numbei of paiticipants in youi message boaids. lt
also has a list of who the top posteis to youi message boaids aie. Te Banned
Useis tab shows all of the useis who have been banned fiom posting on the
message boaids.
Posting NewThreads
To post a new thiead simply select the Post New read buuon. You will see a
message editing foim. Te body eld on this foim is dieient fiom that of the
othei poitlets in Lifeiay. Te ieason foi this is to suppoit BBCode, which is a
standaid foim of maikup used in many message boaid pioducts. Befoie BB-
Code was invented, many message boaid pioducts would allow useis to entei
HTML to foimat theii messages. Tis, howevei, enabled auackeis to inseit ma-
licious code into the message boaid. BBCode was invented to piovide useis a
way of foimauing theii messages without allowing them to entei HTML. Simi-
laily, Lifeiay suppoits BBCode in the message boaids poitlet because the othei
editoiwhich is used foi the Content Management System, the Blogs poitlet,
and othei poitletspioduces HTML. Tis is appiopiiate foi those othei poitlets,
as they aie only used by piivileged useis, but it is not appiopiiate foi the mes-
sage boaids. Besides this, many useis of message boaids aie familiai with BB-
Code and aie used to it, and the editoi that is piovided foi Lifeiays Message
Boaids poitlet makes it veiy easy to use.
234 CHAPTER 7. COLLABORATION SUITE
Figure 7.24: Editing a Message Boards Post
Te message boaids editoi is quite iich. lt suppoits bold, italicized, undei-
lined, and ciossed-out text, links, images, colois, lists, tables, alignments, quo-
tation blocks, code blocks, dieient fonts and font sizes, and moie. Teie aie
even a bunch of smiley faces that you can use.
Useis who have Modeiatoi access to the boaid can modify the piioiity of
messages. You can also use the editoi to quote fiom messages that you aie
ieplying to, to inseit emoticons, to add piefoimaued text, and moie. Messages
that aie posted to the message boaids aie shown by default in a thieaded view
so that ieplies aie auached to the piopei paient message. Tis makes it easy to
follow along with conveisations.
When viewing a message boaid thiead, useis aie given seveial options. At
the top iight of the thiead aie thiee icons, allowing useis to view thieads in a
at view, in a tiee view, oi in a combination view. A at view shows all of the
messages in the oidei in which they aie posted. A tiee view shows all of the
7.4. DISCUSS, ASK AND ANSWER USING THE MESSAGE BOARDS 23
Figure 7.25: Emoticons Available in the Editor
messages in a thieaded view, so that ieplies aie next to the messages they aie
ieplying to. A combination view shows the thieads at the top as subjects only,
with the at view undeineath.
When viewing a thiead, useis can click links allowing them to post a new
thiead, subsciibe to the thiead they aie viewing, oi if they have administiative
access, lock a thiead oi move a thiead to anothei categoiy. Subsciibing to a
thiead causes Lifeiay to send the usei an email whenevei a new message is
posted to the thiead. lf you have enabled the mailing list featuie foi the categoiy
in which the thiead iesides, useis can simply ieply to these messages in oidei
to post back to the thiead, without having to visit youi site.
Te Message Boaids poitlet is also highly integiated with Lifeiays usei man-
agement featuies. Posts on the message boaid show useis pictuies if they have
uploaded one foi themselves, as well as the dates that useis cieated an lD on
youi site.
Message Board Administrative Functions
Te Message Boaids poitlet piovides foi the day to day administiation of the
message thieads. You may wish to sepaiate this function out by a iole, and
23 CHAPTER 7. COLLABORATION SUITE
then delegate that iole to one oi moie of youi useis. Tat would fiee you up to
concentiate on othei aieas of youi web site. To do this, you can cieate a iole
called Message Boaid Administiatois. Tis iole can be scoped by the poital, an
oiganization, oi a site. lf you have a poital scoped iole, membeis of this iole
will be able to administei any Message Boaids poitlet in the poital. lf it is an
oiganization oi site scoped iole, membeis of this iole will be able to administei
a Message Boaids poitlet in only the oiganization oi site which assigned the
iole to them.
Go to the Contiol Panel and cieate this iole. Once it is cieated, click Actions
Dene Permissions. Click the Add Permissions diopdown list. Biowse the list
until you nd the Message Boaids poitlet undei the Site Content section and
then click on it. You will then see a scieen which allows you to conguie the
vaiious peimissions on the poitlet.
Select the peimissions you would like message boaid administiatois to have
and then click Save. You can add useis to this iole and they will inheiit the
peimissions. Message Boaid administiatois can peifoim all of the functions we
have alieady piesented, including cieating and deleting categoiies and posting
thieads. ln addition to these, a numbei of othei functions aie available.
Moving Threads
Many times a usei will post a thiead in the wiong categoiy. Administiatois may
in this case want to move a thiead to the piopei categoiy. Tis is veiy easy to
do. You can select the Actions menu to the iight of the thiead and choose Move
read. Oi, if you aie alieady viewing the thiead and you have administiative
access, theie is a link at the top of the thiead labeled Move read. Click this
link. You will be piesented with a simple foim which allows you to select a
categoiy to which to move the thiead and a check box which allows you to post
a message explaining why the thiead was moved. Tis message will be posted
as a ieply to the thiead you aie moving. When nished, click the Move read
buuon and the thiead will be moved.
Deleting Threads
Useis with administiative access to the message boaids can delete thieads. Some-
times useis begin discussing topics that aie inappiopiiate oi that ieveal con-
dential infoimation. ln this case, you can simply delete the thiead fiom the
message boaids. Tis is easy to do. liist, view the list of thieads. Next to eveiy
thiead is an Actions buuon. Click Actions Delete to delete the thiead. Tis
7.4. DISCUSS, ASK AND ANSWER USING THE MESSAGE BOARDS 23
Figure 7.26: Dening Permissions for the Message Board Administrators
Role
does not pievent useis fiom ie-posting the infoimation, so you may need to be
vigilant in deleting thieads oi considei the next option.
Banning Users
Unfoitunately, sometimes ceitain useis become abusive. lf you wind up with
a usei like this, you can ceitainly make auempts to wain him oi hei that the
behavioi he oi she is displaying is unacceptable. lf this does not woik, you can
ban the usei fiom posting on the message boaids.
Again, this is veiy easy to do. lind any post which was wiiuen by the abusive
usei. Undeineath the useis name/piole pictuie is a link called Ban this User.
238 CHAPTER 7. COLLABORATION SUITE
Click this link to ban the usei fiom the message boaids.
lf afei taking this action the usei apologizes and agiees to stop his oi hei
abusive behavioi, you can choose to ieinstate the usei. To do this, click the
Banned Users tab at the top of the Message Boaids poitlet. Tis will show a list
of all banned useis. lind the usei in the list and select Unban this User.
Splitting Threads
Sometimes a thiead will go on foi a while and the discussion completely changes
into something else. ln this case, you can split the thiead wheie the discussion
diveiges and cieate a whole new thiead foi the new topic. Administiative useis
will see a Split read link on each post. To split the thiead, click the link. You
will be biought to a foim which allows you to add an explanation post to the
split thiead. Click Ok to split the thiead.
Editing Posts
Administiative useis can edit anyones posts, not just theii own. Sometimes
useis will post links to copyiighted mateiial oi unsuitable pictuies. You can edit
these posts, which allows you to iedact infoimation that should not be posted
oi to censoi piofanity that is not allowed on youi message boaids.
Permissions
Peimissions can be set not only on thieads, but also on individual posts. You
can choose to limit a paiticulai conveisation oi a post to only a select gioup of
people. To do this, click the Permissions link on the post and then select among
the Delete, Permissions, Subscribe, Update, and View peimissions foi the paiticu-
lai iole to which you want to giant paiticulai access. Tis function can be used,
foi example, to allow some piivileged useis to post on a ceitain thiead, while
otheis aie only allowed to viewit. Othei combinations of the above peimissions
aie also possible. Next, lets discuss Lifeiays Wiki poitlet.
7.5 Working together with the Wiki
Lifeiays Wiki poitlet, like the Message Boaids poitlet, is a full-featuied wiki
application which has all of the featuies you would expect in a state of the ait
wiki. Again, though, it has the benet of being able to take advantage of all of
7.5. WORKING TOGETHER WITH THE WIKI 239
the featuies of the Lifeiay platfoim. As such, it is completely integiated with
Lifeiays usei management, tagging, and secuiity featuies.
So, what is a wiki` Basically, a wiki is an application which allows useis
to collaboiatively build a iepositoiy of infoimation. Teie aie, of couise, many
implementations of this idea, the most famous of which is Wikipedia. Wikipedia
is a full online encyclopedia developed collaboiatively by useis fiomall ovei the
woild, using a wiki. Anothei example would be Lifeiays wiki, which is used
foi collaboiative documentation of the Community Edition of Lifeiay Poital.
A wiki application allows useis to cieate and edit documents and link them
to each othei. To accomplish this, a special foim of maikup is used which is
sometimes called wikitext. Unfoitunately, the piolifeiation of many dieient
wiki applications iesulted in slightly dieient syntax foi wikitext in the vaiious
pioducts, as each new wiki tiied to focus on new featuies that othei wikis did
not have. loi that ieason, a pioject called WikiCieole was staited. Tis pioject
iesulted in the ielease of WikiCieole 1.0 in 200, which is an auempt to dene
a standaid wiki maikup that all wikis can suppoit.
Rathei than dene anothei wikitext syntax, Lifeiays Wiki poitlet suppoits
WikiCieole as its syntax. Tis syntax is a best-of-bieed wiki syntax and should
be familiai to useis of othei wikis. Te poitlet piovides a handy cheat sheet foi
the syntax on the page editing foim, with a link to the full documentation if you
wish to use some of WikiCieoles advanced featuies.
Getting Started with the Liferay Wiki
Te Wiki poitlet woiks just like the othei poitlets developed by Lifeiay. Add
the poitlet to a page using the Add More menu and then click Conguration
in the poitlet menu in the Wiki poitlets title bai. Youll see some options aie
likely to be familiai to you by nowsuch as shaiing the application with websites,
lacebook, Google Gadgets, etc. You will also notice that the communication tab
has some additional options not seen in the othei poitlets.
Te communication tab of the conguiation window allows you to cong-
uie communication acioss poitlets, using piedened public iendei paiameteis.
liom heie you can modify six public iendei paiameteis categoiyld, nodeld,
nodeName, iesetCui, tag, and title. loi each paiametei you can
lgnoie the values foi this paiametei that come fiom othei poitlets. loi
example, the wiki poitlet can be used along with the tags navigation poit-
let. When a usei clicks on a tag in the tags navigation poitlet, the wiki
shows a list of pages with that tag. ln some cases an administiatoi may
want the wiki poitlet to always show the fiont page independently of
240 CHAPTER 7. COLLABORATION SUITE
Figure 7.27: Communication Tab of the Wiki Portlet
any tag navigation done thiough othei poitlets. Tis can be achieved by
checking the lgnoie check box so that the values of the paiametei coming
fiom those othei poitlets aie ignoied.
Read the value of a paiametei fiom anothei poitlet. Tis is an advanced
but veiy poweiful option that allows poitlets to communicate without
conguiing it befoiehand. loi example, imagine that the wiki poitlet
is used to publish infoimation about ceitain countiies. lmagine fuithei
that a custom poitlet that allows biowsing countiies foi administiative
ieasons was wiiuen and placed on the same page. We could associate to
this second poitlet a public iendei paiametei called country to designate
the name of the countiy. Using this pioceduie, we can cause the wiki
to show the infoimation fiom the countiy being biowsed thiough in the
othei poitlet. You can do this heie foi the wiki by seuing the value foi
the title paiametei to be iead fiom the countiy paiametei of the othei
poitlet.
Once you have set the options the way you want them, click Save.
Managing Wikis
Te Wiki poitlet can contain many wikis. By default, it contains only one, called
Main. To manage Wikis, navigate to the Control Panel and select Wiki. Tis page
7.5. WORKING TOGETHER WITH THE WIKI 241
allows you to add, modify, and delete wikis. Te Main wiki has alieady been
added foi you.
At the top of this scieen is a Permissions buuon. Clicking this allows you to
dene which ioles have access to cieate wikis. lf you have cieated a specic
iole foi cieating wikis, you can click the box in the Add Node column and then
click Submit, and that iole will have access to cieate new wikis in this poitlet.
Clicking the Add Wiki buuon piompts you to entei a name and desciiption
foi the new wiki. You can also set up some default peimissions. When you
cieate a new wiki, it appeais in a list at the top of the main page of the Wiki
poitlet.
Next to each wiki in the list of wiki nodes is an Actions buuon. Tis buuon
contains seveial options
Edit: lets you edit the name and desciiption of the wiki.
Permissions: lets you dene what ioles can add auachments to wiki pages,
add pages to the wiki, delete pages, impoit pages to the wiki, set peimissions
on the wiki, subsciibe to the wiki, update existing pages, and view the wiki.
Import Pages: allows you to impoit data fiom othei wikis. Tis lets you
migiate o of anothei wiki which you may be using and use the Lifeiay wiki
instead. You might wish to do this if you aie migiating youi site fiom a set of
dispaiate applications (i.e. a sepaiate foium, a sepaiate wiki, a sepaiate content
management system) to Lifeiay, which piovides all of these featuies. Cuiiently,
MediaWiki is the only wiki that is suppoited, but otheis aie likely to be sup-
poited in the futuie.
RSS: opens a new page wheie you can subsciibe to an RSS feed using Live
Bookmaiks, Google, oi Yahoo.
Subscribe: allows you to subsciibe to a wiki node, and any time a page is
added oi updated Lifeiay will send you an email infoiming you what happened.
Delete: deletes the wiki node.
To go back to youi wiki, click on its name in the list of wikis. Note that
theie is also a wiench icon leading to a conguiation menu on this poitlet in
the Contiol Panel. Tis contains seveial othei options which you may have seen
on othei poitlets.
Te Email From, Page Added Email, and Page Updated Email tabs aie similai
to the ones foi notication email seuings foi othei poitlets, allowing you to
customize who wiki emails come fiom and the foimat and text of the email that
is sent when a page is added oi updated.
Te Display Seings tab gives you seveial options foi how the wiki should
be displayed. Enable Related Assets, Enable Page Ratings, Enable Comments, and
Enable Comment Ratings aie similai to the same options in othei poitlets. Tey
give you the ability to set how you want useis to inteiact with wiki documents
242 CHAPTER 7. COLLABORATION SUITE
a liule, a lot, oi not at all. Below this, you can set which wikis aie visible in
the Wiki poitlet by default and which aie hidden. You might host two wikis on
a given site, exposing one to the public and keeping the othei piivate foi site
membeis.
linally, the Wiki poitlet also suppoits RSS feeds as the othei collaboiation
poitlets do, and you can conguie its options in the RSS tab.
Adding and Editing Wiki Pages
By default, theie is one page added to youi wiki, called FrontPage. To get staited
adding data to youi wiki, click the Edit link at the top iight of the poitlet. You
will be biought to a blank editing page.
Figure 7.28: Editing the Default Page in the Wiki Portlet
You can now begin to add content to the page. Notice that theie is a veiy
convenient cheat sheet` which can help with the wiki syntax. You can use
this syntax to foimat youi wiki pages. Considei, foi example, the following wiki
document
7.5. WORKING TOGETHER WITH THE WIKI 243
== Welcome to Our Wiki! ==
\index{Wiki}
This is our new wiki, which should allow us to collaborate on
documentation. Feel free to add pages showing people how to do stuff.
Below are links to some sections that have already been added.
{[}{[}Introduction{]}{]}
{[}{[}Getting Started{]}{]}
{[}{[}Configuration{]}{]}
{[}{[}Development{]}{]}
{[}{[}Support{]}{]}
{[}{[}Community{]}{]}
Tis would pioduce the following wiki page
Tis adds a simple heading, a paiagiaph of text, and seveial links to the page.
Since the pages behind these links have not been cieated yet, clicking one of
those links takes you to an editing scieen to cieate the page. Tis editing scieen
looks just like the one you used pieviously when you wiote the fiont page.
Lifeiay displays a notice at the top of the page stating that the page does not
exist yet, and that you aie cieating it iight now. As you can see, it is veiy easy
to cieate wiki pages. All you have to do is cieate a link fiom an existing page.
Note that at the top of the scieen you can select fiom the Cieole wiki foimat
and the HTML editoi that comes with Lifeiay. We iecommend that you stick
with the Cieole foimat, as it allows foi a much cleanei sepaiation of content
and code. lf you want all of youi useis to use the Cieole foimat, you can disable
the HTML foimat using the portal-ext.properties le. See chaptei 14 foi
details about how to conguie this.
At the bouom of the page editing scieen, you can select Categories foi the
aiticle. Categoiies aie hieiaichical lists of headings undei which you can cieate
wiki pages. Tis allows you to oiganize youi content in a moie foimal fashion.
You can cieate categoiies using the Contiol Panel, in the Categories section.
Page Details
When viewing a page, you can viewits details by clicking the Details link which
appeais in the top iight of the page. Tis allows you to view many piopeities of
the page. Teie aie seveial tabs which oiganize all of the details into convenient
categoiies.
244 CHAPTER 7. COLLABORATION SUITE
Figure 7.29: Wiki Text Added to Front Page
Details
Te Details tab shows vaiious statistics about the page, and also allows you to
peifoim some actions on the page.
Title: displays the title of the page.
Format: displays the foimat foi the page eithei Cieole oi HTML.
Latest Version: displays the latest veision of the page. Te wiki poitlet au-
tomatically keeps tiack of page veisions whenevei a page has been edited.
Created By: displays the usei who cieated the page.
Last Changed By: displays the usei who last modied the page.
Attaments: displays the numbei of auachments to the page.
7.5. WORKING TOGETHER WITH THE WIKI 24
RSS Subscription: displays links which allow you to subsciibe to the page
as an RSS feed in thiee foimats RSS 1.0, RSS 2.0, and Atom 1.0.
Email Subscription: contains links allowing you to subsciibe to the entiie
wiki oi just to this page.
Advanced Actions: contains links allowing you to modify the peimissions
on the page, make a copy of the page, move (iename) the page, oi delete the
page.
History
Tis tab shows a list of all of the veisions of the wiki page since it was cieated.
You can ieveit a page back to a pievious state and you can also compaie the
dieiences between veisions by selecting the veisions and then clicking the
Compare Versions buuon.
Incoming/Outgoing Links
Te next two tabs aie foi incoming and outgoing links. Tese aie wiki links to
and fiom the page. You can use this tab to examine how this page links to othei
pages and how othei pages link back to this page.
Attachments
Te last tab is foi auachments. You can auach any le to the wiki. Tis is mostly
used to auach images to wiki aiticles which can then be iefeienced in the text.
Refeiencing them using the piopei WikiCieole syntax iendeis the image inline,
which is a nice way to include illustiations in youi wiki documents.
Navigating in the Wiki Portlet
At the top of the poitlet is a list of links which allow you to navigate aiound
the wiki. Next to the Manage Wikis buuon is a list of wikis that aie cuiiently
cieated in the poitlet. Simply click on the wikis name to begin biowsing that
wiki. Afei this is a set of navigation links
Recent Changes: takes you to a page which shows all of the iecently updated
pages.
All Pages: takes you to a at, alphabetical list of all pages cuiiently stoied
in the wiki.
Orphan Pages: takes you to a list of pages that have no links to them. Tis
can happen if you take a link out of a wiki page in an edit without iealizing its
24 CHAPTER 7. COLLABORATION SUITE
the only link to a ceitain page. Tis aiea allows you to ieview wiki pages that
aie oiphaned in this way so that you can ie-link to them oi delete them fiom
the wiki if they aie no longei ielevant.
Dra Pages: takes you to a list of pages which have not yet been published.
Useis can edit pages and save theii changes as diafs. Tey can come back latei
to nish theii page changes and publish them once they have been appioved.
Sear: allows you to a teim heie and click the Search buuon to seaich foi
items in the wiki. lf the seaich teim is not found, a link will be displayed which
allows you to cieate a new wiki page on the topic foi which you seaiched.
Te Wiki poitlet is anothei full-featuied Lifeiay application with all of the
featuies you expect fiom a state of the ait wiki. Next, well look at how Lifeiay
handles live chat.
7.6 Find out what others think or do using Polls
How well do you know youi useis` Do you evei wondei what theyie think-
ing` ls using youi site easy foi them` How do they feel about the hot-buuon
issues of the day` Do they piefei dogs ovei cats` What about the new policy
that management wants to implement` Whats theii favoiite ice cieam avoi`
When you use Lifeiays Polls featuie you can nd out the answei to these and
othei questions that should help you beuei undeistand youi useis.
Teie aie two poitlets involved in making and displaying a poll the Polls
poitlet, which is accessed thiough the Contiol Panel, and the Polls Display poit-
let, which can be added to any page in the poital.
Te Polls poitlet helps you set up the poll question and the possible answeis
useis can select. Te Polls Display poitlet is an instanceable poitlet that lets you
select which poll to display, and is the poitlet you put on the page so useis can
vote.
Te Polls poitlet allows useis and administiatois to cieate multiple choice
polls that keep tiack of the votes and display iesults on the page. Many sepaiate
polls can be managed, a sepaiate poitlet called Polls Display can be conguied
to display a specic polls questions and iesults.
Te Polls Display Poitlet allows useis to vote foi a specic polls questions
and see the iesults. Qestions must be cieated fiomthe Polls poitlet in the Con-
tiol Panel. You can display one question at a time oi you can combine seveial
questions inside a nested poitlet to cieate a suivey.
Well begin by cieating a poll in the Contiol Panel.
7.6. FIND OUT WHAT OTHERS THINK OR DO USING POLLS 24
Creating a Poll
ln the Contiol Panel, navigate to the Polls link undei Content. Click the Add
estion buuon. A foim appeais that allows you to ll out all the infoimation
foi youi poll.
Figure 7.30: Besides the Title and the Polls Question, you must enter data
for each of the Choices elds when creating a newpoll.
Title: Entei the name of the poll question.
248 CHAPTER 7. COLLABORATION SUITE
Polls estion: Entei the text of the poll question.
Expiration Date: Entei the date and time you want the poll to expiie.
Choices: Entei at least two answei options foi the poll question.
Add Choice: Entei additional answei options foi the poll question.
Permissions: Manage who can view and edit the poll.
When you have nished cieating youi poll, click Save, and it is added to the
Polls poitlet.
As moie polls aie cieated in the Contiol Panel, they become accessible thiough
the Polls Display poitlet until they aie eithei deleted oi they expiie. You can set
an expiiation date foi a poll by selecting the day and time in the Add Poll foim
oi in the New Qestion foim. Te default is set to Never Expire.
When a poll expiies, useis cant entei votes any moie, but if a Polls Display
poitlet is still publishing it, the poll iesults aie displayed on the page. To iemove
an expiied poll fiom a page, iemove the Poll Display poitlet oi conguie it to
show anothei poll question. See the section below foi moie details about the
Polls Display poitlet.
Permissions can be set on individual polls as they aie set elsewheie in Lifeiay
Poital. Peimissions can be used, foi example, to allow some piivileged useis
to vote on a ceitain poll question, while otheis can only view it. loi fuithei
infoimation about peimissions, please see chapteis 1 and 1.
As you can see, cieating a poll is faiily stiaightfoiwaid. Next, lets complete
the two-step piocess and put youi poll on a page.
Adding a Poll to a Page
Now that you have cieated youi poll question, its time to piesent it to youi
useis. Navigate to youi poital and add the Polls Display poitlet to a page. lt is
available fiom the Content Management section of the Add More menu.
Te Polls Display poitlet may look stiange when it ist appeais on youi
page. Tats because its not conguied. Befoie visitois to youi site can use the
poll, they must be able to access it. Click on the link labelled Please congure
this portlet to make it visible to all users, and a dialog box like the one below
appeais.
Undei the Setup tab is a menu option labeled estion. Selecting this option
displays the name of the poll you cieated. Choose it, click Save, and it is dis-
played on the page. Tat, in a nutshell, is how you cieate a poll, but theie is
anothei way to add a question to the Polls Display poitlet.
Stait by navigating to youi poital and placing the Polls Display poitlet on a
page. Using the icons in the lowei lef of the poitlet, choose the Add estion
7.6. FIND OUT WHAT OTHERS THINK OR DO USING POLLS 249
Figure 7.31: In the initial conguration of the Polls Display portlet, the
Question eld will remain blank until you select the appropriate poll
question.
buuon. A new foim appeais that lets you cieate anothei question. When you
aie done lling out the foim, click Save and you new poll appeais on the page.
Once the poll question has been successfully placed on the page, you can
peifoim othei tasks by using the icons in the lowei lef coinei of the poitlet.
Besides adding questions, you can also edit the cuiiently selected question oi
select existing questions.
Figure 7.32: These three buttons, highlighted in red, allowyou to manage
the conguration of the poll. Notice this poll has expired.
Edit estion: Displays a similai dialog box to the one used to cieate the
poll.
Select estion: Displays the same dialog box as Conguiation, allowing
you to choose dieient questions fiom the diopdown menu.
20 CHAPTER 7. COLLABORATION SUITE
Add estion: Allows you to cieate a new question.
You can also manage the Polls Display poitlet by clicking the wiench symbol
in the uppei iight coinei of the poitlets title bai. Now lets see the poll iesults.
Viewing the Poll Results
When you cieate a poll question, it appeais in a list in the Contiol Panel. Afei
useis vote in the poll, the data is collected heie. lf you select it, the name and
the question, as well as a bieakdown of the poll iesults appeais, including pei-
centages and total numbei of votes pei answei and the total numbei of votes
cast.
Below this is an item called Charts. Tis option shows the poll iesults iep-
iesented in vaiious giaphs. Te giaphs aie Area, Horizontal Bar, Line, Pie and
Vertical Bar.
Teie is also a listing of the useis who voted in youi poll, how they voted,
and a time/date stamp of when theii votes weie cast. Registeied useis aie iep-
iesented by theii scieen name while Guest useis aie iepiesented by a numbei.
With Lifeiay Polls you can do many things. You can ask useis veiy specic
questions oi you can use Polls to cieate a liule fun foi youi community. As with
most things in Lifeiay, you aie only limited by youi imagination. Now lets see
what you can do with Lifeiays Chat featuie.
7.7 Staying in touch with the Chat
Lifeiays Chat poitlet piovides a convenient way of allowing useis to send each
othei instant messages when they aie logged into youi web site. lt appeais as a
bai at the bouom of eveiy page, showing who is logged on, theii statuses, and
any chats the logged-in usei has open.
Te Chat poitlet is distiibuted with the Lifeiay bundles, but is not included
as pait of the .war distiibution, as it is a sepaiate plugin. lf you installed the Lif-
eiay .war manually on youi application seivei, you can install the Chat poitlet
by going to the Contiol Panel, clicking Plugins Installation, and then clicking
the Install More Portlets buuon. lind the Chat poitlet in the list, click on it, and
then click Install.
Te Chat poitlet is veiy simple to use. To change the seuings, click Seings
(found neai the lowei iight coinei next to Online Friends). Heie you can set
youi status, choose whethei oi not to show that you aie online, and whethei oi
not to play a sound if someone sends you a message while you have the window
7.7. STAYING IN TOUCH WITH THE CHAT 21
Figure 7.33: Selecting a poll in the Polls portlet allows you to see all the
information related to the poll results.
22 CHAPTER 7. COLLABORATION SUITE
Figure 7.34: This is what the pie chart for the Ice Creampoll results looks
like.
oi tab in the backgiound. Te Chat poitlet displays the numbei of youi fiiends
who aie online. Click the Online Friends link and then click on a fiiends name
to open a chat window. You can have multiple chats open at a time, and can
have one oi moie of them minimized.
Jabber Server Integration
Lifeiay .1 intioduced Jabbei seivei integiation to Lifeiays Chat poitlet. Jabbei
is the oiiginal name of the XMPP (Extensible Messaging and Piesence Piotocol)
piotocol, an open-standaid communications piotocol based on XML. Using a
chat seivei helps Lifeiays chat scale to veiy laige installations and allows foi
7.7. STAYING IN TOUCH WITH THE CHAT 23
Figure 7.35: Liferays Chat Portlet
communication between dieient chat clients. loi example, Jabbei seivei in-
tegiation allows useis using the chat poitlet in theii biowsei windows to chat
with othei useis using desktop clients like Empathy, Pidgin, oi Kopete.
Jabbei seivei integiation is not enabled by default since it iequiies a iunning
Jabbei seivei. Once you have installed and staited a Jabbei seivei, you can
enable Jabbei seivei integiation by cieating a portlet-ext.properties le
to oveiiide some piopeities of youi Chat poitlets portlet.properties le.
You could modify youi Chat poitlets portlet.properties le diiectly, but
its a best piactice to oveiiide it instead.
Installation Steps
You can use any chat seivei that suppoits Jabbei. Te Chat poitlets Jabbei
seivei integiation featuie was tested with veisions 3..0 and 3..1 of Openie,
a ieal time collaboiation seivei distiibuted undei the Open Souice Apache Li-
cense. You can download Openie fiom the web site
1
. To enable Jabbei chat
integiation, follow these steps
1
hup//www.igniteiealtime.oig/piojects/openie/
24 CHAPTER 7. COLLABORATION SUITE
1. Stait youi chat seivei. lf you aie using Openie on a Linux/Mac system,
you can stait/stop the chat seivei by executing the openie shell sciipt in
the openfire/bin diiectoiy. Usage ./openfire start oi ./openfire
stop
2. Oveiiide the portlet.properties le in youi /chat-poitlet/WEB-lNl/sic/
diiectoiy with a portlet-ext.properties le in the same diiectoiy. When
you deploy the poitlet, the piopeities les should be copied to youi /chat-
poitlet/WEB-lNl/classes/ diiectoiy. lf you have alieady deployed the Chat
poitlet, cieate the portlet-ext.properties le in youi /chat-poitlet/WEB-
lNl/classes/ diiectoiy. Te contents of youi portlet-ext.properties le
should like this
jabber.enabled=true
jabber.import.user.enabled=true
jabber.host=localhost
jabber.port=5222
jabber.service.name=<Host Name>
jabber.resource=Liferay
jabber.sock5.proxy.enabled=false
jabber.sock5.proxy.port=-1
Note that you must change jabber.service.name to the Host Name. lf
you aie using Openie, you can nd the Host Name by using the Openie ad-
ministiation web tool. lf you did not set up administiative ciedentials when
you staited Openie, the default ciedentials aie useiname admin, passwoid
admin.
Additionally, make suie that you set jabber.enabled to true and have
added the coiiect values to jabber.host and jabber.port. lf you installed
youi chat seivei on a iemote machine oi chose to not use the default poit,
change jabber.host and jabber.port accoidingly.
3. Deploy youi Chat poitlet. Remembei that this poitlet must be of veision .1
oi highei.
Single Sign On
lf the piopeity jabber.import.user.enabled is set to true, the Chat poitlet
will impoit the usei automatically to Jabbei afei he logs in to the poital. Once
the usei is impoited, he can use any Jabbei client using the same scieen name
and passwoid he uses to log in to the poital. His buddies will be also impoited
as they become online in the Chat poitlet.
7.7. STAYING IN TOUCH WITH THE CHAT 2
Figure 7.36: Openre Administration Web Tool
Note that its a lazy impoit. Useis aie impoited only afei they log in to
the poital and theii buddies will be added to his list only if they see each othei
within the Chat poitlet. Tey wont be able to use othei Jabbei chat clients until
they log in to the poital.
lf jabber.import.user.enabled is set to false, useis need to cieate
theii Jabbei account and add buddies manually. Tey have to cieate theii ac-
counts using the same scieen name and passwoid they use in the poital. lf they
dont, the Chat poitlet wont be able to connect to theii Jabbei account.
Alteinatively, since Openie integiates with LDAP, if you aie using Open-
ie and youi poital is also using LDAP foi authentication, you can disable the
jabber.import.user.enabled piopeity.
Next, lets look at how you can integiate youi email addiesses with Lifeiays
Mail poitlet.
2 CHAPTER 7. COLLABORATION SUITE
7.8 Integrating your email with Liferay Mail
Lifeiays Mail poitlet enables youi useis to inteiact with theii email using an
easy to use, ubiquitous web inteiface. lf youi mail system suppoits the lMAP
piotocol, you can use the Mail poitlet to integiate youi useis mail with the
iest of youi web site. You can also connect the Mail poitlet to a mail account
piovided by Google.
Te Mail poitlet is distiibuted with the Lifeiay bundles, but is not included
as pait of the .war distiibution, as it is a sepaiate plugin. lf you installed the
Lifeiay .war manually on youi application seivei, you can install the Mail poit-
let by going to the Contiol Panel, clicking Plugins Installation, and then clicking
the Install More Portlets buuon. lind the Mail poitlet in the list, click on it, and
then click Install.
Figure 7.37: Liferays Mail Portlet
To connect the Mail poitlet with an email account, click the Add a NewEmail
Account link. liom theie, you aie given a choice between a Custom email Ac-
count oi a Gmail Account. Choose the option that you wish, and ll out the
foim that appeais.
loi a Gmail account, all you need to do is piovide youi email addiess and
youi passwoid, and the poitlet will take caie of the iest.
loi a Custom Mail Account, the following elds aie necessaiy
Address lets you entei the email addiess which ieceives mail foi this ac-
count.
Login lets you choose a usei name foi logging into the account.
Password lets you choose a passwoid foi logging into the account.
7.9. SUMMARY 2
Incoming Settings allows you to specify the host name foi youi lMAP (ln-
teinet Mail Access Piotocol) oi POP seivei.
Incoming Port allows you to specify the poit upon which the lMAP oi POP
seivice is iunning.
Use Secure Incoming Connection allows you to use an enciypted connec-
tion to the seivei piovided that youi seivei suppoits it.
Outgoing SMTP Server lets you entei the host name of youi SMTP (Simple
Mail Tiansfei Piotocol) seivei.
Outgoing Port allows you to specify the poit upon which the SMTP seivice
is iunning.
Use Secure Outgoing Connection allows you to use an enciypted connec-
tion to the seivei piovided that youi seivei suppoits it.
When nished, click Save. Youi new email account now appeais as a tab at
the top of the page along with the buuon foi adding a mail account. ln this way,
you can add as many mail accounts as you want in oidei to view them in the
poitlet.
Click the tab foi the mail account you just conguied to be biought to an
inteiface which allows you to iead youi mail and compose new messages. To
iead a message, click on it. To compose a new message, click the Compose Email
link on the lef side of the poitlet. A foim appeais which allows you to compose
an email message using the same iich text editoi that appeais eveiywheie else
in Lifeiay. You can iead, ieply, and cieate messages, as well as manage all of
youi foldeis in Lifeiays Mail poitlet.
Te Mail poitlet is a gieat way to integiate a familiai seivice with othei the
collaboiation featuies that Lifeiay piovides.
7.9 Summary
We have exploied many of the poitlets in Lifeiays collaboiation suite. You
have seen how you can conguie all of the poitlets in a similai fashion using a
unied usei inteiface. Afei this, we went ovei all of the poitlets in succession.
Te Blogs and Blogs Aggiegation poitlets can be used to manage shaied
blogs oi blogs belonging to a gioup of people at once. Tese poitlets have all
the featuies you would want in a blog, including iich text editing, links to news
aggiegatois, tags, RSS feeds, and moie.
Te Calendai poitlet likewise can be used to manage a shaied calendai oi
a gioup calendai. lt includes featuies foi events, event notication, iepeatable
events, and impoit and expoit to and fiom the standaid iCalendai foimat.
28 CHAPTER 7. COLLABORATION SUITE
Discussion becomes easy with Lifeiays Message Boaids poitlet. Tis poitlet
can be used to manage heavily tiacked discussion foiums with ease. lt inheiits
all of the secuiity featuies of the Lifeiay platfoim and includes administiative
functions foi thiead piioiities, moving thieads, nested discussion categoiies,
banning useis, and moie.
Lifeiays Wiki poitlet is a state of the ait wiki application that useis can
make use of to collaboiate on web pages. Again, it inheiits the stiengths of the
Lifeiay platfoim in the foim of secuiity, inteiface, and seaich. You can use the
wiki poitlet to manage seveial wiki nodes oi use many wiki poitlets to manage
one node each.
Te Polls poitlet is a fun way to inteiact with useis of youi site to get an
undeistanding of what theyie thinking at any given time. lt allows you to
cieate multiple choice polls that keep tiack of the votes and display iesults on
the page. You can view these iesults in a numbei of ways, including chaits.
Lifeiay piovides a chat solution foi youi poital thats veiy easy to use. lt
allows logged-in useis to see who else is logged in to the poital and view theii
status. Useis can go invisible if they dont want otheis to know that theyie
online. Useis can chat with each othei via instant messages. You can also set up
a Jabbei chat seivei and conguie Lifeiay to use it, this allows useis who have
logged in to youi poital via theii biowseis to chat with useis using tiaditional
desktop clients.
lntegiating mail with youi poital is easy with the Mail poitlet. You can add
as many custom oi Gmail mail accounts as you wish, and this poitlet can keep
them all oiganized in one place, togethei with the iest of the things Lifeiay is
aggiegating foi you.
Lifeiays collaboiation platfoim is a full suite of integiated applications that
empowei useis to woik togethei. You can use them to gieat eect to enhance
youi poital and to build a vibiant, active community.
Cu~v1rv 8
Soci~i Nr1vovxiNc
Since the ist social netwoiks iose to populaiity, concepts such as Friend and
latei Likepieviously ieseived foi diiect human inteiactionhave taken on
new meaning in an always-online, infoimation diiven cultuie. lt could be ai-
gued that social netwoiks have tiansfoimed the way people inteiact with theii
fiiends, ielatives and colleagues. liiends, connections, followeis, ciicles and
lists have enabled people to connect and stay connected in ways theyd nevei
been able to befoie. lnitially, these concepts pioved to be highly successful foi
casual web sites but they didnt take to the business woild as quickly. But many
oiganizations aie nowiealizing the impoitance of leveiaging social inteiactions
foi moie than just iecieation. Lifeiays iobust social featuies make it a gieat
platfoim foi business web sites, casual web sites and eveiything in between.
Social applications have many dieiences when compaied to Standaid ap-
plications that aie vital to a social netwoiking site. Standaid applications have
geneial and usei specic data, wheieas social applications can shaie data within
a dened netwoik. Tis vaiiation is a huge advantage when tiying to com-
municate impoitant infoimation to a laige gioup of people. Tis dieience in
communication seuings is illustiated below
Lifeiay has a constantly impioving set of social featuies which enable you
to encouiage social inteiactions on youi own poital and to leveiage the powei
and populaiity of othei social netwoiks. ln this chaptei, well discuss
29
20 CHAPTER 8. SOCIAL NETWORKING
Figure 8.1: Standard Apps vs. Social Apps
Geneial use social poitlets
Social poitlets foi peisonal pages
Conguiing peisonal pages foi social netwoiking
How to connect useis using Lifeiay social ielations
Social equity
lntegiating Lifeiay with othei social sites
When weie nished, youll be well equipped to use Lifeiay to powei youi
social netwoik.
8.1 LeveragingSocial Portlets, Activities TrackingandUser
Connections
Lifeiay has many poitlets available foi social inteiaction and collaboiation. Some
of these poitlets aie designed to help you woik togethei as a team, while oth-
eis aie designed to fostei social inteiactions between team membeis at youi
oiganization.
Some of the social poitlets should be used on the public pages of youi poital,
while otheis should be used as pait of a useis peisonal site. As you might guess,
the poitlets foi peisonal page use aie moie focused on simple social inteiactions,
while the ones which can be placed on any site help impiove pioductivity.
8.1. LEVERAGING SOCIAL PORTLETS, ACTIVITIES TRACKING AND USER
CONNECTIONS 21
Figure 8.2: The Members
Portlet
Unless otheiwise noted, these poitlets aie
all piovided with minimal conguiation op-
tions. Most of them have two conguia-
tion optionsthe option to change peimis-
sions foi the poitlet view and shaiing op-
tions foi connecting the poitlet to othei web
sites. Tey do not have any way to change
options like feed length oi display styles.
Some styling changes, howevei, can be made
thiough custom CSS.
Installing the social portlets
Te social poitlets aie all included with the
Lifeiay Community Edition distiibution, but
need to be installed sepaiately foi Enteipiise
Edition. lf youie using Lifeiay Enteipiise
Edition, oi had pieviously iemoved the so-
cial poitlets fiom Community Edition, you
can use Lifeiays plugin installei to easily add
social featuies to youi poital.
lf youie logged in as an administiatoi, go
to the contiol panel and click on Plugins In-
stallation in the Server section. liom heie,
click on Install More Portlets and seaich foi
Social Networking. Once the iesults come up,
select the latest veision of the Social Net-
woiking Poitlet and click Install. Once the
install piocess nishes, you can stait using
the social netwoiking poitlets.
Using social networking on public pages
Teie aie seveial social poitlets that aie de-
signed foi use on public poital pages. Te
goal of these is to use social connections to
help a gioup woik togethei moie closely.
Tese include the Members, Meetups, Summary, and Activities poitlets.
Te Membeis poitlet is a simple list of all the cuiient sites membeis. Te
only conguiation options you have aie peimissions, which aie the
22 CHAPTER 8. SOCIAL NETWORKING
Figure 8.3: The Meetups Portlet
Figure 8.4: The Activities
Portlet
same foi eveiy poitlet. loi example, you
might change the peimissions so only mem-
beis of the cuiient site can view the poitlet.
Te Meetups poitlet is a tool foi cieat-
ing casual meetings foi useis of youi poital.
Anyone can cieate a meetup and give it a
title, desciiption, date/time, maximum num-
bei of auendees, piice and piovide an image.
Any meetups that aie cieated aie displayed
in the poitlet foi anyone to view. Useis can
iegistei foi the meetup, which lets the oiga-
nizei keep tiack of whos coming.
Te options foi cieating a meetup aie es-
sentially the same as those foi cieating a cal-
endai event and the Meetups poitlet shaies
some functionality with the Calendai. loi
moie infoimation on the Calendai poitlet
and conguiing events, see chaptei .
Te Activities poitlet comes in two vaii-
eties the standaid Activities poitlet and the
Membeis Activities poitlet. Te basic func-
tion of the poitlets aie the samethey both
display a feed of what useis aie doing on the
poital. Te dieience is that Activities displays whats going on acioss the en-
8.1. LEVERAGING SOCIAL PORTLETS, ACTIVITIES TRACKING AND USER
CONNECTIONS 23
tiie poital, while Membeis Activities displays only what membeis of the cui-
ient site have been doing. Teies also a liiends Actvities poitlet thats in-
tended foi use on useis peisonal pages. ln the Conguiation dialog box of any
vaiiety of the Activities poitlet, you can use the Maximum Activities to Display
diopdown menu to set a limit on how many activities can be displayed at once
in the poitlet window.
Figure 8.5: The Map
Portlet
Te Map poitlet allows you to view the locations
of site membeis, both locally and inteinationally.
Only membeis of the site to which the Map poitlet
has been added aie displayed. ln oidei to conguie
the Map poitlet, you need to install the lP Geocodei
poitlet (available fiomLifeiay Maiketplace) and con-
guie it to access MaxMind GeolP oi GeoLite on youi
seivei. loi moie infoimation on conguiing geolo-
cation seivices, visit the MaxMind suppoit page
1
.
Once youve installed the Geocodei poitlet and con-
guied it to access MaxMind GeolP oi GeoLite, youll
need a key fiom Google to access Googles Maps APl
so youi Map poitlet will woik. Visit the Google Maps
web site
2
to leain how to obtain a valid Google APl
key. To conguie the Map poitlet using the GeoLite
City database, use the following steps
1. lnstall the Social Netwoiking plugin, if you havent alieady done so.
2. lnstall the lP Geocodei poitlet. (Both the Social Netwoiking and lP Geocodei
apps can be installed fiom Maitketplace.)
3. Shut down youi application seivei.
4. Download the Geo Lite City database.
3
.
. Unzip the .dat le to youi desiied stoiage location on youi seivei.
. Cieate a portlet-ext.properties le in the /{ROOT}/webapps/ip-geo-
coder-portlet/WEBINF/classes/ diiectoiy of youi Lifeiay installation.
. Add the piopeity maxmind.database.file={GeoIP Lite City database
.dat file path} to this le.
1
hup//www.maxmind.com/app/installation`city1
2
hup//code.google.com/apis/maps/documentation/javasciipt/v2/intioduction.html-ObtainingKey
3
hup//www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
24 CHAPTER 8. SOCIAL NETWORKING
8. Cieate a portlet-ext.properties le in the /{ROOT}/webapps/social-
networking-portlet/WEB-INF/classes/ diiectoiy of youi Lifeiay in-
stallation.
9. Add the piopeity map.google.maps.api.key={Your API Key} to this
le. lf you havent done so alieady, youll need to geneiate a Google Maps
APl Key.
10. Restait youi application seivei.
11. Enjoy the Maps poitlet'
Next, lets look at the social netwoiking poitlets designed foi use on peisonal
pages.
Using social networking on personal pages
ln addition to the poitlets available foi geneial use, theie aie a handful that can
only be used on peisonal pages. Tese include the Summaiy, Wall, liiends, and
liiends Activities poitlets. Tese poitlets can be used to cieate piole pages
similai to lacebooks oi Googles.
Te Summaiy poitlet piovides a quick oveiview of a useis piole. When
posted in a useis peisonal site, it displays the useis name, piole pictuie and
job title. Useis can add additional peisonal infoimation by clicking on Edit in
the poitlet and lling in infoimation in the About Me section. Tis poitlet is
essential to any social implementation on Lifeiay, because it has the Friend Re-
quest buuon. Tis enables useis to initiate social ielationships. Note that this
poitlet simplies a much moie poweiful undeilying social netwoiking APl that
denes many dieient kinds of ielationships, including fiiends. Youi develop-
eis can take advantage of this APl to cieate poweiful social applications. loi
moie infoimation on this, see Liferay in Action (Manning Publications) oi the
Liferay Developers Guide.
Te Wall poitlet piovides a place foi useis to leave messages on othei useis
pioles. Te messages can only be plain text as no foimauing oi HTML is sup-
poited. Once a post is added to theii wall, useis have the ability delete it oi
iespond to it with a quick link to post on the oiiginal posteis wall.
Te liiends poitlet shows a list of all the useis fiiends with links to theii pio-
les. Te liiends Activities poitlet displays infoimation about a useis fiiends
activities on the poital.
Now that weve discussed the functions of the suite of social netwoiking
poitlets that ships with Lifeiay, lets put them all togethei and make a social
web site.
8.1. LEVERAGING SOCIAL PORTLETS, ACTIVITIES TRACKING AND USER
CONNECTIONS 2
Figure 8.6: Social Networking Portlets in a Facebook-like Layout
2 CHAPTER 8. SOCIAL NETWORKING
Liferays social tools in action
To get staited with Lifeiays social featuies, lets set up the public pages of oui
useis peisonal sites to include social apps. Because of Lifeiays exible page
layout options, we have a laige numbei of options foi how to set the pages up.
loi simplicitys sake, well make something thats faiily similai to the oiiginal
lacebook layout.
Setting up users personal pages
Befoie we stait adding poitlets to pages, we should conguie Lifeiay so that
eveiyone (oi some subset of eveiyone) has the same social featuies. We have
two ways to do this with advantages and disadvantages to each.
User Groups: Placing useis into a gioup enables you to cieate a usei gioup
site foi them. Te pages and poitlets dened by the usei gioup site aie copied
to membeis peisonal sites. With the usei gioup site, you can contiol whethei
useis can modify pages and you can push changes out to useis in the futuie.
Once the site template is assigned to a usei gioup, you can set the Default User
Associations to have all useis be the membei of a paiticulai gioup in Portal Set-
tings in the contiol panel. Te advantage of this is that it can be managed en-
tiiely thiough the GUl and its easy to conguie. lf you base youi usei gioups
site on a template, you can use the Enable propagation of changes from the site
template option to manage all usei pages simply by changing the template. Tis
is the iecommended way to manage peisonal pages acioss the poital. loi moie
infoimation on usei gioup sites, see chaptei 1.
Portal Properties Conguration: Te legacy way to do this is with the con-
guiation le. You can specify a default layout and poitlets foi peisonal pages
in youi portal-ext.properties le. Note that this method applies changes
to all useis peisonal sites. Howevei, it does not piovide as much maintainabil-
ity oi as many customization options as does using usei gioup sites. Usei gioup
sites allow you to choose whats modiable by the usei. loi moie infoimation
on the portal-ext.properties method, see Default User Private Layouts and
Default User Public Layouts in chaptei 20.
Because its the iecommended method, well use the usei gioup method to
cieate the layouts. As an administiatoi, go to the contiol panel and select Site
Templates fiom undei the Portal section. Click Add and ll out the foim. Well
call oui new site template Social Layout. Click Save.
8.1. LEVERAGING SOCIAL PORTLETS, ACTIVITIES TRACKING AND USER
CONNECTIONS 2
Figure 8.7: Creating the Site Template

Tip Unchecking Allow Site Adminis-


trators to Modify the Pages Associated with
this Site Template only pievents useis
fiom modifying the specic pages con-
tained in the template but does not disable
a useis ability to add oi modify additional
pages.
Once youve cieated the template, choose Actions Manage Pages foi So-
cial Layout fiom the Site Templates page, then click View Pages. Lets change
the name of the page fiom the default to My Prole and add some poitlets to
the page. ln the scieenshot below, we iemoved the boideis to make the page
look moie integiated, and also used Nested Poitlets to make the layout moie
inteiesting.
Back in the contiol panel, select Users and Organizations fiom the Portal
section. Once theie click Add User Group. Name the gioup Social Users.
28 CHAPTER 8. SOCIAL NETWORKING
Figure 8.8: Social Prole Site Template
When cieating a usei gioup, you have the option to set a usei gioup site, use
this option and select the Social Layout template foi youi Public Pages.
Nowgo to Portal Seings and select Users fiomthe submenu. liomthe Useis
page, go to the Default User Associations tab and entei Social Users in the Usei
Gioups section. Now all useis on the poital get a Social Piole page. Now the
question is, how do we encouiage useis to visit each otheis fancy new piole
pages`
Connecting users through collaboration
Teie aie many ways that social netwoiks connect useis. Tese geneially in-
volve some kind of mutual inteiest oi expeiience. On a site like lacebook, you
can connect with people fiom school, fiom woik oi fiom othei peisonal con-
nections. On a music based netwoiking site like Last.fm, you can connect with
people who have similai tastes to youis. With Lifeiays social netwoiking col-
laboiation is the key to connection.
Using oui example site of nosestei.com, we can take a closei look at ways
useis can be connected thiough hieiaichies and ways they can connect to each
othei. Well look at a handful of poitlets, both those designed specically foi
connecting useis and those that can cieate connections as a side-eect of just
geuing woik done.
Te Diiectoiy poitlet can piovide a simple way foi useis to connect. lf we
have a site dedicated to people with big noses, we can place a diiectoiy poitlet
on that site, listing all the useis that have joined that site. Useis can connect
by sending iequests to othei useis on that list. Tis isnt the woist way to get
useis connected but it piobably wont be veiy eective. Why not` Well, othei
than shaiing some veiy basic common inteiests, we havent ieally had any in-
teiactions.
Te Activities poitlet piovides a similai but moie eective means of con-
nection. Because it shows a list of what othei useis aie doing, this poitlet helps
8.2. MEASURING SOCIAL ACTIVITY 29
useis discovei who is among the most active acioss the site oi the poital, and
thus who might be a good connection.
Piobably the most eective way useis can connect is by inteiacting with
othei useis. Eveiy poitlet in the Collaboiation categoiy piovides infoimation
on who is contiibuting, iegaidless of how. You can see who is cieating a thiead
in a message boaid, editing a wiki aiticle, blogging oi cieating a calendai event.
Useis can use these to connect based on contentif l nd youi blog inteiesting,
oi if you answei my question on the message boaid, we can use that as a point
to connect as fiiends to fuithei oui inteiactions. Tis way, instead of oui con-
nection being foiced oi aibitiaiy, weve connected based on the fact that weve
diiectly inteiacted and shaie a common inteiestjust like people did befoie they
had the inteinet.
liiend is only the default social ielationship as implemented by Lifeiays
social poitlets. You can design things so that useis aie automatically connected
thiough Site and Oiganization membeiship. And theie aie many othei iela-
tionship types beyond liiend youi developeis can take advantage of these by
using Lifeiays social APl. Tis is coveied in Liferay in Action and the Liferay
Developers Guide. Now that youve got all these social applications iunning on
youi system, you might wondei how can l measuie social inteiaction` How do
l make identify the best contiibutois to my site` Lifeiay has an answei social
activity measuiements.
8.2 Measuring social activity
When you have a lot of usei inteiaction on youi web site, it can be helpful to
tiy to sepaiate the signal fiom the noise. Lifeiay contains a lot of applications
which end useis can use to communicate with each othei and piovide infoima-
tion. Some of this infoimation is good and helpful and some of it can be iathei
unhelpful. Using Lifeiays Social Activity featuie will help show which useis
aie making ieal, valuable contiibutions.
To activate Social Activity, youll ist need to deteimine which collaboiation
applications you want to use Social Activity. Teie aie cuiiently thiee types of
content you can use with Social Activity - Blogs Entiies, Message Boaid Mes-
sages, and Wiki Pages. Activation is a la caite - so you can use it on one, two,
oi all thiee applications. Social Activity tiacks thiee metiics fiom within each
of these applications two aie foi the usei - Participation and Contribution - and
the othei, Popularity, is foi the asset involved.
Lets activate Social Activity foi Blogs Entiies. Check the box next to Blog
Entry. You now have options to set point values and limits on seveial dieient
20 CHAPTER 8. SOCIAL NETWORKING
Figure 8.9: The Social Activity Page of the Control Panel
actions foi blogs. Youll notice each item on the list has diopdowns you can use
to set the numbei of paiticipation and contiibution points, populaiity points
aie tied diiectly to contiibution points. ln addition to that, you can expand the
box by clicking Limits in the top iight of each list item. You can use this to set
a limit on how many times a use can peifoim this activity with a specic asset
and ieceive the iequisite points. loi some activities, you can set limits on both
paiticipation and contiibution points but on new content cieation you can only
set limits on paiticipation points.
lt might not be immediately obvious, but foi all actions that do not involve
the cieation of a new asset, all of the contiibution points always go to the oiig-
inal asset cieatoi and all populaiity points go to the oiiginal asset. Tat means
if Votes on a Blog is set to have 1 Participation point and Contribution points
(and theiefoie Popularity points), the usei who votes on the asset will ieceive
8.2. MEASURING SOCIAL ACTIVITY 21
1 paiticipation point, the usei who cieated the asset will ieceive contiibution
points, and the asset will ieceive populaiity points.
Figure 8.10: Setting limits in Social Activity
lts easy to assign pointsyou can aibitiaiily assign points foi just about
anythingthe challenge is making the points signicant in some way. As men-
tioned befoie, the piimaiy puipose of social activity tiacking is to make suie
that useis who iegulaily contiibute to the poital and paiticipate in discussions
aie iecognized as such. So the cential piece of the social equity display is the
User Statistics poitlet.
Te Usei Statistics poitlet displays a list of useis ianked by an amalgamation
of theii paiticipation and contiibution scoies. By clicking on the Conguiation
icon foi the poitlet, you can change some of the specics of the iankings. Teie
aie foui check boxes that you can enable oi disable
Rank by Contribution lf this is checked, a useis contiibution scoie will be
used as a factoi in calculating theii iank.
Rank by Participation lf this is checked, a useis paiticipation scoie will be
used as a factoi in calculating theii iank.
Show Header Text Deteimines whethei the title shows oi only the iank-
ings.
Show Totals Toggles the display of the useis activity scoie next to theii
name.
Display Additional Activity Counters You can toggle the display of any
numbei of othei pieces of infoimation next to the useis name in the statistics,
ianging fiom the numbei of comments on assets a usei has cieated to the num-
bei of wiki aiticles that the usei has cieated. lf you want to display multiple data
points, you can click the plus buuon to add one and the minus buuon to iemove
one. You can have as many data points displayed as you want, but displaying
too many might make youi poitlet a liule unwieldy.
Te Group Statistics poitlet piovides some moie advanced data analytics. lf
you add it to a page, and click on the conguiation icon, you see that by default,
it will display one metiic Activities on Assets. You can click the plus buuon to
add additional slots, and choose fiom the dozen oi so metiics available foi each
22 CHAPTER 8. SOCIAL NETWORKING
Figure 8.11: The User Statistics portlet
8.3. EXPORTING PORTAL APPLICATIONS AS WIDGETS AND OPENSOCIAL
GADGETS 23
slot, coveiing viitually any action that a usei can peifoim on content on the
poital. lf you decide that youie displaying too many metiics, you can click the
minus buuon foi a paiticulai slot on the conguiation view to iemove it.
Teie aie a wide-ianging numbei of actions that you can piovide social
ciedit foi. Useis can ieceive ciedit foi eveiything fiom subsciibing to a blog
to wiiting wiki aiticles. You can easily tweak the numbeis in the contiol panel
if it becomes cleai that ceitain activities aie weighted too high oi too low.
Social Activity can be an invaluable tool foi poitals that aie heavily diiven
by community-cieated content. lt allows you to easily iecognize useis who
aie majoi contiibutois and it indicates to new useis whose advice will be most
tiustwoithy. Social Activity is easy to set up and can be conguied dieiently
foi each site, incieasing the exibility of youi poital.
Beyond Lifeiays social APl, theie is also suppoit foi the OpenSocial stan-
daid.
8.3 Exporting portal applications as widgets and OpenSo-
cial gadgets
OpenSocial is a fiamewoik designed foi the cieation of socially themed appli-
cation piogiamming inteifaces (APls). OpenSocial applications, called gadgets,
can be used in any web-based application that suppoits them. Tey aie chaiac-
teiized as simple, widely available, and easy to deploy. Gadgets aie especially
populai on social netwoiking sites. Tey can, howevei, be used in many diei-
ent ways thioughout youi site.
Lifeiay allows any OpenSocial gadget to be used on a page. An OpenSocial
gadget is specied in an XML document and consists of embedded HTML and
JavaSciipt. Lifeiay allows gadgets to communicate with each othei and with
poitlets. Tis allows youi gadgets to iun seamlessly without youi having to
constantly check oi update theii content. Tey automatically update based on
theii connections with othei applications. OpenSocial gadgets suppoit numei-
ous open web technologies such as OAuth, which well discuss in moie detail
latei in the chaptei.
Gadgets aie socially awaie and can shaie data acioss a community of useis.
You can dene youi own gioups and cieate gadgets to communicate infoimation
based on pages (community/teampages), applications (gadgets/widgets/poitlets),
data, useis, ioles and authoiization, and policies. ln shoit, you can develop gad-
gets to allow individuals to access and shaie data within theii social netwoiks.
24 CHAPTER 8. SOCIAL NETWORKING
Adding OpenSocial gadgets
Te OpenSocial plugin can be installed thiough Lifeiay Maiketplace foi both
Lifeiay CE and EE. lnstalling the OpenSocial plugin enables you to add OpenSo-
cial gadgets to pages, just like youd add poitlets. Teie aie two types of gadgets
Adhoc gadgets that useis can add to a page via URL
Gadgets published by the Contiol Panel that aie available poital-wide
liist, well go thiough steps to add an Adhoc gadget to a page.
Adding Adhoc gadgets
Tis method is a quick way to add a gadget to a single page. To do this, go to the
Add More menu and add OpenSocial Gadget to the page. Te poitlet displays
a link to pick a gadget foi display
Figure 8.12: Congure a gadget to display in your portlet.
Click the conguie link and a conguiation window opens. Next, you need
to inseit a URL to an OpenSocial gadget. Well inseit the URL foi a coloiful
calculatoi which is
http://www.labpixies.com/campaigns/calc/calc.xml
Figure 8.13: Conguring an adhoc gadget with your portlet is as easy as
pasting the gadgets URL.
8.3. EXPORTING PORTAL APPLICATIONS AS WIDGETS AND OPENSOCIAL
GADGETS 2
Afei pasting the URL into the text eld, click Save and youi new gadget is
visible on youi page.
Figure 8.14: The calculator gadget displays seamlessly on your page.
Tis paiticulai gadget allows you to change its skins to t youi needs.
Likewise, theie aie many othei usei-fiiendly inteiactive gadgets that give you
exibility to t them into youi themed sites. As you nd gadgets that would
woik nicely thioughout youi poital, you can publish them foi poital-wide use.
Youll leain that next.
Adding gadgets for portal-wide use
You can easily make gadgets available foi adding to pages as you would any
othei application. Well demonstiate this by adding a To-Do List gadget foi
poital-wide use.
1. Go to the Contiol Panel and select OpenSocial Gadget Publisher undei the
Portal heading
2. Click Publish Gadget
3. lnseit the URL foi the To-Do List gadget
http://www.labpixies.com/campaigns/todo/todo.xml
4. Select an appiopiiate categoiy foi youi gadget
. Click Save
2 CHAPTER 8. SOCIAL NETWORKING
Figure 8.15: Congure newgadgets with ease.
Figure 8.16: Publish gadgets for portal-wide use via the OpenSocial
Gadget Publisher.
8.3. EXPORTING PORTAL APPLICATIONS AS WIDGETS AND OPENSOCIAL
GADGETS 2
Youi OpenSocial Gadget Publisher should now look like the next guie.
Clicking Actions next to the gadget enables you to edit, iefiesh, change pei-
missions on, oi delete the gadget. Heie is a biief listing of what these foui
buuons do
Figure 8.17: You can
conveniently list your
gadgets within the
Gadgets category.
Edit: allows you to change the URL oi cate-
goiy.
Refresh: manually iefieshes the gadget cache
to ieect changes that have been made to the
gadget that may not cuiiently be displayed in the
poitlet.
Permissions: gives you the basic View, Update,
Delete, and Permissions options foi each iole on
youi site.
Delete: iemoves the listing foi the gadget.
lf you navigate to Add More Gadgets,
you should see the To-Do List gadget.
ln the next section, we will demonstiate how
to shaie OpenSocial gadgets with othei sites.
Sharing OpenSocial Gadgets
OpenSocial consists of a set of APls foi social
netwoiking. Lifeiay implements the OpenSocial
standaid, so you can be assuied that youi gad-
gets iun on Lifeiay. Tat also means gadgets
hosted by a Lifeiay Poital instance can be de-
ployed and iun in any standaid OpenSocial con-
tainei. lt may be benecial foi you to shaie gad-
gets fiom youi Lifeiay seivei with othei sites,
such as iGoogle. Googles iGoogle lets useis
customize theii own page and add gadgets to
theii page. Youi Lifeiay Poital useis can shaie
theii poitlets and othei OpenSocial gadgets on
iGoogle oi any othei OpenSocial-compatible site.
Lets tiy this now.
loi oui example, well shaie Lifeiays Loan Calculator on iGoogle.
1. Add the Loan Calculator poitlet onto youi Lifeiay page
2. Click the wiench icon in the uppei iight coinei of the poitlet and select
Conguration
28 CHAPTER 8. SOCIAL NETWORKING
Figure 8.18: Select the Conguration button.
3. Select the Sharing tab and the OpenSocial Gadget sub-tab
4. Check the box labeled Allow users to add Loan Calculator to iGoogle. Entei
the name of youi public domain and poit.
. Click Save
. Close out the window and navigate back to the wiench icon in the uppei
iight coinei of youi poitlet. Teie is a new option named Add to iGoogle
available. Click on this buuon to add youi poitlet to youi iGoogle page.
Figure 8.19: Allowusers to add your portlet as an OpenSocial Gadget in
iGoogle.
Youi poitlet is now available on youi iGoogle page'
8.3. EXPORTING PORTAL APPLICATIONS AS WIDGETS AND OPENSOCIAL
GADGETS 29
By going thiough this piocess, Lifeiay shaied the URL of youi poitlet to
iGoogle. Te URL you piovided is unique to youi specic instance of the poit-
let. Tis allows you to shaie multiple instances of the same poitlet as dieient
Google Gadgets.
Figure 8.20: Users simply click the Add to iGoogle button to add your
portlet to their iGoogle page.
You could use this shaiing capability to let useis view whats happening
on youi poital at a glance. As you can imagine, you can shaie all kinds of
infoimation fiom youi poital gadgets and poitlets with youi vaiious ciicles of
fiiends, colleagues, and fellow community membeis.
Gadget Personalization
Lifeiay allows gadgets on youi site to be peisonalized with data fiom thiid-
paity applications. Some of the thiid-paity sites that authoiize useis to access
application data include Eveinote, lacebook, Google, Netix, Photobucket, and
Yahoo. Of couise, many useis feel uncomfoitable giving away theii piivate
ciedentials to access these applications. loitunately, Lifeiay allows you to use
OAuth to piotect youi ciedentials while you access iesouices on these sites.
Keep these concepts in mind when going thiough the OAuth sections
Service Provider: a web application that uses OAuth foi access
Protected Resources: data contiolled by the seivice piovidei, which can be
accessed by the gadget thiough authentication
Consumer Key: a value used by the gadget to identify itself to the seivice
piovidei
Consumer Secret: a seciet the gadget uses to establish owneiship of the
consumei key
Request Token: a value the gadget uses to obtain usei authoiization, which
is exchanged foi an access token
Access Token: a value the gadget uses to gain access to the piotected ie-
souices on behalf of the usei, instead of using the useis seivice piovidei cie-
dentials
280 CHAPTER 8. SOCIAL NETWORKING
OAuth is an open standaid that authoiizes thiid-paity applications to intei-
act with a useis iesouices. Useis can shaie theii piivate iesouices fiom one
site with anothei site without supplying typical ciedentials, such as theii usei
name and passwoid. OAuth uses iequest and access tokens as well as a token
seciet to authenticate the useis of youi gadget.
A populai chaiacteiization foi the OAuth client is the valet key foi youi
web seivices. Lets say youie hosting Lifeiay Poital and have useis and cus-
tomeis coming to youi web site. You want them to have access to a thiid paity
iesouice, like Twiuei, and be able to access theii accounts fiom youi site. ln
the past, they would have to piovide theii Twiuei usei names and passwoids,
but not if you use OAuth. OAuth is a handshake mechanism wheie, instead of
iequiiing peisonal infoimation, Lifeiay iediiects useis to Twiuei, wheie they
can tell Twiuei to allow Lifeiay limited access to theii accounts. Tis exam-
ple is similai to oui eailiei valet key chaiacteiization. You wouldnt want a
valet diivei opening youi glove box, stoiage spaces, hood, and othei peisonal
compaitments within youi vehicle. You would only want him oi hei to access
things he oi she needs to paik youi cai. OAuth is based on this same idea it
allows a site just enough infoimation to do what it needs and nothing moie.
Tis assuies the usei that his peisonal infoimation is safe but gives him fiee-
dom to take advantage of valuable iesouices he typically uses fiom the seivice
piovideis site.
OAuth Admin Conguration
OpenSocial denes a specication that allows gadgets to incoipoiate OAuth to
access piotected iesouices fiom seivice piovideis. A biief example is piovided
to demonstiate how easy it is to leveiage OAuth within gadgets on youi site.
loi this example, well set up a demo Twiuei account gadget using OAuth.
liist we must conguie youi gadget. lollow the steps below to acquiie the
consumei key and seciet given by the seivice piovidei.
1. Similai to pievious examples, add the Twiuei Demo gadget to youi page.
Go to the Contiol Panel and click on OpenSocial Gadget Publisher undei the
Portal heading. Click Publish Gadget and inseit the Twiuei Demo URL
http://opensocialdeju.googlecode.com/svn-history/r15/Twitter/TwitterDemo.xml
2. Click Save
3. loi OAuth-enabled gadgets, you can select the Manage OAuth buuon fiom
the Actions tab. Select Manage OAuth foi youi Twiuei gadget. As shown
8.3. EXPORTING PORTAL APPLICATIONS AS WIDGETS AND OPENSOCIAL
GADGETS 281
below, you have seveial options undei twiuei that you must ll in to con-
guie youi gadget. You must also iegistei youi gadget with Twiuei to access
the Consumei Key and Consumei Seciet.
Figure 8.21: Twitter allows you to manage OAuth for your Twitter gadget.
4. Go to hups//www.twiuei.com and, befoie logging in, scioll to the bouom of
the page and select Developers. Ten click Create an app to begin iegisteiing
youi gadget.
Figure 8.22: Select the Developers tab on Twitter.
. lill in the Name, Description, and Website elds with what you piefei.
a. loi the Callback URL eld, entei Lifeiays default callback URL
http://myLiferayServer/opensocial-portlet/gadgets/oauthcallback
Replace myLifeiaySeivei with an appiopiiate value foi this demon-
stiation, well use 12.0.0.18080.
b. linally, select the Create your Twier application tab at the bouom of the
page.
282 CHAPTER 8. SOCIAL NETWORKING
Figure 8.23: Select Create an app fromwithin the Developers page.
Figure 8.24: Fill in Application Details to setup connectivity between your
Twitter gadget and your portal.
8.3. EXPORTING PORTAL APPLICATIONS AS WIDGETS AND OPENSOCIAL
GADGETS 283
. You aie given the OAuth seuing that you need to conguie youi gadget on
Lifeiay. Copy the Consumei Key and Consumei Seciet to youi clipboaid.
Figure 8.25: Here are the Consumer Key and Consumer Secret (values are
blacked out for security).
. Entei youi Consumei Key and Consumei Seciet undei the Manage OAuth
that you navigated to eailiei. Also, select HMAC_SYMMETRIC foi the Key Type
and then click Save.
Note Lifeiay oeis PLAINTEXT and RSA_PRIVATE as alteinative key types.
HMACsymmetiic and RSApiivate aie commonly used pioduction key types,
wheieas plain text should nevei be used in ieal-woild seuings.
8. Navigate to the Seings tab
9. Undei Application Type, select Read and Write. Ten click Update this Twier
applications seings at the bouom of the page.
Congiatulations' Youi Twiuei gadget is now conguied with OAuth.
Next, well conguie the gadget within Lifeiay Poital.
Incorporating OAuth within your site
Now that youi gadget is iegisteied with Twiuei and is conguied with OAuth,
you can add it to youi Lifeiay Poital. Te OAuth client you conguied in the
284 CHAPTER 8. SOCIAL NETWORKING
Figure 8.26: Congure the settings for your Twitter gadget.
Figure 8.27: Select the Read and Write option to enable two way
communication.
pievious section allows useis to piotect theii ciedentials while accessing ie-
souices on youi site. loi this section, well demonstiate how to add the OAuth-
conguied gadget to youi page.
1. Navigate to My Private Pages and click Add More Twier Gadget. lf
youi gadget is conguied coiiectly, it should appeai like this
2. Click on Personalize this gadget to be iediiected to the seivice piovidei.
3. lill in youi Twiuei usei name and passwoid and select Authorize app
4. Youi Twiuei Gadget should nowshowyoui last 20 tweets fiomyoui timeline.
Youi gadget should look similai to the snapshot below
8.3. EXPORTING PORTAL APPLICATIONS AS WIDGETS AND OPENSOCIAL
GADGETS 28
Figure 8.28: Your OAuth congured Twitter gadget awaits personalization
with your Twitter account.
Figure 8.29: Authorizing your OpenSocial application to use your account
is straightforward.
28 CHAPTER 8. SOCIAL NETWORKING
Figure 8.30: Check out your Twitter gadget timeline!
. Using this gadget, you can tweet youi cuiient status and have it display on
youi Lifeiay site and Twiuei page. To change the amount of tweets dis-
played, click on the wiench icon in the uppei iight coinei and select Cong-
uration. Undei the Setup tab, you can type the numbei of tweets to display.
Figure 8.31: Congure the number of Tweets to display.
. Lastly, you can tweet and view youi Twiuei timeline. Te snapshot below
displays what the Twiuei Gadget looks like when tweeting.
8.4. INTEGRATING WITH FACEBOOK 28
Figure 8.32: Here is your Twitter gadget just the way you like it!
As you can see, OAuth is easy to conguie and oeis useis the fieedom to
secuiely add valuable data fiom thiid-paity sites.
Creating and editing OpenSocial gadgets
OpenSocial gadgets aie XML documents, so as pait of Lifeiays OpenSocial in-
tegiation, a gadget editoi is included. Te gadget editoi is a complete develop-
ment enviionment foi gadgets pioviding syntax highlighting, a pieview func-
tion, undo/iedo options, and built in tabs foi woiking on multiple gadgets at
once. You can also oiganize and manage gadgets thiough a simple le managei
embedded into the poitlet. To access the gadget editoi, go to the contiol panel
and click on OpenSocial Gadget Editor in the Content section.
Once you have cieated and saved a gadget using the editoi, click on the
wiench next to the le to iename, delete, publish oi get the URL foi youi gadget.
lf you want to display youi gadget somewheie, click Publish to choose a categoiy
and display youi gadget in the application menu oi click Show URL to get a URL
to display youi gadget on any site that suppoits OpenSocial.
ln addition to the social inteiactions that you can cieate on youi poital, Lif-
eiay can integiate with some othei populai social netwoiks. Tis enables you
to leveiage theii powei and populaiity foi youi poitals content.
8.4 Integrating with Facebook
lacebook is cuiiently the numbei one social netwoik in the woild with some-
wheie in the neighboihood of 0 million active useis. lf youie tiying to build
288 CHAPTER 8. SOCIAL NETWORKING
a community on youi poital, you dont want to neglect a biidge to neaily a bil-
lion possible useis. With that in mind, Lifeiay piovides a few easy ways foi you
to integiate youi poital with lacebook.
Facebook sign on
Like many web sites you may visit, any poital iunning on Lifeiay can be set up
to use lacebook foi sign in. Tis makes it easiei foi useis to sign in to youi site,
since they wont need to iemembei anothei usei name and passwoid, loi moie
infoimation on seuing up lacebook sign on, see chaptei 1.
Using your portlets as Facebook applications
You can add any Lifeiay poitlet as an application on lacebook. To do this, you
must ist get a developei key. A link foi doing this is piovided to you in the
lacebook tab in any poitlets Conguiation scieen. You will have to cieate the
application on lacebook and get the key and canvas page URL fiom lacebook.
Once youve done this you can copy and paste theii values into the lacebook
tab. Youi poitlet is now available on lacebook.
Tis integiation enables you to make things like Message Boaids, Calendais,
Wikis and othei content on youi poital available to a much laigei audience
(unless you alieady have a billion useis on youi site, in which case, kudos to
you).
8.5 Summary
Websites like lacebook and Twiuei have auiacted hundieds of millions of useis
by simply giving useis a way to connect and communicate with each othei.
With Lifeiay, you have the powei to eithei build a poital aiound social featuies
oi enhance a poital built aiound content and collaboiation by pioviding useis
with the tools to connect and inteiact.
To get staited, you can use a selection of poitlets designed to make useis
peisonal public pages a place wheie they can inteiact with each othei by leain-
ing about othei useis and communicate using a simple messaging system. Using
the now ubiquitous concept of fiiends, useis can also foim a long teim con-
nection with othei useis they fiequently woik with oi with whom they shaie
similai inteiests.
Outside of useis peisonal pages, you have a vaiiety of poitlets, like the ac-
tivity poitlets, which aie designed to help useis identify othei useis that might
8.5. SUMMARY 289
be woiking on similai piojects, and keep tiack of whats going on aiound the
poital. You can even use the Social Activity featuie to give ciedit wheie ciedit
is due and iecognize the useis who contiibute the most.
Reaching even fuithei out, Lifeiay piovides integiation with othei sites and
seivices that enable you to connect with useis outside of youi poital, eithei by
pulling content fiom othei websites using OpenSocial integiation, oi by push-
ing content on youi poital out to a bioadei audience using lacebook integia-
tion. Weve outlined the tools you have available, now its up to you to leveiage
Lifeiays Social Netwoiking featuies in the way that best ts youi poital.
Cu~v1rv 9
UsiNc Wrn lovxs ~Nu DvN~xic D~1~
Lis1s
As needs change in business and oiganizations, the technology used to fulll
those needs must adapt as well. People use electionic means to do things that
yeais ago weie done using manual piocesses. loi example, you may want youi
team to sign up on youi web site foi a holiday paity. Oi maybe eveiy fall, you
need to put up a job posting boaid, only allowing administiatois to cieate new
job posts. Maybe you want to allow useis to manage a notebook oi To-Do list
on theii piivate pages. ln all of these cases, you want to entei in custom sets of
data, allow youi useis to add theii infoimation and be able to access the set of
data.
ln the past, youd need to be a developei to accomplish any of this. Today,
you can do it without wiiting a single line of code. Entei Lifeiays Dynamic
Data Lists. Tis is an easy way to cieate, aggiegate and display new data types.
Data Lists aie exible enough to handle all types of data, and you dont have to
wiite any code. Simply put, Lifeiay gives you the powei to
Dene youi own data denitions
Cieate new lists fiom those denitions
290
9.1. BUILDING A LIST PLATFORM IN LIFERAY 291
Customize the input foims foi ease of use
Customize the output foimat
lntegiate lists into Woikow
All of this capability is easily distilled into two concepts data dening and
data displaying. Tese data lists aie dynamic foi a ieason they aie exible and
poweiful. Whethei you want to collect simple input fiomthe usei oi develop an
entiie data entiy system foi ieal estate listings, Dynamic Data Lists have youi
use case coveied. Combined with the exibility piovided thiough templates and
the powei of languages like Velocity, entiie applications can be built in a shoit
time.
9.1 Building a list platformin Liferay
To expand and extend the social capabilities of oui site, we want to build a
new, iadical platfoim on Lifeiay custom-built lists that useis can shaie and
collaboiate on with theii fiiends (oi enemies, depending on theii Social Relation
type). Maiketing has come up with a gieat name foi oui new seivice list.it.
Oui beautiful list.it dashboaid will give useis the powei to geneiate theii
own lists, see the lists of theii fiiends and tally the iesults of ceitain types of lists
(suiveys, anyone`). Lifeiay makes this as simple as thiowing some Dynamic
Data List Display and loim poitlets on a useis piivate and public usei pages.
9.2 Dening data types
When new useis log in to list.it, they aie going to want to build a few lists
foi themselves. Chances aie, many of the lists they would want to cieateto do
lists, shopping lists and memos come to mindaie alieady dened in the poital.
All the usei has to do is cieate a new list, choose that pie-dened data type, and
have at it' A numbei of data denitions ship with the poital to help you get
staited To Do, Issues, Meeting Minutes and Contacts. Use these on theii own to
geneiate new data lists oi tweak them to t youi use case.
lf none of the built-in data denitions suits youi needs, you can dene youi
own. Peihaps we want to allow oui list.it useis (who would piobably call
themselves list-eis oi list-ies) to cieate theii own data types foi lists they
cieate. ln this case, they would need to have unfeueied access to the content of
theii piivate usei site wheie they can cieate a new data type.
292 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
Using data lists to outline a new data model is as simple as point and click.
You now have a list.it account and have been dying to bug youi fiiends and
family to sign up foi volunteei woik helping you move into a newapaitment.
Using an intuitive visual editoi, you can quickly diaw up the skeleton foi that
volunteei list in minutes. Since data lists exemplify a unique type of content foi
youi site, you can nd themin the content section of the contiol panel, selecting
Go To Control Panel Content Dynamic Data Lists oi Manage Site
Content Dynamic Data Lists. Within the dynamic data lists section, you can
eithei cieate a new data type (Manage Data Denitions) oi a new list fiom an
existing data type.
Figure 9.1: Data Lists in
the control panel.
lf you have a new data type, you need to cie-
ate a denition foi it ist. Click Manage Data
Denitions and click the Add buuon. Te ist
thing you should entei is a name foi the deni-
tion and a desciiption. Call it Volunteer Sign-Up.
When cieating a new data denition, you have
a paleue of elds to lay out, as well as a blank
canvas to constiuct the denition. Te inteiface
looks similai to cieating and editing web content
stiuctuies coveied pieviously. Lets exploie the
dieient data types at oui disposal
Boolean: piesents a checkbox to the usei and stoies eithei a true (checked)
oi false (unchecked) based on state.
Date: a piefoimaued text eld that displays a convenient date pickei to assist
in selecting the desiied date. Te foimat foi the date is goveined by the cuiient
locale.
Number: a text box that only accepts numbeis as inputs, but puts no con-
stiaints on the kind of numbei enteied.
Integer: similai to Number, except that it constiains usei input to non-fiactional
numbeis.
Decimal: similai to Number, except that it iequiies a decimal point (.) be
piesent.
Documents and Media: select an existing uploaded document to auach to
the data iecoid.
File Upload: upload a document to auach to the data iecoid. Uploads aie
stoied in Documents and Media, in an existing foldei oi in the useis default
upload location.
Radio: piesents the usei with a list of options to choose fiom using iadio
buuon inputs. Values aie stoied as Strings. Similai to Select.
9.2. DEFINING DATA TYPES 293
Select: a selection of options foi the usei to choose fiom using a combo box.
Can be conguied to allow multiple selections, unlike Radio.
Text: a simple text eld foi any String input.
Text Box: a laige text box foi long text input.
Figure 9.2: Data denition elds.
Using that iefeience as a nice cheat-sheet, you can now cieate the data type
you need foi Volunteei Woik Sign-Up. Use a Text type foi the name. loi
all the tasks youi fiiends and family can volunteei to do foi you, use Select
(obviously set to allow multiple options). linally, you dont want to foiget a
File Upload so they can upload images of themselves. Afei all, how much
moie ocial-feeling and fun is it if you can piint out some nify badges` To add
these elds, diag them fiom the paleue on the lef to the woik aiea on the iight.
When cieating data denitions, you can also customize the appeaiance of
the input elds and piovide helpful tips and hints foi those enteiing data. Some
data types have specic conguiation options but all have some in common.
Te following piopeities can be edited in thiee ways 1) by double-clicking on
any eld, 2) by clicking the geai icon in the uppei-iight coinei of the eld oi
3) by clicking the Seings tab when the eld is selected. Lets take a look at the
piopeities you can edit foi each of these eld types
Type: Lists the type of eld placed in the denition. Tis is not editable but
is available to iefeience fiom a list template.
294 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
Field Label: Sets the text that can be displayed with the eld. Tis is the
human-ieadable text that the usei sees.
Show Label: When set to Yes, the label is shown with the foim eld.
Required: When set to Yes, this eld must have data in it foi a new entiy to
be submiued.
Name: Te name of the eld inteinally, automatically geneiated. Since this
is the vaiiable name that you can iead the data fiom in a list template, you
should give a moie memoiable name heie.
Predened value: lf you would like example data oi a default value foi the
usei to stait with, entei it heie. Te elds value defaults to this when adding a
new entiy.
Tip: Each eld can have a small help icon, with a tooltip auached that dis-
plays helpful infoimation. lf you would like to piovide text foi the tooltip you
may entei it heie.
Multiple (Select): When set to Yes, allows the usei to select moie than one
option. Tis defaults to no.
Allowed File Extensions (File Upload): By default, foim validation accepts
any le type to be submiued. Set this value to a comma-delimited list of exten-
sions, including the chaiactei ., and Lifeiay checks the extension befoie the le
can be uploaded.
Folder (File Upload): Set the location the document is uploaded to in Docu-
ments and Media. You can choose fiom an existing foldei, cieate one oi default
to Documents and Medias home location.
Width (Text, Text Box, Decimal, Integer, Number): Sets the visual width
of the foim on the page. lt does not aect the values that aie stoied. Possible
values aie Small, Medium and Large.
ln addition to diagging the elds aiound to cieate youi desiied foims, you
can stack inputs within inputs by diagging a eld within anothei eld. You can
oiganize youi data into unlimited levels of hieiaichy, cieating the cleaiest, most
logical data model. Teie is also a duplicate buuon on each eld (the middle
buuon), allowing you to easily clone any eld as many times as you need.
Tat ieally coveis the basic tools that useis of list.it need to get iolling
with an unlimited aiiay of custom types. Plus, you can always come back and
change youi foim. lf you nd you needed to add some moie infoimation, simply
come back to the data denition and x it. All youi data lists that use it aie then
instantly updated with the new oi changed elds.
All thats lef to do is build a new data list and let youi useis play with it.
9.3. CREATING DATA LISTS 29
Figure 9.3: Data eld properties.
9.3 Creating data lists
Building out new lists ieally isnt all that dieient fiom cieating new pieces of
web content. Just as you can cieate new Web Content Stiuctuies to contiol the
input of a paiticulai type of web content, you can use Data List Denitions to
contiol the input of new list types. Similaily, just as you cieate a new piece
of web content, selecting the Stiuctuie you would like to use with it, list.it
useis (well call them Listies) choose the Denition they want to use when cie-
ating a new list. Now that a data denition is in place, all that iemains is to
cieate a new data list to captuie the infoimation weie going afei. Tis is the
easiest step in cieating the list, with only a few clicks between a data denition
and iobust data entiy and deliveiy.
To cieate a new volunteei list with the Volunteei Sign-Up denition
29 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
1. liom the Content section of the Contiol Panel, select Dynamic Data Lists.
2. Click on Add to cieate a new list based on a data denition, which in oui
case is the volunteei sign-up.
3. Give the data list a name, like Spring Move-In and a desciiption to assist ad-
ministiative useis in the futuie.
4. Last and most impoitantly, click Select undei the Data Detion sectionthis
is wheie you set the data model that diives this list.
. Choose the Volunteer Sign-Up data denition you cieated, then click Save.
Now that youve cieated youi biand new volunteei list, you can pestei ev-
eiyone you know to sign up. But what would it look like foi them to add an
entiy to this list` Te data denition youve pieviously cieated (oi selected)
denes the layout as well, which means the foim looks just the way you laid it
out.
But how will this data appeai` How will my awesome, new Volunteei Sign-
Up sheet oi that boiing Jobs Listing look` Te answeis to these piessing, buin-
ing questions biing us to the mecca that is the display side of this equation.
Using data list forms
A nice way to enable people to use youi foims is the Dynamic Data List loims
poitlet. Tis poitlet is tailoied to enteiing new iecoids. When you deploy that
data list foi youi useis to sign up foi a ietieat, oi youi family membeis to vol-
unteei to help you move, using the data list foim allows you to simplify the
sign-up piocess and hide the contents of the list.
Using the Dynamic Data List loim is exactly the same as using the Web
Content Display poitlet just set it up, point it to a list (eithei existing oi new)
and let it go. Tis is veiy easy to do.
To display a list inside the poitlet, add the Dynamic Data List loim poitlet
to a page fiom the Dockbai Add More Dynamic Data List Form. With the
poitlet on the page, click on the small geai icon in the lowei lef coinei. Tis
takes you to the conguiation page, wheie you can select a list to use foi the
foim entiies. Each time a usei visits youi page with the volunteei sign-up, they
aie piesented with a foim to ll out. lf they have alieady lled out an entiy, a
message is displayed instead.
Unlike the Web Content Display poitlet, howevei, the Dynamic Data List
loims poitlet may not be installed alieady in youi poital. lf not, just head ovei
to Lifeiay Maiketplace, giab it and install it.
9.3. CREATING DATA LISTS 29
Figure 9.4: Entering a newdata record.
You can publish youi lists anywheie in youi poital too. Read on to nd out
moie about that.
Using default displays
Lists aie published in the poital thiough the Dynamic Data List Display poitlet.
lf Listies dont customize the display, theii lists look something like this
Tis isnt all that exciting, but it allows useis to see the lists contents, and if
they have peimission, to add and/oi edit list items. Within a site like list.it,
this type of inteiaction is used foi display-only lists that the usei chooses to
expose to otheis, oi foi the useis own piivate lists. But you can impiove the
display. You can show the data in a spieadsheet, so you can view the iesponses
298 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
Figure 9.5: The default data list display.
to youi Volunteei Sign-Up in a comfoitable, easy-to-iead foimat. Te Dynamic
Data List Display poitlet piovides an easy way foi a usei (such as a membei of
a site) to inteiact with whatevei list is active and available.
While its possible to ask eveiyone to contiibute to the data list within the
contiol panel, its much beuei to give them a simple way to access the list.
Lifeiay piovides the Dynamic Data List Display poitlet to ease the integiation
of youi new list onto youi site. With youi list in hand, head ovei to the page
you want and add the poitlet. lt woiks much like the Web Content Display
poitlet use the geai icon to select a list foi display oi use the pen/papei icon
to add a new list. Te default display spills out the contents of the list, but can
be conguied to use a dieient display template, which is exploied latei in this
chaptei. Te two impoitant conguiation options to considei aie
Editable: allows useis that have peimission to add new entiies to the list.
By default, this is disabled and when enabled, administiatois aie the only ones
with add peimission. To easily giant access to othei useis, edit the peimissions
on the list youd like to giant access to, and giant the Add Record peimission.
Spreadsheet View: displays the list in a dynamic spieadsheet view. Tis
allows useis with peimission to inteiact with the list in the same way as in a
standaid spieadsheet piogiam.
Now, as useful as this default display is, and its ceitainly useful foi my to do
list and my memo notes, it can be an awkwaid way to ask my volunteeis to sign
up. ln fact, any time l want othei Listies to inteiact with my lists and contiibute
iesponses, l ieally just want a simple foim to show them. Tey dont need to
see the full iange of iesponses. And in some cases, it can be hazaidous to youi
9.3. CREATING DATA LISTS 299
Figure 9.6: The spreadsheet view
health foi eveiyone to see the iesponses. Ten you dont have to explain why
youi sistei-in-law wont woik with youi biothei on the same task because of
his B.O. pioblem. loi ieasons like that, youll need to customize the data entiy
foim oi the display of the list. Lifeiay lets you do exactly that using a custom
detail template oi list template.
300 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
9.4 Make it pretty: creating customdisplays
When cieating custom lists and data denitions, you can contiol not only how
the input foim appeais to youi useis but also how the list itself displays. Even-
tually you may iealize you need to cieate anothei sign-up sheet but you dont
need the asme level of detail piovided by the Volunteei Sign-Up data denition
you cieated. Lifeiay empoweis you to customize both the input and output
of youi lists to unlimited levels. Dynamic data lists piovide two aieas to cus-
tomize detail templates and list templates. Tis coveis the foims of lists (detail
templates), as well as the display of the list contents (list templates).
Detail templates
Te default data entiy foim is the entiie data model you cieated in a data de-
nition, including iequiied and optional elds. Listies who cieate new lists using
a data denition will see eveiy item in that denition on the input foim. What
if, howevei, you want a quick sign-up foim to nd out whos coming to dinnei
tonight` Using a detail template you can customize the foims display any way
you want. You can limit the elds displayed foi entiy oi change the oidei of
elements. To access and cieate new templates, go to Control Panel Content
Dynamic Data Lists Manage Data Denitions, choose the data model you
want to modify, click the Actions buuon and choose Manage Templates. When
you click on Add Detail Template, youie piesented with the same kind of giaph-
ical, diag-and-diop inteiface used foi cieating the data denition. Move items
aiound, delete unwanted elds fiom view and save when ieady.
Note that data denitions can have multiple templates. You can choose the
template you want to use foi display in eithei a dynamic data list display oi a
dynamic data list foimpoitlet (see below). You should cieate as many templates
as you might need, and you can piototype them in the poitlets to see how each
feels.
Now youi fiiends and enemies alike will be impiessed with youi list.it
skills. lt may look to the untiained eye like youve singlehandedly cieated thiee
oi foui dieient data types foi youi lists but you know beuei. You used the
powei that detail templates piovide, using one data model that encompasses the
maximum infoimation you might need (like piefeiied activity, favoiite coloi
and ideal schedule). Ten you quickly chuined out foui dieient detail tem-
plates with a few mouse clicks. Now that you have such a vast amount of data
collection options, how will you display them` Howevei you want, as youie
about to nd out.
9.4. MAKE IT PRETTY: CREATING CUSTOM DISPLAYS 301
List templates
loi eveiy data denition, you have an unlimited numbei of displays you can
cieate. lf you cieated a special Tanksgiving Dinnei Sign-Up list using youi
Volunteei Sign-Up denition, you wouldnt want to confuse fellow Listies by
displaying data elds you nevei asked foi. Piefeiied task` a fiiend might say,
l dont iemembei seeing that on the sign-up foim' To avoid such embaiassing
situations, you should cieate a custom display to match that list. Taking it even
fuithei, you could piovide a fancy, JavaSciipt-diiven image caiousel pieview of
all the auendees of the paity. Tis would complement youi othei displays and
be anothei biagging iight on list.it. List templates give you the powei to do
all this and moie.
Just like detail templates, list templates aie found in the Manage Templates
section of a data denition. With list templates you can customize the display of
a list in piecisely the same way as you can customize web content. List templates
can be wiiuen in lieemaikei oi Velocity, pulling data fiomthe data denition in
the same way that web content templates pull data fiom theii stiuctuies. Well
look at a simple example, but foi moie infoimation on using template sciipts to
pull data fiom a backing stiuctuie, see web content templates in chaptei 3.
Te ist thing we need to do is cieate a new list template foi oui Volunteei
Sign-Up data denition. Like othei featuies in Lifeiay, theie aie seveial ways
to do this, depending on youi context.
liom the Dynamic Data List Display poitlet
1. Navigate to wheie youi DDL Display poitlet is and make suie youi list is
selected.
2. lind the Create List Template icon on the bouom-lef of the poitlet window
and click it to cieate a new template. lf you dont see the icon, sign in as a
usei with iights to cieate templates.
liom the Dockbai
1. Go to Manage Site Content.
2. When loaded, navigate to Dynamic Data Lists Manage Data Denitions.
3. lind youi data denition in the list, then click Actions Manage Templates
4. Now you can click on Add List Template to cieate a new template.
liom the contiol panel
302 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
1. Navigate to Dynamic Data Lists Manage Data Denitions.
2. lind youi data denition in the list, then click Actions Manage Templates
3. Now you can click on Add List Template to cieate a new template.
lill out the foim with a title and a desciiption. Next, choose a templating
language. Just like web content templates, you can choose between lieemaikei
oi Velocity. Teie is no functional dieience between the two. Once you choose
the sciipt language, you can upload a template le oi choose Launch Editor to
type in a sciipt manually. lnside the editoi you can also choose to use plain text
editing oi a iich editoi that featuies line numbeis and syntax highlighting.
We want to use oui template to give us a summaiy of who is helping on the
tasks in oui move. To do that, we need to access the iecoids foi the list and pull
out the name and task foi each volunteei. Within the template, we have access
to a few helpei vaiiables to nd out what iecoids we have access to
reserved_ddm_structure_id
reserved_record_set_description
reserved_record_set_id
reserved_record_set_name
lnside a template, these vaiiables give us the lD foi the iecoid set (that con-
tains all of the volunteeis in oui list), as well as the name, desciiption and
data denition. We can easily ietiieve all the iecoids thiough a seivice call
to DDLRecordLocalService. To gain access to this seivice, we need to use a
helpei utility called serviceLocator that ietiieves an instance of the seivice
foi us. Once we have the seivice, we can ietiieve the list of iecoids (oui list of
volunteeis). Accessing the seivice with the serviceLocator is a single line of
code
#set ($ddlRecordsUtil =
$serviceLocator.findService(
"com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService"))
We stoie a handle to oui seivice in ddlRecordsUtil so we can then use the
seivice to ietiieve oui list of volunteeis
#set ($records = ${ddlRecordsUtil.getRecords($recordSetId)})
9.4. MAKE IT PRETTY: CREATING CUSTOM DISPLAYS 303
Now that we have oui iecoids, we can iteiate thiough the list and display
the data fiom each iecoid that we want to show. To access a eld fiom a iecoid
entiy (such as the volunteeis name), we call the getField method and pass
in the elds name. Each eld has a numbei of methods on it as well, but the
one you will use most ofen is getValue, which ietuins the content of the eld.
Each eld has the set of piopeities discussed above and can be accessed in the
same way (get + FieldName)
#set ($name = $record.getField("name").getValue())
Now all we have to do is set the iesults in some appealing way. ln this
example, weve made it veiy simple by using an unoideied list foi the iesults
(<ul>). Heie is the complete souice foi the template
<h1>Task Summary</h1>
Here are the tasks that people have signed up for on "$reserved_record_set_name.data".
#set ($ddlRecordsUtil = $serviceLocator.findService(
"com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService"))
#set ($recordSetId = $getterUtil.getLong($reserved_record_set_id.data))
#set ($records = ${ddlRecordsUtil.getRecords($recordSetId)})
<ul>
#foreach ($record in $records)
#set ($name = $record.getField("name").getValue())
#set ($tasks = $record.getField("task").getValue())
<li><em>${name}</em> will help with <strong>$tasks</strong> </li>
#end
</ul>
Once youve typed youi souice into the editoi window, click Update and
then save the list template. With the list template selected, youi list display can
now be a summaiy of tasks as shown below.
All the knowledge you have acciued thiough building out youi awaid-winning
content can be biought to beai in list templates. With the full powei of Veloc-
ity templates at youi ngeitips, you have easy access to all the data in the list,
as well as the full complement of helpei methods and the Alloy Ul Javasciipt
libiaiy to make easy woik of dynamic displays.
lf youie not a Listie, and you happen to be deploying custom lists in an
enviionment that iequiies appioval fiom othei useis, then its not enough to
just cieate the list and display a foim. What you need is a ieal integiation with
Woikow. Woikow integiates smoothly with Dynamic Data Lists.
304 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
Figure 9.7: Alist template in action
Using workow
Lifeiay integiates the poweiful featuies of woikow and the data capabilities
of dynamic data lists in Kaleo Forms. Woikow is not enabled in the dynamic
data list poitlets by default, so you can focus on the coie task of building custom
foims backed by a data list. Afei this is done, you can deploy customwoikows
to the foimand its data. Tough Kaleo loims is only available in Enteipiise Edi-
tion, you can still apply a woikow to a list when cieating it in the Community
Edition.
lf you dont have a woikow engine installed, install the Kaleo Web plu-
gin by going to Control Panel Server Plugins Installation Install More
Portlets Web Plugins and nding Kaleo Web in the list. You can also copy the
Kaleo .war le to the deploy foldei of you application seivei. Once woikow
is installed, you have a new option when cieating a list
Figure 9.8: Enabling workowon a list
Choose the woikow you would like to use, then eveiy iecoid has to go
thiough the woikow piocess. Now if you need to pieview oi edit entiies as
9.4. MAKE IT PRETTY: CREATING CUSTOM DISPLAYS 30
theyie coming in, its easy to woik in to youi daily woikow.
Creating a Kaleo Form
EE Only Feature
Kaleo loims is a plugin that enables you to have gieatei contiol ovei the list
cieation and entiy piocess. loi lists to appeal to companies all ovei the woild
(and make youi new site not just a iesounding success but auiact piotable
businesses), business useis must be able to contiol the woikow of list entiy
and ieview those entiies when made. Teie should also be a cool dashboaid
you can use to make all of youi changes.
lnside Kaleo loims, useis can cieate lists that followa woikow, called a pro-
cess, oi cieate new entries in a piocess. Cieating a new piocess is easy, stiaight-
foiwaid, and eective.
Starting a newProcess
Dening piocesses that must be followed in data collection and entiy is a fun-
damental pait of business. Histoiically, this hasnt been fun oi easy but Kaleo
foims makes it as easy as possible. A piocess is just anothei way to desciibe a
woikow you want on a list. When you place a Kaleo loims poitlet on a page,
you aie piesented with a dashboaid with two tabs Summary and Processes. Te
summaiy view shows entiies you have added to established piocesses, while
also allowing you to add new entiies. Te piocesses view allows you to manage
piocess denitions you have cieated.
To build a list in Kaleo loims with a woikow
1. Within the Kaleo loims poitlet click on the Processes tab.
2. Click on Add Process and a foim appeais.
3. Entei a name and desciiption, helping youi useis undeistand the puipose of
this piocess.
30 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
4. Select the appiopiiate list, woikow and foims you want to use in this pio-
cess.
. Click Save to save youi piocess.
Figure 9.9: NewKaleo Forms process
While the foimlooks complicated, it can be stiaightfoiwaid. Teie aie a few
pieces that make up a piocess and clicking on each one takes you to the ielevant
list of options to inseit.
Selecting an Entry Denition Te ist pait of a new Kaleo piocess is also
the simplest the entiy denition. Tis is just anothei way to iefei to a data
denition. All of the avaliable data denitions can be chosen, including oui
9.4. MAKE IT PRETTY: CREATING CUSTOM DISPLAYS 30
awesome Volunteei Sign-Up List. Just like with noimal data lists, you can
always cieate a new entiy denition fiom the list view by clicking on Add new
denition.
Selecting an Initial Form One of the gieat advantages to using Kaleo foims
to piesent youi list as a piocess is having total contiol ovei the detail template.
You can always use a default template, which displays all the elds fiom youi
entiy denition. Gieatei exibility comes, howevei, fiom cieating multiple de-
tail templates foi use in dieient stages of the piocess. When you cieate a detail
template you have the option of what mode to put it in
Create: Create mode gives a display foi cieating the initial entiy. Te ist
stage of any woikow iequiies you to cieate a new entiy, so this should be the
mode chosen foi the initial foim. All elds maiked required must be included
on cieate mode foims.
Edit: Edit mode is used foi any stage of the woikow piocess. loi instance,
you may want to sepaiate infoimation that shouldnt be saved fiominfoimation
that should. Othei stages in the woikow may be a gieat place to stoie that
additional infoimation. No iequiied elds have to be piesent on an edit mode
foim.
Figure 9.10: Selecting a detail template as the initial form
Once you have chosen the initial display you want, all thats lef to do is
conguie the woikow foi youi piocess.
Selecting a Workow You can now select a woikow to apply to youi new
list-dened piocess. All the avaliable woikows can be chosen and you can
cieate new ones fiom the selection scieen. Simply choose Add Workow and a
308 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
Woikow Designei scieen appeais allowing you to dene a new woikow by
diagging elements in a ow chait.
Figure 9.11: Creating a newworkowwith Kaleo Designer
Well keep ouis simple and just choose Single Appiovei Denition. Tis
gives us a staiting point (entiy cieation) and a ieview task, which we can use
to add additional infoimation in a secondaiy foim.
Assigning Workow Task Forms Many woikows oei you the option of
having multiple editoiial and ieview stages. Duiing these stages, you might
want to oei dieient foims that allow the usei to add moie infoimation to
the entiy. Kaleo foims oeis you the oppoitunity to ne-tune the stages of
woikow to use dieient foims.
When inside the view to assign foims to tasks
1. Choose the woikow task by clicking on it. Tis selects the task in the chait.
9.4. MAKE IT PRETTY: CREATING CUSTOM DISPLAYS 309
2. ln the details pane on the lef-hand side theie is a piopeity called Forms.
Double click to edit the value.
3. Stait typing the name of a detail template and it appeais.
4. Click Save to save the foim assignment.
Figure 9.12: Assigning forms to workowtasks
You can assign foims to as many tasks as you need until youie satised
with the woikow. Afei this stage, save the piocess and its ieady to be used
in Kaleo loims.
Using a Kaleo Form
EE Only Feature
Once you have a new Kaleo loim piocess, you can add new entiies thiough
the Summaiy tab in Kaleo loims. Once the foim is lled out and submiued, it
enteis the woikow you selected foi the piocess.
Afei you have cieated an entiy, the next task in the woikow may have an
additional foim to complete. lf so, theie is also an option to entei it
310 CHAPTER 9. USING WEB FORMS AND DYNAMIC DATA LISTS
Figure 9.13: Adding a newentry to a process
1. Next to the entiy in piogiess click the Actions buuon.
2. Click Complete form.
Figure 9.14: Completing a formin the next workowtask
Afei the new entiy has woiked its way thiough the entiie woikow, it is
added to the data set collected. Te ownei of that data set (who cieated the
Kaleo piocess) can view and edit the entiies collected.
9.5. SUMMARY 311
lf you aie a Listie, oi a list.it developei, youie now piepaied to show
youi lists to the woild. Tat is, in fact, the ieason you cieated list.it in the
ist place, iight`
9.5 Summary
Oui list.it expeiience is nowmuch moie enjoyable than when we ist signed
up. As new Listies, we had no idea how to dene oui own data types foi oui
lists, let alone how to cieate a list. You can now be the envy of youi co-woikeis
as you bieeze thiough list setup and data denitions. Once you have youi new
lists set up, you can woik thiough building new, custom input foims foi the
data. Youi fiiends on list.it will thank you and wondei how you weie able
to accomplish it all. Tats nothing next to the masteipiece of design that you
can show o in youi custom displays thiough list templates. Once the lists have
the piecise look and feel you envisioned, then living among the Listies will not
only be easy, but fun and exciting.
With the ability to cieate dynamic sets of data and customize both the data
display as well as the entiy, the possible combinations aie limitless. Dynamic
Data Lists can be viewed as a way to delivei small-scale applications that display
desiied infoimation quickly. Whethei youie building a site like list.it oi a
ieal estate listing seivice, youll nd the limitless powei of dynamic data lists
enticing, easy to use, and above all, empoweiing.
Cu~v1rv 10
UsiNc Wovxiiov
Lifeiay Poital includes a woikow engine called Kaleo. ln Gieek, this woid
means called ones, which is appiopiiate foi a woikow engine that calls useis
to paiticipate in a piocess designed foi them. Kaleo woikow allows a usei to
dene any numbei of simple to complex business piocesses/woikows, deploy
them, and manage them thiough a poital inteiface. Te piocesses have knowl-
edge of useis, gioups and ioles. You dont have to wiite a single line of code
to accomplish this all you have to do is cieate a single XML document. And
if youie a Lifeiay EE customei, you get a giaphical woikow designei which
gives you a point and click inteiface to cieate woikows.
To explain how to use Kaleo Woikow, this chaptei coveis
lnstallation
Cieating woikow denitions
Conguiing assets to use woikow
How useis inteiact with woikow
We intioduced Kaleo woikow in chaptei 2, wheie we discussed how to
set up an appioval piocess foi basic web content. Once weie done with this
chaptei, you should be familiai with how to use Lifeiays Kaleo woikow to set
312
10.1. ENABLING WORKFLOW 313
up appioval piocess foi any kind of content befoie it is published to youi poital.
10.1 Enabling workow
Lifeiays Kaleo woikow engine ships with CE veisions of Lifeiay. lf you have
EE oi if you uninstalled it, the plugin can be installed thiough the Lifeiay mai-
ketplace. Te name is kaleo-web and youll nd it in the list of web plugins.
lnstalling the plugin adds a numbei of new options to the contiol panel
My Woikow Tasks
Woikow Conguiation
My Submissions
Woikow
Teie is one woikow that comes bundled with the kaleo-web plugin Sin-
gle Appiovei Woikow. Tis woikow iequiies one appioval befoie an asset
can be published. One of the conveniences of using Lifeiays woikow engine
is that any ioles specied in the woikow denition aie cieated automatically
when the denition is deployed. Tis piovides a level of integiation with the
poital that thiid paity engines cannot match. Te Single Appiovei Woikow
contains thiee ioles each with dieient scopes. Te scope of each iole can be de-
duced by theii names Site Content Reviewei, Oiganization Content Reviewei
and Poital Content Reviewei.
Lets jump iight in and cieate a woikow piocess denition.
10.2 Creating newworkowdenitions
A Kaleo woikow, called a process denition, is dened in an XML le and is
executed by useis on the poital. You can cieate as many dieient woikow
denitions as needed to manage the woik done on youi poital. You can dene
new usei ioles in the woikow to manage the appioval piocess oi use ioles that
alieady exist in youi poital.
Te XML le has seveial paits which dene the woikow. To get an idea of
howthis woiks, well examine the default single-approver-definition.xml
le which is included in the the Lifeiay Kaleo plugin.
314 CHAPTER 10. USING WORKFLOW
Te key paits of the woikowdenition aie the asset thats iunning thiough
the woikow, the nodes of the woikow and the tiansitions between nodes.
Te asset is any kind of asset iegisteied in Lifeiay web content, wiki aiticles,
message boaid thieads and moie. Developeis can cieate theii own assets as
well to be used with woikow(see Liferay in Action oi Liferay Developers Guide
foi moie infoimation). Nodes iepiesent stages of the woikow and theie aie
seveial types. Tiansitions occui between nodes and indicate what the next node
should be.
Tink of woikow as a state machine made up of nodes. A node can be a
state, a task, a condition, a foik, a join oi a timei. Tiansitions aie used to move
fiom one node to anothei. Each type of node has dieient piopeities. loi ex-
ample, states execute actions automatically and iequiie no usei input. Tasks
block until usei input completes a tiansition to anothei state. Te tiansition
then moves the woikow to the next task oi state. Tis cycle continues until
the end Appioved state is ieached. loi example, you could cieate a woikow
which goes thiough two appioveis. lnitiating the woikow puts it in the ln
Review state and then tiansitions to a task which iequiies usei input. Useis
appiove oi ieject the asset as pait of the task. When the ist usei appioves
the woikow, a condition checks to see if theie aie two appiovals. Since theie
is only one, woikow tiansitions back to the task. When the second usei ap-
pioves the woikow, the condition nds theie aie two appioveis and it tiiggeis
a dieient tiansition to the Appioved state.
Lets look in detail at how youd cieate a woikow using a single appiovei.
Starting a workowdenition
Below is a diagiam of a single appiovei woikow denition. lt has only two
tasks and two states.
liist you dene the schema. loi Lifeiay woikows using Kaleo, liferay-
workflow-definition-6_1_0.xsd should be youi schema. You can nd this
schema in the definitions foldei of the Lifeiay souice oi a good XML editoi
can cache it fiom Lifeiays web site.
<workflow-definition
xmlns="urn:liferay.com:liferay-workflow_6.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:liferay.com:liferay-workflow_6.1.0
http://www.liferay.com/dtd/liferay-workflow-definition_6_1_0.xsd"
>
Next you dene a name and desciiption foi the woikow. Tis appeais in
the contiol panel when useis choose and conguie woikows.
10.2. CREATING NEW WORKFLOW DEFINITIONS 31
Figure 10.1: The default single approver workow. Arrows represent
transitions and boxes represent states and tasks.
<name>Single Approver</name>
<description>A single approver can approve a workflow
content.</description>
<version>1</version>
Afei that, you dene youi initial state.
Creating an initial state
ln this case, the state is simply that the asset has been cieated. States can con-
tain actions and tiansitions. Actions can contain sciipts. You can specify the
language of the sciipt with the <script-language> tag. Sciipts can be wiiuen
31 CHAPTER 10. USING WORKFLOW
in Gioovy, JavaSciipt, Ruby oi Python (see chaptei 18 foi moie infoimation on
leveiaging scipts in woikow). loi a state, the action is tiiggeied automatically
and then executes a tiansition. Tiansitions move you to a new state oi task.
<state>
<name>created</name>
<initial>true</initial>
liom the initial state, you tiansition to a new task, wheie fuithei piocessing
is blocked so the asset can be ieviewed.
<transitions>
<transition>
<name>review</name>
<target>review</target>
<default>true</default>
</transition>
</transitions>
</state>
Te next step is to cieate a task.
Creating tasks
Te task has seveial paits and is the most complex pait of the denition. Tasks
aie linked with ioles in oidei to choose who should complete the task. Roles
aie notied that theies new content in need of ieview. lf you dene a iole that
doesnt exist, it is cieated automatically.
Te ist task listed in the single-approver-definition.xml woikow
denition is the update task. Tough it appeais ist in the le, its actually not
the ist task in the woikow. Te update task is the task thats assigned by the
woikow if the asset is iejected by an appiovei. lts listed ist because its the
default task when this task is tiiggeied, the woikow piocess is ieset back to
the beginning. ln this task, the asset is assigned back to the content cieatoi,
who ieceives an email notication and is iequiied to iesubmit the asset. Once
the task is iesubmiued, it goes back to the ieview stage.
You can also see the task is assigned to <user/>. Tis tag always assigns
the task back to the usei who cieated the asset.
<task>
<name>update</name>
<actions>
<notification>
<name>Creator Modification Notification</name>
<execution-type>onAssignment</execution-type>
<template>Your submission was rejected by a reviewer, please modify and resubmit.</template>
10.2. CREATING NEW WORKFLOW DEFINITIONS 31
<template-language>text</template-language>
<notification-type>email</notification-type>
</notification>
</actions>
<assignments>
<user />
</assignments>
<transitions>
<transition>
<name>resubmit</name>
<target>review</target>
<default>true</default>
</transition>
</transitions>
</task>
Te review task is the ist task in the woikow. Tis is wheie poital useis
with the piopei iole ieview the content and decide to ieject it (move it back to
the beginning) oi accept it (tiansition it to the next step).
Once the tiansition has been made to this task, a notication is sent to those
who aie assigned to the task. You can edit the name oi content of the notication
in the XML le.
<task>
<name>review</name>
<actions>
<notification>
<name>Review Notification</name>
<execution-type>onAssignment</execution-type>
<template>You have a new submission waiting for your review in the workflow.</template>
<template-language>text</template-language>
<notification-type>email</notification-type>
</notification>
</actions>
You must also assign the task to a specic iole oi ioles. Tis iole doesnt
have to be the iole you notied. loi example, you might want to notify all the
content cieatois any time a newitemis submiued. Regaidless of who youie no-
tifying, you denitely want to send a notication to anyone who is iesponsible
foi appioving content.
Sending notications
Notications need an execution-type which can be onAssignment, onEntry
oi onExit.
onAssignment geneiates and sends the notication when the usei is as-
signed the task in the woikow. Note: onAssignment notication will
not woik if you wish to notify a usei that is not pait of the woikow.
318 CHAPTER 10. USING WORKFLOW
onEntry geneiates and sends the notication when enteiing the woik-
ow task oi state.
onExit geneiates and sends the notication when exiting the woikow
task oi state.
Notications also need a notification-type which can be email, im oi
private-message. Note the private-message type is a placeholdei foi now,
that functionality is in Lifeiays Social Oce pioduct but has not yet been in-
tegiated into Lifeiay Poital. Youi notication type and execution type should
complement each othei. You wouldnt want to use an onExit execution type
with a piivate message, because the usei wont ieceive that message until he oi
she logs back in. Geneially speaking, email notications woik best with onExit
oi onAssignment, while lM oi piivate message woik beuei with onEntry.
Email and piivate message notications can also be cieated as plain text oi
you can cieate foimaued content using lieemaikei oi Velocity templating lan-
guages. When cieating the notication, you need to specify the template-lan-
guage as text, freemarker oi velocity.
ln this woikow, anyone who is capable of appioving the content is notied
onAssignment. Tis includes administiatois and site and oiganization owneis.
Te role-type tag helps the system soit out who should ieceive the notica-
tion based on the scope and can be set as community, organization oi portal.
<assignments>
<roles>
<role>
<role-type>community</role-type>
<name>Community Administrator</name>
</role>
<role>
<role-type>community</role-type>
<name>Community Content Reviewer</name>
</role>
<role>
<role-type>community</role-type>
<name>Community Owner</name>
</role>
<role>
<role-type>organization</role-type>
<name>Organization Administrator</name>
</role>
<role>
<role-type>organization</role-type>
<name>Organization Content Reviewer</name>
</role>
<role>
<role-type>organization</role-type>
10.2. CREATING NEW WORKFLOW DEFINITIONS 319
<name>Organization Owner</name>
</role>
<role>
<role-type>regular</role-type>
<name>Portal Content Reviewer</name>
</role>
<role>
<role-type>regular</role-type>
<name>Administrator</name>
</role>
</roles>
</assignments>
Once the content is appioved youll want to tiansition to a new state.
Using transitions
ln this case, you only need a single appiovei, then the tiansition goes to the nal
appioved state. ln moie complex woikows, you might tiansition to a second
tiei appiovei.
<transitions>
<transition>
<name>approve</name>
<target>approved</target>
<default>true</default>
</transition>
<transition>
<name>reject</name>
<target>update</target>
<default>false</default>
</transition>
</transitions>
</task>
linally, we dene oui end state. Remembei states automatically iun all ac-
tions that aie assigned to them, so a sciipt executes and sets the state of the
content to approved. Woikow sciipts aie completely contained within XML
woikow denitions.
You could also wiite a customized sciipt if theie weie actions outside the
standaid one that you need to peifoim on youi asset. Te sciipt below, wiiuen
in JavaSciipt, sets the status of the asset to approved. Of couise, theies much
moie you can do with sciipts. You dont even have to use JavaSciipt if you
want, you can change the <script-language> to anothei suppoited language
(Ruby, Gioovy oi Python) and iewiite the action with additional details to meet
youi needs.
320 CHAPTER 10. USING WORKFLOW
<state>
<name>approved</name>
<actions>
<action>
<name>approve</name>
<execution-type>onEntry</execution-type>
<script>
<![CDATA[Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil. \
updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants. \
toStatus("approved"), workflowContext);]]>
</script>
<script-language>javascript</script-language>
</action>
</actions>
</state>
To cieate longei woikows, youd cieate additional states, tasks and tian-
sitions accoiding to youi iequiiements. loi instance, if you wanted to have a
second level of ieview befoie an item is appioved, youd cieate a new task in
between the review task and the approved state. Te task itself might have sim-
ilai content to review but you would assign it to a dieient iole. Te review
task would tiansition to youi new task and the new task would tiansition to the
approved state.
You can also use forks and joins to cieate moie complex woikows.
Using forks and joins
loiks and joins aie used foi paiallel piocessing. loi example, say you have a
new oei youd like to put up on youi site but it needs to go thiough both the
sales managei and the maiketing managei ist. You can set up a woikow that
noties both manageis at the same time so they can appiove them individually.
Tis way, youie not waiting foi one manageis appioval befoie you can send the
notication to the othei managei. Te belowillustiation shows howa woikow
with a foik and a join might be designed.
10.2. CREATING NEW WORKFLOW DEFINITIONS 321
You can tiansition to a foik fiom a task oi state. liom the foik, you can
tiansition to multiple tasks oi states which occui in paiallel. ln the pievious
322 CHAPTER 10. USING WORKFLOW
example, when we have multiple tiansitions fiom one task, theyie mutually
exclusive you eithei tiiggei one oi the othei. Te tiansitions aie also seiial,
meaning one must occui befoie the next one can occui. With a paiallel woik-
ow, you can have dieient appiovals going thiough dieient useis at the same
time. loi example, you could use this to sepaiate two dieient depaitments ap-
pioval chains on a single asset. A foik should be foimaued like this
<fork>
<name>review_fork</name>
<transitions>
<transition>
<name>node_1</name>
<target>review_one</target>
</transition>
<transition>
<name>node_2</name>
<target>review_two</target>
</transition>
</transitions>
</fork>
To biing a foik back togethei, tiansition both nodes of the foik back to a
single join. A join is foimaued similaily to a foik, except that any tiansitions
aie seiial, not paiallel, as in the example below.
<join>
<name>approved</name>
<transitions>
<transition>
<name>result</name>
<target>done</target>
<default>true</default>
</transition>
</transitions>
</join>
Anothei impoitant consideiation when cieating paiallel appiovals is each
node needs its own iejected state foi cases wheie content is appioved in one
node but iejected in anothei. Anothei featuie you can use in custom woikows
along with foiks and joins is Timeis. While using paiallel woikow enables
you to speed up youi piocess by geuing content in fiont moie people at once,
instead of making them wait in line, timeis allow you to add some uigency to
the piocess.
10.3. TIMERS 323
10.3 Timers
Timers aie a new woikow featuie in .1 that help make suie impoitant tasks
in a woikow aient foigouen oi lef undone because of an oveisight oi the
absence of someone on the ciitical path. Te basic concept of the timei is that
afei a peiiod of time specied, a specic action occuis. Teie aie two main
elements foi a Timei, the Task Timer and the Timer Action.
Timeis occui within a Task element and aie foimaued like
<task>
...
<task-timers>
<task-timer>
<name></name>
<delay>
<duration></duration>
<scale></scale>
</delay>
<timer-actions>
...
</timer-actions>
</task-timer>
</task-timers>
...
</task>
Te outei element is because you can have multiple timeis with multiple ac-
tions. Te specic then contains the element which has a and . Te duiation
can be any numbei, whole oi fiactional, and its signicance is dened by the
scale. Te scale tells you what unit of time the duiation is talking about - sec-
onds, minutes, houis, days, weeks, months oi yeais. Once youve deteimined
the time, youll want to pick an action - eithei a notication, ieassignment oi a
custom sciipt.
Notications aie pieuy simpleif a ceitain amount of time passes and an
action isnt completed yet, the usei assigned to the task will ieceive a fiesh
notication. With the timei, you have all of the standaid notication types
available and you can choose a dieient notication type than was used foi the
oiiginal notifcation. loi example, you could cieate a denition such that when
a new item is submiued to the woikow, all membeis of the Content Reviewer
iole ieceive a notication. You could then use a timei to say if the content hasnt
been ieviewed within two houis each membei of the Content Reviewer iole will
ieceive a second notication via instant messengei.
A Notication would be foimaued like this
<timer-actions>
324 CHAPTER 10. USING WORKFLOW
<timer-notification>
<name></name>
<template></template>
<template-language>text</template-language>
<notification-type>im</notification-type>
</timer-notification>
</timer-actions>
Reassignments aie designed to keep the woikow moving, even if a key pei-
son is out of the oce. With a timei set to ieassign, afei the specied amount
of time has passed, the task can be assigned to a new iole. Building o of oui
example above, if the Content Revieweis all ieceived the lM notication afei
two houis, but the content still wasnt appioved afei foui houis, the woikow
could be set to automatically ieassign to the task to the Adminstrator iole.
A Reassignment would be foimaued like this
<timer-actions>
<reassignments>
<assignments>
<roles>
<role>
<role-type></role-type>
<name></name>
</role>
...
</roles>
</assignments>
</reassignments>
</timer-actions>
Obviously we cant think of eveything, so if you have an idea foi using timeis
in youi woikow that doesnt t into oui design, you could access Lifeiays
sciipting engine to cieate a custom action to happen afei a specied amount of
time. loi example, if you had means of sending electiic shocks thiough employ-
ees chaiis if they weient doing theii woik, and had cieated a Lifeiay poitlet to
access the shock mechanism, you could use a custom sciipt to zap any useis
who weie at theii desk that hadnt ieviewed content assigned to them.
<timer-actions>
<action>
<name></name>
<script>
<![CDATA[
]]>
</script>
<script-language></script-language>
<execution-type></execution-type>
</action>
</timer-actions>
10.4. CONFIGURING ASSETS TO USE WORKFLOW PROCESS DEFINITIONS 32
loi moie infoimation on using sciipting in Lifeiay, please iefei to chaptei
18.
Using woikows and appiovals is necessaiy foi viitually any oiganization
and timeis aie an excellent way to help mitigate the potential headaches caused
by having multiple boulenecks thiough the piocess. Using timeis in conjunc-
tion with othei woikow featuies can help you cieate poweiful woikows foi
youi oiganization.
Putting it all together
Te Kaleo woikow engine is deeply integiated with Lifeiay Poital. lt can gen-
eiate ioles scoped foi oiganizations, sites and foi the whole poital based on
woikow denitions. You can also customize woikow options foi individual
sites.
Useis aie the most impoitant pait of the woikow, since theyie the ones
who do all the woik. To make a usei a pait of the woikow piocess, you assign
them a iole which you dened in youi woikow . When youie cieating youi
woikow denition, you can cieate new ioles by dening them in the XML le
oi by using ioles which you have alieady cieated in youi poital. Roles cieated
automatically aie always poital scoped, so if you want to use site oi oiganization
scoped ioles, cieate the ioles befoie deploying youi woikow to the poital.
A poital administiatoi can cieate a default woikow denition scheme foi
each application which applies foi the entiie poital and site and oiganization
administiatois can customize the seuings foi theii sites and oiganizations. Now
that weve seen how to cieate woikow denitions, lets discuss how to use
them.
10.4 Conguringassetstouseworkowprocessdenitions
Most of youi woikow conguiation is done via the contiol panel. Eveiything
you need to do in the poital can be done thiough simple GUl contiols.
You can nd the Woikow section undei the Poital heading in the contiol
panel. Teie aie thiee options undei Woikow Denitions, Default Congura-
tion and Submissions.
lf you cieated a new woikow denition, you need to add it so it can be used
in the poital. Click Denitions. By default, only the Single Appiovei woikow
appeais heie. Clicking Add allows you to entei a title foi a new woikow de-
32 CHAPTER 10. USING WORKFLOW
nition and upload the XML le. Once you add a le heie, its added to the poital
and is immediately available foi use.
Figure 10.3: Adding a
WorkowDenition
Undei Default Conguration, you can
set the woikow behavioi (if any) foi all
woikow-enabled applications on the poi-
tal. You can choose to use no woik-
ow, which is the default, oi select any in-
stalled woikow denition. Seuing the de-
fault conguiation causes any newly cie-
ated sites to default to that conguiation.
An administiatoi can then edit the deni-
tions foi each one individually thiough the
Workow Conguration page.
Clicking on Submissions will let you
view any cuiiently pending assets oi any
assets which weie pieviously appioved.
Conguring workow
Afei you have uploaded woikow deni-
tions and set the default woikow behavioi you can go up to Workow Cong-
uration and tweak the denitions youie using foi each site individually.
Figure 10.4: The WorkowConguration Page
Using the context selectoi diop-down menu in the contiol canel, you can se-
lect any site in the poital. All the options undei that heading, including Woik-
10.4. CONFIGURING ASSETS TO USE WORKFLOW PROCESS DEFINITIONS 32
ow Conguiation, now apply to that paiticulai site. Using woikow is just as
easy.
My WorkowTasks
My Woikow Tasks is a peisonalized veision of the Woikow Tasks and its
found in youi peisonal section of the contiol panel. Heie aie specic tasks
which have been assigned to you oi assigned to a iole of which you aie a mem-
bei. You can also view youi completed tasks.
Figure 10.5: My WorkowTasks Page
lts heie woikow useis ieview and appiove content. By clicking on the
actions next to a piece of content, a usei can view the content, then choose to
appiove oi ieject it and add comments.
My Submissions
My Submissions is found undei youi useis peisonal infoimation in the contiol
panel. liom this scieen you can view any assets you have submiued to ieview.
Tose cuiiently undei ieview aie listed undei the Pending tab and those that
have been ieviewed aie listed undei the Completed tab.
Besides viewing youi woik, you can also withdiaw a submission fiom the
ieview piocess by clicking on Withdraw Submission fiom the Pending tab.
Using Kaleo WorkowProcesses in Liferay Portal
Befoie woikow can be used, you must dene which types of assets on the
poital aie woikow-enabled. lf you have cieated additional denitions, you
328 CHAPTER 10. USING WORKFLOW
Figure 10.6: The My Submissions Page
must also choose the woikow denition to use foi each asset that is woikow-
enabled.
Figure 10.7: You can select which site to work on by using the drop-down
menu in the Content section of the control panel.
To demonstiate how this woiks, well cieate a piess ielease. Piess ieleases
should be posted in the Newsroom section of the web site, so befoie seuing spe-
cic woikow conguiation options oi cieating content, cieate the Newsioom
site and switch to it in the contiol panel. ln Woikow Conguiation, set Web
Content to use the Single Appiovei woikow.
Next, cieate two useis, a Content Cieatoi and a Content Reviewei. Te Con-
tent Cieatoi logs in and cieates a new piess ielease foi Nose-stei and clicks
Submit for Publication. Tis tiiggeis the woikow piocess and noties the Con-
tent Reviewei. When the Content Reviewei logs in, he oi she can assign the
woikow task to him- oi heiself and appiove the content.
10.5. USING WORKFLOW WITH OTHER APPLICATIONS 329
Figure 10.8: Before a Content Reviewer can approve content, he must
assign it to himself or have an administrator assign it to him.
Once the content is appioved, it can be posted on the Piess Releases page in
a web content display poitlet.
Teies moie. EE customeis get extia featuies that enable them to cieate
woikows without having to deal with XML.
10.5 Using workowwith other applications
We sawan example of howto use woikowwith Lifeiay web content in chaptei
2. ln this section, well discuss how to use woikow with othei applications.
liist, well look at using woikow with Documents and Media. Afei that, well
look at using woikow with Blogs, Wikis, and Message Boaids.
Documents and media
You can enable woikow foi most poital iesouices, including page ievisions foi
staging, web content, and collaboiative applications, fiom the Contiol Panel.
Howevei, woikow foi Documents and Media can only be enabled within a
Documents and Media poitlet since it must be dened at the foldei level. To
see how this woiks, cieate a new page in the default site called Documents and
Media and add the Documents and Media poitlet to this page. Ten click Add
Folder, entei the name My Documents, and click Save. Mouse ovei youi new
330 CHAPTER 10. USING WORKFLOW
My Documents foldei, click on the giay icon that appeais at the top iight coinei
of the foldei, and select Edit.
Figure 10.9: Workowfor Documents and Media must be enabled at the
folder level. Edit a folder to select a workow.
By default, the Use document type restrictions and workowof the parent folder
buuon is selected. To enable woikow foi this foldei, select the Dene specic
document type restrictions and workow for this folder buuon. Afei youve se-
lected this buuon, a Default Workow for all Document Types diopdown menu
appeais. By default, you can select No workow oi Single Approver. Any cus-
tom woikows that you added also appeai in this diopdown menu. You can
add custom woikows thiough the Woikow page in the Poital section of the
Contiol Panel.
Afei youve selected the Single Approver woikow and clicked Save, woik-
ow takes eect foi the My Documents foldei. Tiy adding a new document to
youi My Documents foldeinotice that the Publish buuon now says Submit for
Publication since woikow is enabled. Any useis assigned to the (Poital, Oiga-
nization, oi Site) Content Reviewei ioles can see that youi document has been
submiued foi publication by navigating to the Contiol Panel and clicking on
My Workow Tasks. Oidinaiily, the same usei who submiued a document foi
10.5. USING WORKFLOW WITH OTHER APPLICATIONS 331
Figure 10.10: You can use the document type restrictions and workowof
the parent folder or you can dene specic document type restrictions
and workowfor this folder.
publication wouldnt also appiove it but well do this to demonstiate how the
piocess woiks.
Navigate to the Contiol Panel and click on My Workow Tasks. Te doc-
ument that you submiued foi publication appeais undei Assigned to My Roles
since youie an administiatoi. Click Actions Assign to Me next to youi doc-
ument. Ten click Actions Approve next to the document when it appeais in
the Assigned to Me categoiy. Tats ityoui document has passed thiough the
woikow'
332 CHAPTER 10. USING WORKFLOW
Collaboration
To enable woikow foi collaboiative applications, ist navigate to the Contiol
Panel and select a scope in the context menu selectoi. You can enable woikow
globally, oi foi a specic site. Once youve chosen a scope, click on Workow
Conguration in the content section of the Contiol Panel. Tis page lists the
poital iesouices foi which you can select a woikow.
Figure 10.11: The WorkowConguration page of the Control Panel lists
the resources for which can select a workowfor your chosen scope.
To select a woikow, click on the Woikow diopdown menu and choose
a woikow. By default, you can only select No workow oi Single Approver.
Custom woikows that you added also appeai in this diopdown menu. You can
add custom woikows thiough the Woikow page in the Poital section of the
10.6. SUMMARY 333
Contiol Panel. To enable woikow foi the collaboiative applications, select the
Single Approver foi the Blogs Entiy, Message Boaids Message and Wiki Page
iesouices, then click Save.
To test the woikow foi collaboiative applications, add a page called Collab-
oration to the site whose scope you selected when you enabled woikow. Ten
add the Blogs, Message Boaids, and Wiki poitlets to this page. Using each poit-
let, add a blog entiy, post a new message boaid thiead, and wiite some content
foi the Wiki fiontpage. loi each application, notice that the Publish buuon is
ieplaced by a Submit for Publication buuon since woikow is enabled.
Te woikow piocess foi collaboiative applications woiks the same way as
in the examples youve alieady seen. Any useis assigned to the (Poital, Oiga-
nization, oi Site) Content Reviewei ioles can see that youi blog post, message
boaid thiead, and wiki aiticle have been submiued foi publication by navigating
to the Contiol Panel and clicking on My Workow Tasks. Of couise, since you
submiued these items foi publication, it wouldnt make sense in a ieal-woild
use case foi you to appiove them. Howevei, to see how the woikow piocess
woiks, go ahead and appiove these items youiself, you can do this since youie
an administiatoi.
Navigate to the Contiol Panel and click on My Workow Tasks. Te items
youve submiued foi publication appeai undei Assigned to My Roles. Click Ac-
tions Assign to Me next to the items youve submiued. Ten click Actions
Approve next to each item when it appeais in the Assigned to Me categoiy.
Tats ityoui blog post, message boaid thiead, and wiki aiticle have passed
thiough the woikow'
10.6 Summary
ln this chaptei, we explained how to install the Kaleo woikow plugin foi Lif-
eiay EE. Lifeiays Kaleo woikow engine is included with Lifeiay CE. We dis-
cussed how to cieate new woikow denitions and examined the XML schema
foi them. We looked at how to choose dieient woikow piocesses foi diei-
ent asset types. We also explained howend-useis can inteiact with the appioval
piocess. linally, we discussed how to use woikow with dieient types of ap-
plications such as Documents and Media and Blogs, Wikis, and Message Boaids.
ln the next chaptei, well look at Kaleo foims and the Kaleo woikow designei.
Cu~v1rv 11
K~iro lovxs DriiNiNc BUsiNrss
Pvocrssrs
EE Only Feature
ln the last chaptei, we looked at the elements that compiise a woikow def-
inition and discussed how to cieate a woikow denition. ln this chaptei, we
intioduce the Kaleo Woikow Designei foi Lifeiay EE which allows you to cie-
ate woikow denitions using an intuitive Ul. Using the woikow designei
saves you the time and tiouble of having to deal diiectly with the XML.
Developeis who aie used to woiking with XML aie geneially able to cieate
woikow denitions. Othei useis may not be so comfoitable with it. ln fact,
even skilled developeis can make mistakes that bieak a denition and iequiie
time to tioubleshoot. To help stieamline the cieation of woikow denitions
and empowei moie useis to cieate custom woikows, Lifeiay piovides the Ka-
334
11.1. KALEO FORMS 33
leo Woikow Designei in Lifeiay .1 EE.
Teie aie two pieces to the woikow designei Kaleo Forms and Kaleo De-
signer. Kaleo loims is an extension of the Dynamic Data Lists featuie (coveied
in chaptei 9). Tis enables you to cieate web foims and basic applications, then
apply a woikow to govein the piocessing of those foims. Kaleo Designei is a
diag and diop inteiface foi cieating new woikow denitions. lt can be used
in conjunction with Kaleo loims oi standalone to cieate woikow denitions
without having to wiite XML.
Lets look at Kaleo loims ist.
11.1 Kaleo Forms
Add the Kaleo loims poitlet to a page. ln the poitlets initial state, the Sum-
mary tab displays similai infoimation to what you might see in the My Workow
Tasks poition of the Contiol Panel. Because the Kaleo loims poitlet is scoped
to Kaleo Piocesses, tasks ielated to othei assets cannot be managed fiom Ka-
leo loims. Any foims available foi piocessing thiough the woikow can be
initiated thiough the Submit New buuon, as the below image indicates.
Figure 11.1: Kaleo Forms give you a convenient way to manage all
available workows in the portal.
Click on Processes to view any existing woikow piocesses oi to cieate new
ones. All available piocesses aie listed heie. lf youie coming heie foi the ist
time, howevei, theie wont be any, so lets cieate one. Click Add. Youll see the
scieen below.
Set a name and a desciiption. Next, youll dene an Entry Denition and an
Initial Form, choose oi cieate a workow and Workow Task Forms.
33 CHAPTER 11. KALEO FORMS: DEFINING BUSINESS PROCESSES
Figure 11.2: The WorkowProcess Creation Page
Entry Denition: Tis is a Dynamic Data List Denition, you can use an
existing denition heie oi cieate a custom one thiough the Ul.
Initial Form: You can customize the display of the Entiy Denition with the
lnitial loim. Tis can include things like adding Pagination oi alteiing some
othei display featuie.
Workow: You can choose any existing woikow denition heie oi dene
a new one.
Workow Task Forms: Tis is wheie you can dene how the woikow
denition inteiacts with foim denitions. You can tiiggei a woikow action
to occui along with a foim action, such as a notication, oi have a multi-step
piocess wheie pait of the foim is completed but needs to be appioved befoie
the usei can complete anothei pait of the foim.
You piobably noticed when choosing a woikow, you also have the option
to cieate a new one. Tis is wheie the Kaleo Woikow Designei can help you
build a woikow without having to wiite any XML. Lets see how this woiks.
11.2. KALEO DESIGNER 33
11.2 Kaleo Designer
Kaleo Designei piovides a diag and diop inteiface foi useis to cieate custom
woikows. lts an inciedibly poweiful tool foi managing woikow denitions.
Te Woikow Designei can only be accessed thiough the Kaleo loims poitlet
but denitions cieated can be used foi othei piocesses as well.
Figure 11.3: Dene business processes using Kaleo WorkowDesigner.
Teie aie seven types of nodes you can add to a denition. Te node types
aie Condition, End, Fork, Join, Start, State and Task. lf youve iead the en-
tiie chaptei, youll notice Stait and End aient node types weve pieviously
discussed, thats because theyie actually just State nodes, with ceitain elds
pielled to help stieamline the cieation piocess. Since eveiy woikow has a
338 CHAPTER 11. KALEO FORMS: DEFINING BUSINESS PROCESSES
stait and end state, youd have to do this anyway.
Figure 11.4: The
Node Conguration
Menu shows options
to edit or delete your
node.
Each node you add has a pop-up menu leuing you
edit oi delete the node. As you hovei youi mouse
ovei the edges of a node, notice youi mouse pointei
changes to a cioss. Te cioss indicates you can con-
nect the cuiient node to anothei node. Hold down
youi mouse buuon and diag the mouse to stait diaw-
ing youi tiansition to anothei node. lf you stop be-
foie ieaching the edge of the next node, a pop-up dis-
plays node types you can cieate and connect to on-
the-y. To connect with an existing node, continue diagging the connectoi to
that node.
Figure 11.5: Create transitions to existing or newnodes. The connector
pop-up lets you create and connect to newnodes on-the-y.
To get a feel foi how the designei woiks, lets use the woikow designei to
11.2. KALEO DESIGNER 339
duplicate the default woikow denition. When we choose the option to Add
Denition fiom the Kaleo loims poitlet, it cieates a blank woikow denition
with stait and end nodes. To make this woik, well add two tasks, ll in the
ielevant infoimation, assign the tasks piopeily and cieate the tiansitions.
liist add two tasks, then use the edit icon to name them Review and Update.
Figure 11.6: Edit a node by clicking on its edit icon and modifying its
settings.
Next, connect the nodes so Review has foui nodes, as follows one ieceiving
the tiansition fiomStartNode, one sending a tiansition to Update, one ieceiving
340 CHAPTER 11. KALEO FORMS: DEFINING BUSINESS PROCESSES
a tiansition fiom Update, and one sending a tiansition to EndNode.
Figure 11.7: Your workowshould look like this.
Next, we want to add the coiiect assignments and notications. Click on
Review. Te box on the lef shows all the piopeities of the Review node. ln
the assignments categoiy, assign the task to the Portal Content Reviewer iole.
Click on Notications and cieate a notication with the type On Assignment.
Now move to the Update node and assign it to the Content Creator with its own
notication.
Next, lets go thiough all the tiansitions and make suie theyie named coi-
iectly. What aie the tiansitions` Woikow tiansitions connect one node to
anothei. On exiting the ist node, piocessing continues to the node pointed to
by the tiansition. Eveiy time you cieated an aiiow fiom one node to anothei it
cieated a tiansition. By default, these tiansitions get system geneiated names
11.2. KALEO DESIGNER 341
so well iename them all to something moie human ieadable. liist, click on the
aiiow going fiom the Stait node to the Review node and set the name as Submit
and set Default to tiuewell leave all the otheis as false. Set the name of the
tiansition fiom Review to Update to Reject and the one fiom Update to Review
to Resubmit. Lastly, set the name of the tiansition fiom Review to the EndNode
to Approve.
Figure 11.8: Your completed workowshould look like this.
Now lets take a look at the geneiated XML. lt should look a lot like oui
default woikow, only a tiny bit messiei, as the nodes display in the oidei they
weie cieated, not in the logical oidei that happens when a human wiites the
code. Save youi denition and its ieady to use.
342 CHAPTER 11. KALEO FORMS: DEFINING BUSINESS PROCESSES
11.3 Summary
As you can see, Lifeiay Poital and the Kaleo Woikow engine combine to cie-
ate a veiy iobust enviionment foi web content management. Te Kaleo loims
poitlet allows you to manage all available woikows in the poital. You can
cieate youi poitals woikows by using the Kaleo Designeis unique diag and
diop inteiface. Simple woikows can be managed using the default congu-
iation and GUl tools, while moie complex woikows can be cieated to meet
the woikow management needs of almost any poital. Tiough this chaptei
and the pievious one, weve taken a look at the vaiious elements of a woikow
and shown how to use those elements to cieate youi own custom woikows.
Weve also seen how to piopeily use the vaiious elements of a woikow like
Assignments and Notications, as well as newei and moie advanced featuies
like Paiallel Woikows, Timeis, and Custom Sciipts.
lts not enough to undeistand each individual step of the woikow piocess,
one of the keys to using Kaleo woikowis to undeistand howeach step inteiacts
with the othei elements. lf you undeistand these ielationships, you can guie
out which featuies will to woik best foi youi oiganization. We hope youll use
the infoimation weve coveied on woikow to ciaf suitable piocesses foi you
poital.
Cu~v1rv 12
Liirv~v U1iii1v Avviic~1ioNs
ln this chaptei well look at some Lifeiay utility applications that might be use-
ful foi you. Te Sofwaie Catalog is cuiiently packaged with Lifeiay but will
soon be ieplaced by Lifeiay Maiketplace. Please see chaptei 13 foi infoimation
about Lifeiay Maiketplace and managing Lifeiay plugins. Te Knowledge Base
application is an EE-only plugin. ln this chaptei well discuss seveial of these
applications
Bookmaiks
Sofwaie catalog
Shopping
Knowledge Base
Lifeiays Bookmaiks application is a simple way foi useis to keep tiack of
URLs in the poital that can also be used by an administiatoi to publish ielevant
links to gioups of useis. Te Sofwaie Catalog allows you to dene a set of sof-
waie items to display to visitois. Te Knowledge Base application allows you
to cieate aiticles and oiganize them into full books oi guides that be published
on youi poital.
343
344 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
12.1 Capturing Web Sites with the Bookmarks Portlet
Many of us enjoy collecting things we value. Tey may be stamps, comic books,
sea shells, oi fabulous shoes. Te list goes on and on. But have you consideied
URLs collectible` Having a thoiough collection of links can be a gieat way to
add value to youi poitals usability.
Figure 12.1: Individual bookmarks, not associated with a folder, are listed
separately.
With Lifeiays Bookmaiks application, useis collect and manage URLs in
the poital. Tey can add, edit, delete, expoit and impoit bookmaiks. Useis can
use links to access iegulaily visited web sites. Administiatois can publish links
tailoied to specic gioups of useis. Both inteinal pages as well as exteinal sites
can be bookmaiked.
Organizing Bookmarks by Folder
You can stoie all youi impoitant links in one place and you can manage this data
easily using foldeis. You can cieate, edit, and delete bookmaik foldeis. You get
12.1. CAPTURING WEB SITES WITH THE BOOKMARKS PORTLET 34
to decide how many bookmaiks oi foldeis aie displayed on a page. Bookmaik
foldeis can have any numbei of subfoldeis.
Heies an example of what one bookmaiks poitlet might look like. Book-
maik loldeis aie displayed above individual bookmaiks.
ln this example, theie aie eight bookmaik foldeis, foui of which have sub-
foldeis. Te columns showing the numbei of foldeis and the numbei of entiies
showthe subfoldeis and the entiies contained within each top level foldei. Note
that total numbei of bookmaiks includes those in the subfoldeis.
Using the Actions buuon on the iight, you can edit the foldei, manage foldei
peimissions, delete the foldei, add a subfoldei, oi add a bookmaik to the foldei.
As youi collection of links giows, you may need to add moie subfoldeis to
keep things in oidei. Should you decide a link needs to move fiom one foldei
to anothei, you can manage this using the Edit option foi that link.
Moving a Link
Just foi fun, lets move a link fiom the main bookmaiks foldei into a subfoldei
one level down. Well move the Lifeiay link into the Nonction subfoldei in
the Liteiatuie foldei. Te Nonction subfoldei is a child of the Liteiatuie foldei.
We need to move the link to the Liteiatuie foldei ist befoie moving it into the
Nonction subfoldei.
Figure 12.2: You can move a link one
level at a time by selecting the Select
button.
To achieve this, we select Edit
fiom the Actions buuon foi the
link. ln the Edit view, nd the
section called Folder. When appli-
cable, this section contains biead-
ciumb links to allow you to navi-
gate fieely among the othei foldei
levels. Cuiiently, theie aie two
buuons heie labeled Select and Re-
move. Click the Select buuon and
a new window appeais, like the one
below. Clicking the Remove buuon
heie doesnt aect the link. lt is used
solely foi moving links out of foldeis and subfoldeis back into the main Book-
maiks view.
Now choose the Literature foldei. When you do this, notice how the links
loldei section changes to ieect the new location of the link.
34 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.3: Select the Choose button next to the desired folder.
Figure 12.4: When you choose a
folder, the folder navigation changes
to reect the newlocation of the link.
When you choose Save, you ie-
tuin to the Bookmaiks poitlet. No-
tice that the Lifeiay link is no longei
undei the Bookmaiks section. Select
Literature to ieveal its contents. ln
the example below, you can see the
Lifeiay link is now in the bookmaiks
section of the Liteiatuie foldei.
Select Edit fiom the Actions but-
ton next to the Lifeiay link, then click
Select. Choose the Nonction sub-
foldei and again notice the change in
the foldei-level bieadciumbs. Click Save and the Liteiatuie foldei viewappeais.
Select Nonction to see youi link in the subfoldeis bookmaiks list. Piece of cake,
iight`
To move a link out of a subfoldei and into a highei-level foldei, Edit the link
in the subfoldei and choose Select.
12.1. CAPTURING WEB SITES WITH THE BOOKMARKS PORTLET 34
Figure 12.5: When you move a link to a folder, it remains in the bookmarks
section until its moved into a subfolder.
Figure 12.6: To move a link up to a
higher-level folder, choose the
appropriate folder fromthe
breadcrumbs in the Select view.
ln the iesulting window, se-
lect the appiopiiate foldei fiom the
bieadciumbs at the top. ln this exam-
ple, we selected Literature foi con-
sistency. Tis opens a new window,
like the one below, showing the othei
foldei options.
You can choose one of the othei
subfoldeis fiom the list, oi you can
choose Home fiom the bieadciumbs
at the top. When you veiify that
the desiied foldei is the one cuiiently
displayed in the bieadciumbs, click
Choose is Folder. Ten click Save
and youie done. lf you dont like any of the subfoldeis listed, you can place the
link into a new subfoldei by using the Add Subfolder buuon.
lf you choose Remove instead of Select in the above example, you take the
link out of both subfoldeis and ietuin it to the main bookmaiks view.
Nowthat you have an undeistanding of howbookmaik foldeis aie used, lets
348 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.7: In this view, you can move the link into several different
locations.
cieate some new bookmaiks.
Adding and Using Bookmarks
Navigate to youi poital and add the Bookmaiks application to youi page by
selecting Add More. Te poitlet looks like this by default
Acioss the top of the poitlet aie links labeled Home, Recent, and Mine. Teie
is also a Seaich eld and buuon.
Home: ietuins you to the top level of the poitlet.
Recent: displays a list of the latest bookmaiks that have been added.
Mine: displays a list of the bookmaiks you added to the poitlet.
Sear: lets you seaich foi bookmaiks by name, categoiy, oi tags.
When you select the Permissions buuon on the iight, a list of Roles and theii
associated peimissions appeais. Te options aie Add Entiy, Add loldei, Peimis-
sions, and View. When you aie nished selecting the peimissions click Save.
Clicking the Add Folder buuon in the Bookmaiks application ieveals this
foim
Heie you can choose the foldeis name, a desciiption of its contents, and who
can view it. Undei Moie Options, you can set poitlet peimissions foi vaiious
Roles to the foldei. Click Save when you aie nished.
12.1. CAPTURING WEB SITES WITH THE BOOKMARKS PORTLET 349
Figure 12.8: Initially, no bookmarks are listed in this formuntil theyre
created.
Figure 12.9: Its not necessary to enter a description for a Bookmarks
folder.
30 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
To cieate a bookmaik, click the Add Bookmark buuon. Tis foim is similai
to the New loldei foim but has a few moie options.
Figure 12.10: When you use the Add Bookmark form, you must enter a
valid URL in the required eld.
Click Select to choose the foldei foi the new bookmaik. Click Remove to
delete a bookmaik fiomthe selected foldei. As stated above, a iemoved link goes
into the list of geneial bookmaiks that aient associated with a foldei. Tese aie
listed in the bookmaiks section, below the foldeis, in the poitlet.
Below the Peimissions theie aie additional options foi Categoiization and
Related Assets, just like in othei Lifeiay applications. Please see chaptei on
the Asset liamewoik foi fuithei infoimation about this.
Once you have added a new bookmaik, it appeais in the poitlet. liom heie,
you can manage youi bookmaik using familiai Lifeiay editing featuies. Col-
12.2. CREATING YOUR OWN PLUGIN REPOSITORY 31
lecting and oiganizing youi links is a snap when you use Lifeiays Bookmaiks
application.
12.2 Creating Your Own Plugin Repository
As youi enteipiise builds its own libiaiy of poitlets foi inteinal use, you can
cieate youi own plugin iepositoiy to make it easy to install and upgiade poitlets.
Tis will allow dieient depaitments who may be iunning dieient instances
of Lifeiay to shaie poitlets and install them as needed. lf you aie a sofwaie
development house, you may wish to cieate a plugin iepositoiy foi youi own
pioducts. Lifeiay makes it easy foi you to cieate youi own plugin iepositoiy
and make it available to otheis.
You can cieate youi plugin iepositoiy in two ways
1. Use the Sofwaie Catalog in the Contiol Panel to cieate the iepositoiy by
using its giaphical inteiface and an HTTP seivei.
2. Cieate an XML le using the Lifeiay Plugin Repositoiy DTD and an HTTP
seivei.
Both methods have theii benets. Te ist method allows useis to upload
theii plugins to an HTTP seivei to which they have access. Tey can then
iegistei theii plugins with the iepositoiy by adding a link to it via the Contiol
Panels giaphical usei inteiface. Lifeiay will then geneiate the XML necessaiy
to connect the iepositoiy to a Contiol Panel iunning on anothei instance of
Lifeiay. Tis XML le can then be placed on an HTTP seivei and its URL can
be added to the Plugin lnstallei, making the poitlets in this iepositoiy available
to the seivei iunning Lifeiay.
Te second method does not iequiie an instance of Lifeiay to be iunning.
You can upload plugins to an HTTP seivei of youi choice, then cieate an XML
le called liferay-plugin-repository.xml manually. lf you make this le
available on an HTTP seivei (it can be the same one which is stoiing the plugins
oi a dieient one), you can connect the iepositoiy to a Plugin lnstallei in the
Contiol Panel iunning on an instance of Lifeiay.
We will ist look at cieating a plugin iepositoiy using the Sofwaie Catalog
in the Contiol Panel.
32 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Software Catalog
You will want to use the Sofwaie Catalog if you will have multiple useis submit-
ting poitlets into the iepositoiy and if you dont want to woiiy about cieating
the liferay-plugin-repository.xml le youiself.
Figure 12.11: The Software Catalog with Nothing Installed
Each site in youi poital can have an instance of the Sofwaie Catalog. Te
Contiol Panel piesents you with the sofwaie catalog foi whichevei site you aie
woiking on. Tis means dieient sites can have dieient sofwaie iepositoiies,
so you can host seveial sofwaie iepositoiies on the same instance of Lifeiay if
you wish, they just have to be in dieient sites. Choose the site that will host
the plugin iepositoiy and go to the Contiol Panel. You will see at the top of
the scieen a message that says Content foi [Site], wheie [Site] is the site you
weie on when you selected the Contiol Panel fiom the dockbai. lf you want to
administei the sofwaie catalog foi a dieient site, you can select it fiom the
selection box.
Te Sofwaie Catalog has seveial tabs. Te ist tab is labeled Pioducts. Te
default viewof the poitlet, when populated with sofwaie, displays what plugins
aie available foi install oi download. Tis can be seen in the veision on Lifeiays
home page.
We will use an example site in oidei to beuei illustiate how to use the Sof-
waie Catalog poitlet. Assume you, as the poital administiatoi, have cieated a
site called Old Computers. Tis site will be foi useis to collaboiate on seuing up
and using old computeis with obsolete haidwaie and opeiating systems. Useis
who paiticipate in the site will eventually get upgiaded to a moie piivileged
status and get theii own blog page. To implement this, you have cieated a My
Summaiy poitlet which displays the useis name, pictuie and desciiption fiom
his oi hei usei piole. Because this poitlet is geneiic enough that it could be
12.2. CREATING YOUR OWN PLUGIN REPOSITORY 33
Figure 12.12: Populated Software Catalog fromliferay.com
useful to anyone using Lifeiay, you have decided to make it available in youi
own sofwaie catalog.
Te ist step in adding a plugin to youi sofwaie iepositoiy is to add a license
foi youi pioduct. A license communicates to useis the teims upon which you
aie allowing them to download and use youi sofwaie. Click the Licenses tab
and then click the Add License buuon that appeais. You will then see a foim
which allows you to entei the title of youi license, a URL pointing to the actual
license document and check boxes denoting whethei the license is open souice,
active oi iecommended.
When you have nished lling out the foim, click the Save buuon. Youi
34 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
license will be saved. Once you have at least one license in the system, you can
begin adding sofwaie pioducts to youi sofwaie catalog. Click the Products tab,
then click the Add Product buuon.
Youi next step will be to cieate the pioduct iecoid in the sofwaie catalog.
Tis will iegistei the pioduct in the sofwaie catalog and allow you to stait
adding veisions of youi sofwaie foi useis to download and/oi install diiectly
fiom theii instances of Lifeiay. You will ist need to put the .war le contain-
ing youi sofwaie on a web seivei that is accessible without authentication to
the useis who will be installing youi sofwaie. ln the example above, the Old
Computers site is on the lnteinet so you would place the le on a web seivei that
is accessible to anyone on the lnteinet. lf you aie cieating a sofwaie catalog foi
an inteinal lntianet, you would place the le on a web seivei that is available
to anyone inside of youi oiganizations iewall.
To cieate the pioduct iecoid in the Sofwaie Catalog poitlet, click the Prod-
ucts tab, then click the Add Product buuon. lill out the foim with infoimation
about youi pioduct.
Name: Te name of youi sofwaie pioduct.
Type: Select whethei this is a poitlet, theme, layout template, hook oi web
plugin.
Licenses: Select the license(s) undei which you aie ieleasing this sofwaie.
Author: Entei the name of the authoi of the sofwaie.
Page URL: lf the sofwaie has a home page, entei its URL heie.
Tags: Entei any tags you would like added to this sofwaie.
Short Description: Entei a shoit desciiption. Tis will be displayed in the
summaiy table of youi sofwaie catalog.
Long Description: Entei a longei desciiption. Tis will be displayed on the
details page foi this sofwaie pioduct.
Permissions: Click the Congure link to set peimissions foi this sofwaie
pioduct.
Group ID: Entei a gioup lD. A gioup lD is a name space which usually iden-
ties the company oi oiganization that made the sofwaie. loi oui example, we
will use old-computers.
Artifact ID: Entei an Aitifact lD. Te aitifact lD is a unique name within the
name space foi youi pioduct. loi oui example, we will use my-summary-portlet.
Screenshot: Click the Add Screenshot buuon to add a scieen shot of youi
pioduct foi useis to view.
When you have nished lling out the foim, click the Save buuon. You will
be biought back to the pioduct summaiy page and you will see youi pioduct
has been added to the iepositoiy.
12.2. CREATING YOUR OWN PLUGIN REPOSITORY 3
Figure 12.13: Adding a Product to the Software Catalog
Notice in the veision column, N/A is being displayed. Tis is because theie
aie not yet any ieleased versions of youi pioduct. To make youi pioduct down-
loadable, you need to cieate a veision of youi pioduct and point it to the le
you uploaded to youi HTTP seivei eailiei.
Befoie you do that, howevei, you need to add a Framework Version to youi
sofwaie catalog. A liamewoik veision denotes what veision of Lifeiay youi
plugin is designed foi and woiks on. You cannot add a veision of youi pioduct
without linking it to a veision of the fiamewoik foi which it is designed.
Why is this so impoitant` Because as Lifeiay gains moie and moie featuies,
you may wish to take advantage of those featuies in futuie veisions of youi
pioduct, while still keeping oldei veisions of youi pioduct available foi those
who aie using oldei veisions of Lifeiay. Tis is peifectly illustiated in the ex-
3 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
ample My Summaiy poitlet we aie using. Lifeiay had a My Summaiy poitlet
of its own, which does exactly what we have desciibed heie. Tis poitlet was
added to the suite of poitlets which Lifeiay piovides in the Social Netwoiking
plugin. Tis plugin makes use of the many social netwoiking featuies which
have been added to Lifeiay. So iathei than just displaying a summaiy of youi
infoimation, the Social Netwoiking poitlet adds featuies such as status updates,
a wall foi each usei in his oi hei piole that othei useis can write on, the abil-
ity to become friends with othei useistheieby gianting them access to theii
piolesand moie.
None of this would woik in oldei veisions of Lifeiay, because the coie engine
that enables developeis to cieate featuies like this is not theie. So in this case,
you would want to keep the oldei My Summaiy poitlet available foi useis who
have not yet upgiaded and make the newei social poitlets available to those
using latest veision of Lifeiay. Tis is what Framework Versions does foi you.
lf you connect to Lifeiays sofwaie iepositoiies with an old veision of Lifeiay
Poital, you will see the My Summaiy poitlet. lf you connect to Lifeiays sof-
waie iepositoiies with new veision of Lifeiay, you will see the social poitlets.
So click the Framework Versions tab and then click the Add Framework Ver-
sion buuon.
Give the fiamewoik a name, a URL and leave the Active check box checked.
loi oui example, we have enteied .0.3 foi the name, because oui poitlet should
woik on that veision and highei, and hup//www.lifeiay.com foi the URL. Click
Save.
Now go back to the Products tab and click on youi pioduct. You will notice
a message is displayed stating the pioduct does not have any ieleased veisions.
Click the Add Product Version buuon.
Version Name: Entei the veision of youi pioduct.
Change Log: Entei some comments iegaiding what changed between this
veision and any pievious veisions.
Supported Framework Versions: Select the fiamewoik veision foi which
youi sofwaie pioduct is intended. Entei a + at the end of the veision numbei
if you want to specify a veision plus any futuie veisions.
Download Page URL: lf youi pioduct has a desciiptive web page, entei its
URL heie.
Direct Download URL (Recommended): Entei a diiect download link to
youi sofwaie pioduct heie. Te Plugin lnstallei poitlet will follow this link in
oidei to download youi sofwaie pioduct.
Include Artifact in Repository: To enable otheis to use the Plugin lnstallei
poitlet to connect to youi iepositoiy and download youi plugin, select yes heie.
12.2. CREATING YOUR OWN PLUGIN REPOSITORY 3
Figure 12.14: Adding a Product Version to the Software Catalog
When you aie nished lling out the foim, click the Save buuon. Youi piod-
uct veision will be saved and youi pioduct will now be available in the sofwaie
iepositoiy.
Generating The Software Catalog
Te Sofwaie Catalog woiks by geneiating an XML document which the Plugin
lnstallei ieads. Using the data fiom this XML document, the Plugin lnstallei
knows wheie it can download the plugins fiom, what veision of Lifeiay the
plugins aie designed foi and all othei data about the plugins that have been
enteied into the Sofwaie Catalog poitlet.
ln oidei to get youi Sofwaie Catalog to geneiate this XML data, you will
need to access a paiticulai URL. lf you have cieated a fiiendly URL foi youi
site (foi example, the default site, which is called guest, has a fiiendly URL of
/guest alieady conguied foi it), you can use the fiiendly URL. lf not, you will
ist need to know the Gioup lD of the site in which youi Sofwaie Catalog
poitlet iesides. You can do this by accessing the Manage Pages inteiface and
looking at the URLs foi any of the pages. Te URL will look something like this
http://localhost:8080/web/10148/1.
38 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Obviously, it is much easiei if you aie using liiendly URLs, which we highly
iecommend.
Next, go to youi biowsei and go to the following URL
hup///sofwaiecatalog`
loi example, if you aie on the same machine as youi Lifeiay instance, and
that instance is iunning on poit 8080, and youi gioup lD fiom the database is
10148, you would use the following URL
hup//localhost8080/sofwaiecatalog`10148
lf you have also cieated a fiiendly URL called old-computers foi this site, you
would use the following URL
hup//localhost8080/sofwaiecatalog`old-computeis
lf you have conguied eveiything piopeily, an XML document should be
ietuined
<?xml version="1.0" encoding="UTF-8"?>
<plugin-repository>
<settings/>
<plugin-package>
<name>My Summary</name>
<module-id>old-computers/my-summary-portlet/1.0/war</module-id>
<modified-date>Thu, 23 Apr 2009 20:40:16 +0000</modified-date>
<types>
<type>portlet</type>
</types>
<tags>
<tag>social</tag>
<tag>profile</tag>
</tags>
<short-description>My Summary</short-description>
<long-description>My Summary</long-description>
<change-log>Initial Version</change-log>
<download-url>
http://www.liferay.com/portlets/my-summary-portlet-6.0.4.war
12.2. CREATING YOUR OWN PLUGIN REPOSITORY 39
</download-url>
<author>Rich Sezov</author>
<screenshots/>
<licenses>
<license osi-approved="true">MIT License</license>
</licenses>
<liferay-versions/>
</plugin-package>
</plugin-repository>
You can now give the URL to youi sofwaie iepositoiy out on youi web site
and othei administiatois of Lifeiay can entei it into the Plugins lnstallation
module of theii Lifeiay Contiol Panels to connect to youi iepositoiy.
lf you want to seive youi iepositoiy o of a static web seivei, you can save
this document to a le called liferay-plugin-package.xml and put this le
on youi HTTP seivei. You can then give out the URL to the diiectoiy which
holds this le on youi web site and anyone with an instance of Lifeiay will be
able to point theii Plugin lnstallei poitlets to it.
Benets of the Software Catalog
As you can see, the Sofwaie Catalog makes it easy foi you to cieate a iepositoiy
of youi sofwaie. Useis of Lifeiay can conguie theii Plugin lnstalleis to auach
to youi iepositoiy and the piopei veisions of youi sofwaie will be automati-
cally made available to them by a single click. Tis is by fai the easiest way foi
you to keep tiack of youi sofwaie and foi youi useis to obtain youi sofwaie.
Anothei benet of the Sofwaie Catalog is that you can make available to
youi useis a standaid inteiface foi manually downloading youi sofwaie. loi
those who piefei to manually download plugins, youi Sofwaie Catalog gives
them an inteiface to go in, nd youi sofwaie eithei by biowsing oi by seaich-
ing, pieview scieen shots and download youi sofwaieand you dont have to
build any of those pages youiself. Simply conguie youi sofwaie in the poitlet
and all of that is done foi you.
How can you do this` Te Sofwaie Catalog is also available as a poitlet.
You can add it to any page on youi web site thiough the Add Application menu.
You can nd the poitlet in the Tools categoiy.
30 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Manually Creating ASoftware Catalog
lf you do not wish to use the Contiol Panel to cieate youi sofwaie catalog, you
can cieate it manually by manually typing out the XML le that the Sofwaie
Catalog section of the Contiol Panel would noimally geneiate. Note that if you
do this, you will not be able to use the Sofwaie Catalog poitlet as a giaphical
usei inteiface to youi sofwaie that end useis can use to download youi sofwaie
manually you will have to build this youiself. Keep in mind many instances
of Lifeiay Poital sit behind a iewall without access to the lnteinet. Because
of this, if you aie making youi sofwaie available to lnteinet useis, some of
them will have to download it manually anyway, because theii installations aie
iewalled. ln this case, the Sofwaie Catalog poitlet is the easiest way to piovide
a usei inteiface foi downloading youi sofwaie.
lf you still wish to use a text editoi to cieate youi sofwaie catalog, you can.
To manually cieate a sofwaie catalog, obtain the DTDfoi the XML le fiomLif-
eiays souice code. You will nd this DTD in the denitions foldei in the Lifeiay
souice oi on the Lifeiay web site
1
lt is a le called liferay-plugin-package_-
6_1_0.dtd. Use this DTD with a validating XML editoi (a good, fiee choice is
jEdit with all the XML plugins) to cieate youi sofwaie catalog manually.
Connecting to a Software Catalog
lf theie is a sofwaie catalog of plugins you would like to point youi instance of
Lifeiay to, all you need is the URL to the catalog. Once you have the URL, go to
the Plugin lnstallei in youi Contiol Panel and click the Conguration tab. You
will see theie aie two elds in which you can entei URLs to plugin iepositoiies
Trusted Plugin Repositories and Untrusted Plugin Repositories. Cuiiently, the only
dieience between the two is to piovide a visual cue foi administiatois as to
which iepositoiies aie tiusted and untiusted.
Entei the URL to the iepositoiy to which you wish to connect in one of the
elds and click Save. Te poitlet will connect to the iepositoiy and items fiom
this iepositoiy will be shown in the list.
lf all this talk of catalogs has put you in the mood to do some shopping, then
its piobably a good time to get acquainted with Lifeiays Shopping application.
Lets go down that aisle next.
1
http://www.liferay.com/dtd/liferay-plugin-repository_6_1_0.dtd
12.3. SHOPPING 31
12.3 Shopping
Would youi oiganization like to make some money selling piomotional items`
Aie you an aitist looking to shaie youi woik with the woild` Peihaps youi
company pioduces a publication that customeis want to puichase` lf you have
something of value the visitois of youi site want oi need, then Lifeaiys Shop-
ping application can help you get these items to youi customeis with a secuie
tiansaction.
Te Shopping poitlet uses PayPal and allows you to choose the ciedit caids
youi stoie accepts. You can oiganize youi inventoiy with categoiies and sub-
categoiies. A seaich function helps useis nd items quickly. Useis place items
in a shopping cait, allowing them to puichase multiple items at once. Teie is
also an email notication system to aleit customeis when theii tiansactions aie
piocessed.
Befoie we stait piinting money, lets ist cieate an online stoie.
Setting up shop
Figure 12.15: Start setting up the store by entering items and categories in
the shopping portlet.
To begin seuing up a stoie, place the Shopping application on a page in youi
site. Like the Message Boaids poitlet, the Shopping poitlet takes up a lot of
space. lts best, theiefoie, to dedicate an entiie page to the application. Te
32 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Shopping poitlet is available fiom the Add More menu in the Dockbai undei
Shopping.
Te shopping poitlet has foui tabs acioss the top
Figure 12.16: In this gure there are three subcategories for the
Aromatherapy category. The rst subcategory has three items, the second
has two, and the third is empty.
Categories: shows the categoiies of items in youi stoie. loi example, if
youie selling music, you might have categoiies foi vaiious genies, such as pop,
iock, metal, hip hop, and the like. Te poitlet defaults to this view.
Cart: shows the items the usei has selected to puichase fiom youi stoie. lt
displays the oidei subtotal, the shipping cost, and a eld foi enteiing a coupon
code. Teie aie buuons foi updating the cait, emptying the cait, and checking
out.
Orders: displays a list of all pievious oideis placed, containing options to
seaich foi oideis by the oidei numbei, status, ist name, last name and/oi email
addiess.
12.3. SHOPPING 33
Coupons: lets you dene coupon codes to oei discounts to youi customeis.
You can entei the coupon code, discount type, and whethei it is active oi not.
Seaich looks foi a paiticulai coupon oei while Add Coupon opens a new foim
to key in the coupon data. Delete iemoves a coupon.
Below the tabs aie bieadciumbs foi navigating between the categoiies and
subcategoiies you cieate. ln fact, this would be a good time to stait cieating
some categoiies.
Creating Categories
lts not dicult to cieate categoiies. Simply click the Add Category buuon to
display the Categoiy foim. ln this foim entei the Name, Description, and set the
Permissions foi the categoiy. Tats all theie is to it.
When you click Save, youi new categoiy is listed in the poitlet, along with
the numbei of subcategoiies and the numbei of items that aie in the categoiy.
You can edit the categoiy, set peimissions foi it oi delete it using the Actions
buuon.
Figure 12.17: Breadcrumbs are
an important navigational tool
in the shopping portlet.
Each categoiy can have unlimited sub-
categoiies and you can add subcategoiies
to any categoiy. Notice as you add cat-
egoiies and subcategoiies, navigational
bieadciumbs appeai in the poitlet. Use
these to move thiough the stoie inventoiy.
Creating Items
When you select a categoiy, youll see its
items appeai. You cieate items the same
way you cieate categoiies. Use the Add
Item buuon to open the new item foim.
Entei data foi the SKU numbei, name, de-
sciiption, and item piopeities. You can
select checkboxes to specify whethei the
item iequiies shipping and whethei it is a
featuied item. Entei the stock quantity to
iecoid how many items aie available and set the appiopiiate peimissions.
Te lields aiea is wheie you add additional elds to set specic chaiacteiis-
tics foi the item. Tese can include things like sizes and colois. Te additional
elds appeai in the item foim as pull-down menus, as in the guie below.
34 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.18: The additional elds you create for an itemappear in the
itemdescription formas menu options.
Te Piices aiea is foi all data peitaining to the items cost, minimum and
maximum quantities, quantity discounts, taxes, and shipping costs.
Te lmages aiea lets you add photos to the item foim. You can add a link
to the photo oi upload the le locally. Choose fiom thiee sizes of images. You
must select the appiopiiate check box foi the image you want to display. When
youie nished cieating a new item, click Save.
As pioducts aie added, they aie listed in the ltems section of the poitlet.
lf the item you just cieated needs to go into one of youi new categoiies oi
subcategoiies, you can assign it to the categoiy by editing the item. Choose the
Select buuon (next to the Remove buuon), and this displays a dialog box listing
all the shop categoiies.
Choose the desiied categoiy fiom the list to ielocate the item to its new
location. Notice how the bieadciumbs ieect this change in the item foim.
12.3. SHOPPING 3
Figure 12.19: The image in this gure is the mediumsized option.
Figure 12.20: To put an itemin a category, edit the itemand choose Select
to see the available categories.
3 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.21: When an item
moves into a category, the
breadcrumb navigation
updates accordingly.
You can make changes to any item
thiough Actions Edit. linding an item is
easy, using the Search function.
Tats how you cieate an item foi the
stoie. Now lets examine some of the shop-
ping poitlets conguiation options.
Conguration
By selecting the wrench icon in the top iight
of the poitlet, you can manage the congu-
iation options of the shopping application.
ln the Setup view, theie aie tabs foi Pay-
ment Seuings, Shipping Calculation, lnsui-
ance Calculation, and Emails.
Payment Settings
Te payment seuings section is wheie you
conguie all the functions ielated to tiansactions foi youi stoie.
PayPal Email Address: is the addiess of youi stoies PayPal account which
is used foi payment piocessing.
Note that PayPal can be disabled by enteiing a blank PayPal addiess in the
eld. Ciedit caids can likewise be disabled. Payments to the stoie aie not ie-
quiied when these seuings aie disabled. Te ciedit caid function does not pio-
cess payments, it instead stoies the caid infoimation with the oidei so you can
piocess the tiansaction sepaiately.
Credit Cards: sets the type of ciedit caids youi stoie accepts.
Te Cuiient column holds the caids youi stoie takes. Te Available column
holds caids not accepted by youi shop. Tese can be moved easily fiom one
column to anothei by selecting a caid and clicking one of the aiiow buuons.
Te aiiows below the Cuiient window allow you to choose the oidei ciedit
caids aie displayed on the foim.
Currency: sets the appiopiiate cuiiency youi shop accepts.
Tax State: sets the applicable state wheie youi business is iesponsible foi
paying taxes.
Tax Rate: sets the peicentage of taxes youi stoie is iesponsible foi paying.
Tis iate is added as a sales tax chaige to oideis.
Minimum Order: sets the minimum amount iequiied foi a sale.
12.3. SHOPPING 3
Shipping and Insurance Calculation
Both the Shipping and lnsuiance foims have identical options.
Formula: sets the equation foi deteimining shipping and insuiance costs.
Teyie calculated on eithei a at iate based on the total puichase amount oi
on a peicentage of the total amount spent.
Values: sets the shipping and insuiance fees based on a iange of guies that
the total oidei amount falls undei.
Emails
Tis foim sets the addiesses foi customei email notications. Use the list of
teim denitions below to customize the coiiespondence with youi customeis.
Emails From: sets the email addiess fiom which oidei and shipping noti-
cations aie sent.
Conrmation Email: Use this foim to customize the email message cus-
tomeis ieceive when an oidei is ieceived.
Shipping Email: Use this foim to customize the email message customeis
ieceive when an oidei has been shipped.
So fai we have added the shopping poitlet to youi site, cieated categoiies and
items foi youi stoie, set up payment options, and conguied customei commu-
nication options. Tese aie the basics iequiied to get youi stoie up and iunning.
Now lets ieview the buying piocess.
Using the shopping cart
Logged in useis aie given a shopping cait to stoie the items they wish to buy.
Customeis can manage items and theii quantities diiectly fiom the cait, allow-
ing them to puichase a single pioduct oi multiple pioducts at once. Customeis
can also key in coupon codes to take advantage of any discounts youi stoie has
to oei. Pioducts can be placed in the cait fiom any categoiy oi subcategoiy.
Te caits appeaiance can be customized to ieect the oveiall design of youi
stoie.
When buyeis select an item, they see the items desciiption displaying all of
its ielevant infoimation. Te guie below is typical of what an items desciip-
tion might look like.
Below the pioduct desciiption is the Availability eld indicating whethei
the item is in stock. Teie aie also two buuons foi managing the shopping
expeiience
Add to Shopping Cart: places the item in youi cait foi checkout.
38 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.22: Shopping emails can be congured in a myriad of ways to
suit your needs.
12.3. SHOPPING 39
Figure 12.23: You can include images of each itemin your store. (Medium
sized images display on the items description form).
Next: lets you to scioll thiough all the items in the categoiy, giving you the
option to add to the cait as you go.
Afei adding an item to the cait, click << Back to ietuin to the pioduct de-
sciiption and continue shopping by navigating the categoiy bieadciumbs at the
top of the foim. You can also continue shopping by sciolling thiough a cate-
goiy, item by item, using the Previous and Next buuons at the bouom of the
pioduct desciiption.
Each time you add an item to the cait, a iunning tally of the caits contents
is kept. Qantities foi each item aie contiolled using diop-down menus. Te
oidei subtotal and shipping costs appeai above a eld wheie coupon codes can
30 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.24: This shopping cart has two items in it so far.
12.3. SHOPPING 31
be enteied. When you have nished adding pioducts to the cait, you have thiee
options
Update Cart: lets you change the quantity of an item being puichased. lf a
minimum numbei of items has been set in the item desciiption, the eld undei
the Qantity column shows that numbei by default. You can adjust the exact
numbei of items you want with the diop-down menus in the cait.
Empty Cart: lets you cleai the contents of the cait to eithei stait shopping
again oi to stop shopping.
Cheout: sends you to a new foim to veiify the billing addiess, shipping
addiess, and the ciedit caid infoimation. You can also add comments about the
oidei if necessaiy.
When all the data has been enteied coiiectly, click Continue to see the oi-
dei summaiy. Afei ieviewing the summaiy, click Finished and you aie given
conimation the oidei has been placed, along with the oidei numbei. Use this
numbei to seaich foi the oidei histoiy and keep tiack of its status.
Customizing the shopping cart with a hook
lf you think the shopping cait looks a liule basic foi youi puiposes, you can
customize it by using a hook. To leain moie about changing the appeaiance
of the shopping cait, consult the Liferay Developers Guide oi see section 8.3 in
Liferay in Action.
Now youi online stoie is set up, you have inventoiy, you have a payment
system, and you have sales iolling in. All is good. Some day theie will be
customeis with questions about theii oideis. Lets go ovei the oideis next.
Managing Orders
Undei the Oideis tab theie aie elds foi nding specic oideis. Seaich foi
oideis using the oidei numbei, oidei status, ist oi last name on the oidei oi
by the email addiess associated with the account. loi moie infoimation on
seaiching in Lifeiay Poital, see the laceted Seaich section in chaptei .
Below the seaich elds is the oideis list. Oideis can be deleted oi edited
using the Actions buuon. When you select an oidei fiom the Oideis tab, oi
if you edit an oidei, you see a summaiy of the oidei details along with some
options acioss the bouom.
Invoice: cieates a piintei-fiiendly copy of the oidei that can be sent to a
customei.
Resend Conrmation Email: lets you notify the customei that the oidei has
been ieceived and is being piocessed.
32 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.25: All the information pertaining an order can be seen in the
order summary view.
12.3. SHOPPING 33
Figure 12.26: Search for orders in the Orders viewor select one fromthe
list.
Send Shipping Email: noties the customei that the oidei is en route. You
can also include a tiacking numbei with this email to allow the customei to
follow the deliveiy piocess.
Delete: iemoves the oidei fiom the system.
Cancel: closes the Edit view and ietuins the usei to the main oideis view.
You can also add comments about the oidei and subsciibe to the comments
to get any updates on the oidei.
Managing Coupons
Te Coupons view of the Shopping application lets you piovide coupon codes
foi special sale events oi othei discounts. You can deteimine the type of dis-
34 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.27: Revieworder specics in the Edit view.
12.3. SHOPPING 3
count to apply and whethei it is cuiiently active. You can seaich foi coupons
and cieate new coupons fiom this foim.
Figure 12.28: Create a coupon code automatically when you select the
Autogenerate Code box.
To add a coupon, entei the coupon code in the Code eld. lf no code is speci-
ed, you can cieate one automatically by selecting the Autogenerate Code check-
box. Afei enteiing the coupons name and desciiption, you can set the coupons
stait and expiiation dates. Additional options let you activate the coupon and
set it to nevei expiie.
Undei the Discount section, you can set the minimumoidei amount iequiied
foi the discount, the discount amount, and the discount type. Types can be based
on a peicentage, a xed amount, fiee shipping, oi a tax fiee sale. Te Limits
section lets you set coupon iestiictions based on a list of categoiies and/oi SKU
numbeis.
3 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.29: Customize your coupon parameters under Discounts and
Limits.
12.3. SHOPPING 3
Integrating the Amazon Rankings portlet
lf youi stoie sells books, you can use Lifeiays Amazon Rankings application to
display them alongside the main shopping poitlet. Both of these aie found in
the Shopping categoiy undei Add More in the Contiol Panel. Te Amazon
Rankings application lets you highlight the books in youi stoies inventoiy out-
side of the typical categoiy stiuctuie. Books aie aiianged in ascending oidei
accoiding to Amazons Best Selleis Rank. Book covei images displayed in the
poitlet come fiom the images in the pioducts desciiption.
Setting up your Amazon Web Services account To use Amazon iankings, you
must ist setup an Amazon Associates Piogiam account. Tis gives you the as-
sociate ID tag you need to entei in youi portal-ext.properties le. Ten
you need to join the Amazon Pioduct Adveitising APl gioup. Tis yields the ac-
cess key id and the secret access key that also must go into youi portal-ext.pro-
perties le.
Amazon License Keys aie available at theii web site
2
.
Add the following lines to youi portal-ext.properties le and populate
the values foi the associate lD tag, access key id, and seciet access key. Ensuie
theie aie no spaces between the = sign and the piopeity values.
amazon.access.key.id=
amazon.associate.tag=
amazon.secret.access.key=
Note that these keys aie piovided by Amazon foi peisonal use only. Please
consult Amazon at hup//www.amazon.com foi moie infoimation.
lf youi Amazon Web Seivices key is set impiopeily, you cant add books to
youi Shopping poitlet.
Setting up the Amazon Rankings portlet Afei seuing up youi Amazon Web
Seivices account, choose the books to display in youi stoie. Select Conguration
fiom the Amazon Rankings poitlet in the uppei iight coinei. Go to the Setup
tab and entei the lnteinational Standaid Book Numbeis (lSBNs) in the textbox,
sepaiated by spaces. Te poitlet accepts 10-digit lSBNs iejecting lSBNs that
leueis.
When you aie nished seuing up the iankings, books appeai in the poitlet
similai to the example below. Clicking on the books covei image opens the
books Amazon page.
2
hups//aws-poital.amazon.com/gp/aws/developei/iegistiation/index.html/
38 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.30: Separate ISBNs with single spaces.
Figure 12.31: Using the Amazon Rankings application can be a nice
addition to your store.
12.4. KNOWLEDGE BASE 39
Now that you have a good giasp on Lifeiays Shopping and Amazon Rank-
ings applications, lets see what the Knowledge Base application has to oei.
12.4 Knowledge Base
Lifeiays Knowledge Base poitlet piovides a means foi cieating and oiganizing
aiticles within a site. Te knowledge base is peifect foi cieating and oiganiz-
ing infoimation moie foimally than in a wiki. loi example, it can be used to
oiganize and display piofessional pioduct documentation. lts easy to set up
the knowledge base with a woikow that iequiies aiticles to be appioved be-
foie they aie published. Additionally, it allows administiatois to cieate aiticle
templates. Templates can be used to insuie ceitain kinds of aiticles possess a
common stiuctuie and include ceitain kinds of infoimation. Knowledge base
aiticles can be categoiized to make them easy to nd. Tey can also be oiga-
nized hieiaichically to foim complete books oi guides. Te Knowledge Base
poitlet is available as an app fiom Lifeiay Maiketplace. Please see chaptei 2 foi
installation instiuctions.
Knowledge Base Display Portlet
Te Knowledge Base app actually consists of foui poitlets that can be placed on
site pages as well as one that adds a page to the Contiol Panel. Te foui poitlets
that can be placed on a page aie Knowledge Base (Display), Knowledge Base
Seaich, Knowledge Base Aiticle and Knowledge Base Section. When placed on
a page, the Knowledge Base display poitlet piesents many of the same options to
an administiatoi that aie available fiomthe Knowledge Base page of the contiol
panel.
You can use the foui links at the top of the Knowledge Base display poitlet
to contiol what it displays.
Knowledge Base Home: shows you a list of all top level aiticles.
Recent Articles: shows you a list of aiticles in oidei fiom most iecent activity
to least iecent activity.
Administrator: shows you a list of all aiticles, iegaidless of which ones aie
paients oi childien of the otheis.
My Subscriptions: shows you a list of aiticles you aie subsciibed to.
Te Add Article buuon is available fiom the Knowledge Base Home oi Ad-
ministiatoi view of the Knowledge Base display poitlet oi fiom the Aiticles tab
of the Knowledge Base page of the Contiol Panel. Use this buuon to cieate an
380 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.32: Knowledge Base Display Portlet
aiticle foi the knowledge base. When cieating an aiticle, you can use the same
WYSlWYG editoi you used to cieate wiki pages. Aiticles, howevei, aie not the
same as wiki pages they must be cieated in HTML, not MediaWiki oi Cieole.
Click the Source buuon in the editoi to view the HTML souice of what youve
wiiuen oi wiite some HTML youiself.
ln addition to enteiing a title and cieating content foi youi aiticle, you can
use the editoi to add auachments, add tags and set peimissions. By default,
view peimission is gianted to the guest iole, meaning anyone can view youi
aiticle. Afei youie done using the editoi, you can save it as diaf and continue
woiking on it latei oi you can submit it foi publication. Youi aiticle may need
to be appioved befoie being published, depending on the woikow dened foi
youi poital.
You can nd the Permissions buuon next to the Add Aiticle buuon in the
Knowledge Base display poitlet oi on the Knowledge Base page of the con-
tiol panel. Click this buuon to dene peimissions that apply to the Knowledge
Base display poitlet geneially, not to paiticulai aiticles. Heie, you can dene
which ioles can add aiticles and templates, which aie gianted knowledge base
administiatoi piivileges, which can change peimissions on aiticles, which can
subsciibe to aiticles and which can view templates.
Useis may need to be gianted access to the knowledge base page of the con-
tiol panel in oidei to exeicise some of the above peimissions. loi example,
suppose the usei iole has been gianted the Add Aiticle and the View Templates
12.4. KNOWLEDGE BASE 381
Figure 12.33: NewKnowledge Base Article
382 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.34: Knowledge Base Permissions
peimissions. A usei will be able to add aiticles fiomthe knowledge base display
poitlet but will need access to the knowledge base page of the Contiol Panel in
oidei to view templates. Note that the Knowledge Base (Display) peimissions
aie distinct fiom the Knowledge Base (Admin) poitlet. Te display peimissions
dene what a usei can do with the Knowledge Base display poitlet on a page
while the admin peimissions dene what a usei can do on the Knowledge Base
page of the Contiol Panel.
Knowledge Base Page of the Control Panel
Te Knowledge Base page of the Contiol Panel has two tabs one foi aiticles
and one foi templates. Te aiticles tab shows all the aiticles in the knowledge
base and lets you peifoim actions on them. Te templates tab shows all the
templates dened in the knowledge base and lets you peifoim actions on them.
Administiatois can peifoim the following actions on an aiticle
View: displays an aiticle. liom heie, you can add a child aiticle, edit the
aiticle, change its peimissions, move it oi delete it.
Edit: allows you to change the title and content of an aiticle as well as add
auachments, select topics and add tags.
Permissions: lets you conguie the peimissions on a specic aiticle.
Subscribe: lets you to choose to be notied of any updates to a paiticulai
aiticle.
Move: lets you change an aiticles position in the hieiaichy by choosing a
new paient aiticle foi it.
12.4. KNOWLEDGE BASE 383
Figure 12.35: Knowledge Base Control Panel Page
Delete: lets you iemove an aiticle fiom the knowledge base.
Tese actions aie similai to the ones that can be peifoimed fiom the Admin-
istiatoi view of the Knowledge Base display poitlet. Howevei, the Knowledge
Base display poitlet is intended to be placed on a page foi the end usei so an
additional action is available RSS is a link to an RSS feed of an aiticle. Also, the
View action is only available fiom the Contiol Panel since the Knowledge Base
Aiticle poitlet can be used to display an aiticle on a page.
Te templates tab of the Knowledge Base page of the Contiol Panel allows
administiatois to cieate templates to facilitate the cieation of aiticles. A tem-
plate basically functions like a staiting point foi the cieation of ceitain types of
aiticles. Click the Add Template buuon on the Templates tab of the Knowledge
Base page of the Contiol Panel to cieate a new template.
Navigate back to the templates tab of the Knowledge Base page of the contiol
panel. You can peifoim the following actions on a template
View: displays a template. liom heie, you can use the template to cieate an
aiticle, edit the template, modify the peimissions on the template oi delete it.
Edit: allows you to change the title and content of a template.
Permissions: allows you to conguie the peimissions on a template. You can
choose ioles to have peimission to update, view, delete oi change the peimis-
sions on templates.
Delete: lets you iemove a template fiom the knowledge base.
384 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.36: Adding a NewTemplate Fromthe Control Panel
To use a template to cieate a new aiticle, you have to view the template and
then click Use this Template. Tis biings you to the New Aiticle editoi with the
contents of the template copied foi you.
Knowledge Base Article Portlet
Te Knowledge Base Aiticle poitlet can be placed on a page to display an entiie
aiticle. When you ist place this poitlet on a page it displays the message Please
congure this portlet to make it visible to all users. Tis message is a link to the
conguiation dialog box foi the poitlet. Click Select Article to choose an aiticle
to display. Pick an aiticle and then click Save. When youi page iefieshes it will
12.4. KNOWLEDGE BASE 38
Figure 12.37: Knowledge Base Section Portlets
display the aiticle in the poitlet.
Figure 12.38: Knowledge Base Article Portlet
Te Knowledge Base Aiticle poitlet allows useis to iate and comment on the
aiticle it displays. Teie aie also links at the top of the poitlet useis can use to
subsciibe to an RSS feed of the knowledge base, subsciibe to the aiticle, view
38 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
the histoiy of the aiticle oi piint the aiticle.
Knowledge Base Section Portlet
Te Knowledge Base Section poitlet allows administiatois to selectively show
aiticles associated with a specic section. loi example, a news site might have a
World section, a Politics section, a Business section and an Entertainment section.
ln oidei to use sections, you need to set the admin.kb.article.sections
piopeity in youi knowledge base poitlets portlet.properties le and ie-
deploy the poitlet. You can nd the portlet.properties le in the knowl-
edge base poitlets souice diiectoiy. Updating the one in youi seiveis diiectoiy
wont woik. Use comma delimited section names to set the piopeity, foi exam-
ple
admin.kb.article.sections=World,Politics,Business,Entertainment
Figure 12.39: Knowledge Base Section Portlets
Once you have dened some sections in youi knowledge bases portlet.pro-
perties le, youi useis will see a multi-select box in the Add Aiticle and Edit
Aiticle scieens that allows them to select which section an aiticle belongs to.
12.4. KNOWLEDGE BASE 38
You can add any numbei of Knowledge Base section poitlets to a page and you
can conguie each poitlet to display aiticles fiom any numbei of sections.
Te Knowledge Base section poitlet has some additional conguiations that
allow an administiatoi to select a display style (title oi abstiact), an aiticle win-
dow state (maximized oi noimal), how to oidei the aiticles, how many aiticles
to display pei page and whethei oi not to show pagination.
Knowledge Base Navigation
Wikis ofen have deeply nested aiticles that can be haid to nd by biowsing.
Lifeiays knowledge bases ability to selectively display aiticles makes it easiei
to biowse than a Wiki. Te knowledge base also featuies some othei aids to
navigation. Te Knowledge Base Seaich poitlet allows you to seaich foi aiticles
in the knowledge base. Tis poitlet piesents the seaich iesults to you in oidei
fiom most ielevant to least ielevant.
Figure 12.40: Knowledge Base Search Portlet
You can also use the Categoiies Navigation poitlet in conjunction with the
Knowledge Base display poitlet. When both of these poitlets aie placed on a
page you can select a topic in the Categoiies Navigation poitlet and the Knowl-
edge Base display poitlet will show all of the aiticles that match the topic. You
can cieate topics fiom the Categoiies page of the Contiol Panel.
You can select topics foi aiticles when you aie cieating oi editing them.
388 CHAPTER 12. LIFERAY UTILITY APPLICATIONS
Figure 12.41: Knowledge Base Category Navigation Portlet
12.5 Summary
ln this chaptei, we examined two Lifeiay utility applications the Sofwaie Cat-
alog and the Knowledge Base. Te Sofwaie Catalog allows you to dene a set
of sofwaie items to make available to visitois to youi poital. Remembei that
the Sofwaie Catalog will be ieplaced by Lifeiay Maiketplace and will soon be
depiecated. Te Knowledge Base application is an EE-only application that al-
lows you to cieate aiticles and oiganize them into full books oi guides that be
published on youi poital. Next, lets take a toui of the Lifeiay Maiketplace and
leain how to manage Lifeiay plugins.
Cu~v1rv 13
Lrvrv~ciNc 1ur Liirv~v M~vxr1vi~cr
Lifeiay Maiketplace is an exciting new hub foi shaiing, biowsing and down-
loading Lifeiay-compatible applications. As enteipiises look foi ways to build
and enhance theii existing platfoims, developeis and sofwaie vendois aie seaich-
ing foi new avenues to ieach this maiket. Maiketplace leveiages the entiie Lif-
eiay ecosystem to ielease and shaie apps in a usei-fiiendly, one-stop site.
Tis chaptei coveis the following topics
Useis, Companies, and Apps
Accessing Lifeiay Maiketplace
linding, Downloading, and lnstalling Apps
Managing Apps
Plugins and Plugin Management
Poitlets, Temes, Layout Templates, Hooks, and Web Plugins
lnstalling Plugins fiom Repositoiies
lnstalling Plugins Manually
389
390 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Plugin Tioubleshooting and Conguiation lssues
ln a nutshell, the Lifeiay Maiketplace is a iepositoiy foi applications built
on the Lifeiay Platfoim. You can nd and download applications diiectly fiom
the Maiketplace on the web oi use an existing Lifeiay installation to access and
install applications onto the iunning Lifeiay web site. Once installed, you can
manage the applications thiough Lifeiays contiol panel.
13.1 Marketplace Concepts: Users, Companies, and Apps
Anyone can biowse the apps available on Lifeiay Maiketplace,
1
but a life-
ray.com usei account is iequiied foi puichasing and downloading apps, whethei
fiom the Maiketplace website oi fiom an existing Lifeiay installation. Many of-
cial Lifeiay apps, as well as some thiid paity apps, aie available fiee of chaige.
Othei apps iequiie you to pay a fee in oidei to access them. When you puichase
an app, you can do so on youi own behalf oi on behalf of a company. Apps pui-
chased on youi own behalf aie associated with youi peisonal liferay.com
usei account. Apps puichased on behalf of a company aie associated with the
companys account and can be accessed by any useis who belong to the com-
pany. Once youve puichased an app, youie fiee to download and install any
available veision of the app whenevei you like. Well explain how to set up a
company account, manage company apps and join companies afei we discuss
how to access Lifeiay Maiketplace.
13.2 Accessing the Liferay Marketplace
Teie aie two ways to access the Maiketplace.
1. Via the websiteUsing youi favoiite biowsei, you can navigate to the mai-
ketplace at hup//lifeiay.com/maiketplace.
2. Via Lifeiaylf you have a site up and iunning based on Lifeiay, you can use
the Maiketplace section of the contiol panel to access Maiketplace content.
1
hup//lifeiay.com/maiketplace
13.2. ACCESSING THE LIFERAY MARKETPLACE 391
The Basics
No mauei which method you choose, you will see the same content and apps.
lf you aie newto the Maiketplace, the easiest way to access it is by using youi
biowsei to navigate to hup//lifeiay.com/maiketplace. You will be piesented
with the Maiketplace home page.
Figure 13.1: Marketplace Home Page
392 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
ln the centei of the page, you will see a numbei of icons. Each icon iepiesents
an individual app and they aie giouped into a couple of dieient aieas
New To Maiketplace Te latest apps added to the maiketplace
leatuied Pioducts Lifeiay featuies a dieient set of apps each month
Most Viewed Te top 10 most viewed apps
lf you click on the title of an app, you can access details about the app, includ-
ing a desciiption, the authois name, scieenshots, piice, latest veision, numbei
of useis, numbei of weekly installs, a link to the developeis liferay.com pio-
le page, a link to the developeis own website, a link to iepoit abuse and a
Puichase buuon. Youll also be able to view veision histoiy, iead ieviews lef
by othei useis oi wiite youi own ieview.
Figure 13.2: Marketplace App Details
lf you click on the Puichase buuon, youll be piompted to choose a puichase
type. You can puichase an app foi youi peisonal account oi foi youi company.
lf youi company has alieady been iegisteied, select it in the diop-down list.
13.2. ACCESSING THE LIFERAY MARKETPLACE 393
lf youi company hasnt been iegisteied, click the Register Your Company link
to iegistei youi company with Lifeiay Maiketplace. Please see the Creating a
Company section below foi details.
Te lef side of each page in the hup//lifeiay.com/maiketplace site contains
a Maiketplace navigation menu. Tis menu contains links to vaiious categoiies
of apps and themes available fiom Maiketplace. Clicking on the individual cat-
egoiies will allow you to biowse apps in that categoiy. To view all apps oi
themes at once, click the Apps oi emes link and then the See All link in the
Apps oi Temes poitlet.
Figure 13.3: Browsing Apps in Marketplace
Below the navigation menu is the seaich bai. Tis allows you to seaich foi
apps with specic titles. Type in seaich teims and click Search to peifoim the
seaich.
394 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Logging In
You do not need a liferay.com account in oidei to biowse the Maiketplace.
Howevei, if you wish to puichase and download an app (oi if you aie a de-
velopei and wish to cieate and upload new apps), you will need to establish a
liferay.com account and agiee to the Maiketplace Teims of Use. To get a new
liferay.com account, visit hup//www.lifeiay.com, click Sign In, then Create
Account, and sign up' Once you aie signed in, you will be able to fully utilize
the Maiketplace to nd and use Maiketplace apps.
Marketplace Prole
On youi existing liferay.com Home page, youll notice a new link entitled
App Manager. Te App Managei allows you to access infoimation about the
apps youve puichased and apps youve uploaded to Maiketplace. lt also pio-
vides a mechanism foi uploading new apps to Maiketplace. Once you submit
youi app, it will be ieviewed befoie appeaiing on the liferay.com Maiket-
place.

Youi liferay.com Home page is a piivate page. lts distinct


fiom youi public liferay.com Piole page.
Managing Apps
Te App Managei shows you ielevant infoimation ielated to youi usage of Mai-
ketplace. Youll nd thiee tabs to help you manage youi Maiketplace apps Pur-
chased, Apps and Add an App.
Te Puichased tab lists the apps you have puichased. liom this scieen, you
can nd infoimation about the authois of the apps you have puichased. You
can also download oi ie-download the app (foi example, if you lost youi copy
oi have ie-installed Lifeiay and wish to ie-deploy the app). Tis option is also
useful foi downloading apps and deploying them to oine instances of Lifeiay
that do not have diiect access to liferay.com.
lf possible, its best to log into youi poital instance and install puichased
applications thiough the My Maiketplace link in the contiol panel. Tis will
piovide youi poital instance with automatic update notices should they become
available. lf you download applications this way, they can be hot-deployed.
13.2. ACCESSING THE LIFERAY MARKETPLACE 39
Figure 13.4: Purchased Apps
39 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Te Apps tab lists apps you have authoied and uploaded, showing you de-
tails such as the numbei of downloads, the cuiient piice and othei ielevant
infoimation. liom heie you can manage the apps you have cieated (please see
the Maiketplace chaptei of the Developei Guide foi details on this topic).
Figure 13.5: Upload an App
13.2. ACCESSING THE LIFERAY MARKETPLACE 39
Clicking on Add an App allows you to upload a newapp and make it available
in the maiketplace. Please see the Maiketplace Developei Guide foi moie detail
on authoiing youi own app.
Creating a Company
To cieate and iegistei a company with Lifeiay Maiketplace, click the Create a
Company link in the lef-hand navigation menu. Youi ist step is to see if youi
company alieady exists on Lifeiay Maiketplace. Entei youi company name into
the seaich box and check if its alieady been iegisteied. lf someone else fiom
youi company has alieady cieated a company account on Lifeiay Maiketplace,
you can click the Request to Join this Company buuon. Tis will send an email
notication to youi companys Maiketplace admin (the one who cieated youi
companys Maiketplace account). Youi companys Maiketplace admin will then
be able to add you to the company. lf the company name youd like to use is
available, click the Register Your Company buuon to move on to the next step.
Figure 13.6: Creating a Company
Youi second step is to ll out youi companys infoimation. Te public infoi-
mation you must piovide includes a company logo, the company name, a com-
pany desciiption, a company email addiess and a homepage URL. Te piivate
infoimation you must piovide includes a company addiess, youi companys
countiy, iegion, city, postal code and phone numbei. Additonal piivate infoi-
mation iequiied foi validation includes a company email addiess and a legal tax
document. Once youi companys Maiketplace iegistiation has been appioved,
398 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
you will be youi companys Maiketplace admin' Tis means youll be iespon-
sible foi handling Maiketplace useis iequests to join youi company. Dont
woiiy, you dont have to be stuck with this iesponsibility. Once youve added
othei useis to youi company, you can piomote some of them to be company
Maiketplace admins too.
13.3 Finding Apps
Figure 13.7: Browsing Categories
Teie aie seveial ways to seaich foi and nd apps you aie inteiested in.
1. Biowsing Categoiies. Click on a categoiy (foi example, Communication oi
Productivity) to see a list of inteiesting apps in that categoiy. Upon clicking
a categoiy, you aie piesented with a list of featuied apps foi that categoiy,
13.3. FINDING APPS 399
as well as a canonical listing of all apps. Also, on the iight, aie lists of the
Most Viewed apps within that categoiy.
2. Seaiching. To seaich foi an app, type in seaich ciiteiia in the seaich box
undei the navigation menu on the lef and click Search. Apps matching the
specied seaich ciiteiia aie displayed.
Versions
Figure 13.8:
Marketplace Search
Box
Apps aie ofen updated to include new featuies oi
x bugs. Each time an app is updated, its veision
numbei is changed. Te veision numbei is specied
by the app developei and ofen follows established
noims, such as 1.0 1.1 2.0 oi 1.0.1 1.0.2
1.2.0 and so on. Geneially, the highei the numbeis,
the youngei the veision.
When viewing an apps details, click on the Ver-
sion History tab to see a list of veisions of the app.
ln some cases, not all histoiical veisions of apps aie
available, depending on the app. Usually, you will
want to download and install the latest available app
foi the veision of Lifeiay you aie using (See Compat-
ibility below).
Compatibility
Some apps aie wiiuen to woik acioss a wide iange
of Lifeiay Platfoim ieleases. Otheis aie dependent
on a specic Lifeiay Platfoim ielease (oi a handful of
such ieleases). When viewing individual apps, each
veision of the app that is available also desciibes the
iange of Lifeiay Platfoim veisions the app is compatible with. Make suie to
choose a veision of the app that is compatible with youi Lifeiay Platfoim ie-
lease.
To check if an app is compatible with youi veision of Lifeiay, click on the
App and then click on the Version History tab. Te Veision Histoiy tab displays
not only the list of veisions of the app but also the apps suppoited fiamewoik
veisions and the dates of each veision of the app. Te suppoited fiamewoik
veision of the app tells you whethei oi not the app is compatible with youi
veision of Lifeiay.
400 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Figure 13.9: Marketplace App Version History
13.4 Downloading and Installing Apps
Once youve found an app you wish to download and use, click on the name of
the app to display its detailed infoimation scieen.
Figure 13.10: Detailed App Information
13.4. DOWNLOADING AND INSTALLING APPS 401
On this scieen, theie aie a numbei of items to assist in leaining moie about
the app. You can nd the piimaiy infoimation about the app on the lef side
of the scieen. ln the centei display, you see a set of scieenshots along with a
desciiption of the app. On the lef, below the icon foi the app, is some basic
infoimation about the app.
Authoi Te cieatoi of the app
Rating Te aveiage iating of the app on a scale fiom zeio to ve stais.
Te numbei of iatings is also shown.
Latest Veision Te latest ieleased veision of this app
Suppoited By Who to contact if you need suppoit foi this app
Useis Te total numbei of useis of the app
Weekly lnstalls Te aveiage numbei of installations pei week
Developei Piole A link to the app developeis liferay.com piole
page
Developei Website A link to the developeis own website
Puichase Te buuon to click on to puichase the app. You must puichase
an app befoie you can download it.
ln the lowei section, you will nd Reviews and Veision Histoiy tabs foi this
app. Check heie to nd out what othei people aie saying about this app. ln
addition, on a sepaiate tab, you will nd the histoiy of veisions foi this app,
wheie you can download othei veisions (foi example, if you aie using an oldei
veision of the Lifeiay Platfoim, you may need to download a specic veision
of this app that is compatible with the veision of the Lifeiay Platfoim you aie
using).
Downloading and Installing
Youve chosen an app, iead the ieviews and want to download and use the app'
Teie aie two ways to install the app. Ultimately, both methods iesult in the
same outcome the app youve chosen is installed onto youi local iunning Lif-
eiay instance.
402 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Figure 13.11: Detailed App Information
Liferay Hot Deploy
Apps on the Lifeiay Maiketplace consist of individual Lifeiay Plugins (foi ex-
ample a poitlet, a hook, oi a collection of multiple plugins). Ultimately these
apps must be installed on a iunning Lifeiay instance befoie they can be used.
Deploying an app to a iunning Lifeiay instance is automatically done thiough
the piocess of hot deploy. When using Control Panel to install apps fiom the
Maiketplace, when you click Purchase oi Install to download and use a given
app, it will be downloaded and hot deployed to youi local iunning Lifeiay in-
stance.
loi some Lifeiay installations, the hot deploy mechanismis disabled, in oidei
foi the site administiatoi to manage (oi pievent) the deployment of plugins. ln
this case, the app will still be downloaded and stoied in the hot deploy diiectoiy
(with a .lpkg extension in its lename), but must be manually deployed using
the custom piocess used foi deploying othei plugins.
Please see the latei section Installing Plugins Manually To leain moie about
hot deploy, its behavioi on vaiious app seiveis, and how to manually deploy
Maiketplace apps in situations wheie hot deploy cannot be used.
Installing through the Control Panel
Te easiest way to install an app is to do so fiomyoui Lifeiay contiol panel. Tis
iequiies that you have alieady installed Lifeiay on youi local machine and that
you can log in as an administiatoi. Once you aie logged in as an administiatoi,
click the Go to menu on the Dockbai and choose Control Panel.
13.4. DOWNLOADING AND INSTALLING APPS 403
Figure 13.12:
Marketplace fromthe
Control Panel
Click on eithei the Store oi the Purchased link
in the Maiketplace categoiy at the uppei-lef. Be-
foie you can access Maiketplace via the contiol
panel, you need to associate youi liferay.com lo-
gin ciedentials with youi local administiatoi ac-
count. Entei youi liferay.com email addiess and
passwoid so youi Lifeiay installation can connect to
the liferay.com Maiketplace.
Figure 13.13: Marketplace Login Screen
Once youve successfully linked the accounts, you
will be piesented with the same Maiketplace scieens as you would have if you
weie diiectly accessing the Maiketplace. You will be able to biowse, seaich,
and install diiectly fiom the Maiketplace. Click on the Store link undei the
Maiketplace heading in the contiol panel to biowse the apps available fiom the
liferay.com Maiketplace. Biowse to the app you wish to install, click the
Purchase buuon, and then the Buy buuon on the next scieen. Te app will be
downloaded and deployed to youi local Lifeiay installation.

Any local usei with administiative piivileges can use the Mai-
ketplace to biowse and install apps fiom the Maiketplace, by en-
teiing theii liferay.com ciedentials in the above login scieen.
Tis allows multiple administiatois to manage the apps installed
on the local Lifeiay instance. Once a link is established between
a local administiatoi account and a liferay.com account, theie
is no way to undo this, shoit of ie-installing Lifeiay.
All apps that youve bought aie listed on the Purchased page of the Maiket-
place contiol panel. Clicking on the Purchased link will show you a list of those
404 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
apps which you have downloaded in the past, including apps you may have
puichased/downloaded while using othei Lifeiay installations.
Figure 13.14: Purchased Apps
Te apps which you downloaded and installed on the cuiiently iunning in-
stance of Lifeiay aie listed as lnstalled. Apps which you have pieviously down-
loaded oi puichased on othei Lifeiay instances that aie incompatible with the
cuiient one aie listed as Not Compatible. You need to ie-download/ie-install
the appiopiiate veision of these apps if you wish to use them on youi iunning
instance of Lifeiay.
Downloading through liferay.com
Te second way to install an app is to download it ist, then in a sepaiate step,
deploy it to youi iunning Lifeiay instance. Tis is especially useful in situations
wheie you do not wish to deploy the app diiectly to youi pioduction enviion-
ment, oi in cases wheie the taiget Lifeiay instance that is to ieceive the app
13.5. CREATING AND UPLOADING APPS 40
is behind a coipoiate iewall oi otheiwise does not have diiect access to the
Maiketplace.
ln this case, using youi biowsei, you will nd the app on Lifeiay Maiket-
place.
2
Once found, click on the Purchase buuon when viewing the individual
app. Tis will cause the app to be placed in youi Purchased list on youi peisonal
Home page. Navigate to youi Home page, click on App Manager and visit the
Purchased tab. Each app is listed. lind the app you just puichased and click
Downloads. Youll nd a list of app veisions and Lifeiay veisions. Choose the
veision of the app you want, making suie the Lifeiay veision coiiesponds to the
veision of the Lifeiay installation into which youd like to install the app. Click
Download App and the app is downloaded to youi local machine in the same
way any othei le would be downloaded. Tis le can then be hot-deployed to
Lifeiay by copying it to Lifeiays hot deploy diiectoiy.
13.5 Creating and Uploading Apps
Cieating apps foi the Lifeiay Maiketplace is veiy easy and intuitive. To nd
out moie infoimation about cieating youi own Lifeiay apps, visit the Lifeiay
Maiketplace Developei Guide and get staited cieating apps today'
Next, well discuss geneial Lifeiay plugin management. Well explain the
dieiences between the vaiious types of Lifeiay plugins and show how to man-
ually deploy plugins to Lifeiay.
13.6 Plugin Management
One of the piimaiy ways of extending the functionality of Lifeiay Poital is by
the use of plugins. Plugin is an umbiella teim foi installable poitlet, theme,
layout template, hook, Ext and web module Java EE .war les. Tough Lifeiay
comes bundled with a numbei of functional poitlets, themes, layout templates,
hooks and web modules, plugins piovide a means of extending Lifeiay to be
able to do almost anything.
Portlets
Poitlets aie small web applications that iun in a poition of a web page. Te heait
of any poital implementation is its poitlets, because all of the functionality of a
2
liferay.com/marketplace
40 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
poital iesides in its poitlets. Lifeiays coie is a poitlet containei. Te containeis
job is to manage the poitals pages and to aggiegate the set of poitlets that aie to
appeai on any paiticulai page. Tis means the coie doesnt contain application
code. lnstead, all of the featuies and functionality of youi poital application
must ieside in its poitlets.

Tip: Lifeiay 4.4.2 and below suppoit the Poitlet 1.0 standaid
JSR-18. Lifeiay .0 and above suppoit the Poitlet 2.0 standaid
JSR-28. You cannot iun Poitlet 2.0 poitlets in Lifeiay 4.4.2,
but because the Poitlet 2.0 standaid is backwaids-compatible,
poitlets wiiuen to the 1.0 standaid will iun in Lifeiay .x and
above.
Poitlet applications, like seivlet applications, have become a Java standaid
which vaiious poital seivei vendois have implemented. Te JSR-18 standaid
denes the poitlet 1.0 specication and the JSR-28 standaid denes the poitlet
2.0 specication. A Java standaid poitlet should be deployable on any poitlet
containei which suppoits the standaid. Poitlets aie placed on the page in a
ceitain oidei by the end usei and aie seived up dynamically by the poital seivei.
Tis means ceitain givens that apply to seivlet-based piojects, such as contiol
ovei URLs oi access to the HttpServletRequest object, dont apply in poitlet
piojects, because the poital seivei geneiates these objects dynamically.
Poital applications come geneially in two avois 1) poitlets can be wiiuen
to piovide small amounts of functionality and then aggiegated by the poital
seivei into a laigei application oi 2) whole applications can be wiiuen to ieside
in only one oi a few poitlet windows. Te choice is up to those designing the
application. Te developei only has to woiiy about what happens inside of the
poitlet itself, the poital seivei handles building out the page as it is piesented
to the usei.
Most developeis nowadays like to use ceitain fiamewoiks to develop theii
applications, because those fiamewoiks piovide both functionality and stiuc-
tuie to a pioject. loi example, Stiuts enfoices the Model-View-Contiollei de-
sign pauein and piovides lots of functionality, such as custom tags and foim
validation, that make it easiei foi a developei to implement ceitain standaid
featuies. With Lifeiay, developeis aie fiee to use all of the leading fiame-
woiks in the Java EE space, including Stiuts, Spiing MVC and Java Seivei laces.
Tis allows developeis familiai with those fiamewoiks to moie easily imple-
ment poitlets and also facilitates the quick poiting of an application using those
fiamewoiks ovei to a poitlet implementation.
13.6. PLUGIN MANAGEMENT 40
Additionally, Lifeiay allows foi the consuming of PHP and Ruby applications
as poitlets so you do not need to be a Java developei in oidei to take advantage
of Lifeiays built-in featuies (such as usei management, sites, oiganizations,
page building and content management). You can also use sciipting languages
such as Gioovy if you wish. You can use the Plugins SDK to deploy youi PHP
oi Ruby application as a poitlet and it will iun seamlessly inside of Lifeiay. We
have plenty of examples of this, to see them, check out the Plugins SDK fiom
Lifeiays public code iepositoiy.
Does youi oiganization make use of any Enteipiise Planning (ERP) sofwaie
that exposes its data via web seivices` You could wiite a poitlet plugin foi
Lifeiay that can consume that data and display it as pait of a dashboaid page
foi youi useis. Do you subsciibe to a stock seivice` You could pull stock quotes
fiom that seivice and display them on youi page, instead of using Lifeiays
built-in Stocks poitlet. Do you have a need to combine the functionality of two
oi moie seivlet-based applications on one page` You could make them into
poitlet plugins and have Lifeiay display them in whatevei layout you want. Do
you have existing Stiuts, Spiing MVC oi JSl applications you want to integiate
with youi poital` lt is a stiaightfoiwaid task to migiate these applications into
Lifeiay, then they can take advantage of the layout, secuiity and administiation
infiastiuctuie that Lifeiay piovides.
Themes
Figure 13.15: Envision Theme fromLiferays Theme Repository
Temes aie hot deployable plugins which can completely tiansfoim the look
and feel of the poital. Most oiganizations have theii own look and feel standaids
which go acioss all of the web sites and web applications in the infiastiuctuie.
Lifeiay makes it possible foi a site designei to cieate a theme plugin which can
be installed, allowing foi the complete tiansfoimation of the poital to whatevei
look and feel is needed. Teie aie lots of available theme plugins on Lifeiays
web site and moie aie being added eveiy day. Tis makes it easiei foi those who
wish to develop themes foi Lifeiay, as you can now choose a theme which most
closely iesembles what you want to do and then customize it. Tis is much
408 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
easiei than staiting a theme fiom sciatch. You can leain moie about theme
development in Liferay in Action.
Figure 13.16: Murali Theme fromLiferays Theme Repository
Layout Templates
Layout Templates aie ways of choosing how youi poitlets will be aiianged on
a page. Tey make up the body of youi page, the laige aiea into which you
can diag and diop poitlets. Lifeiay Poital comes with seveial built-in layout
templates. lf you have a complex page layout (especially foi youi home page),
you may wish to cieate a custom layout template of youi own. Tis is coveied
in Liferay in Action.
Hook Plugins
Hook plugins weie intioduced with Lifeiay .2. As the name implies, they allow
hooking into Lifeiays coie functionality. Tis means they enable developeis
to oveiiide oi ieplace functionality that is in the coie of the system. You can
hook into the eventing system, model listeneis and poital piopeities. You can
also oveiiide Lifeiays coie JSPs with youi own. Hooks aie veiy poweiful and
have been designed to ieplace most of the ieasons foi using the extension en-
viionment with something that is easiei to use and hot deployable.
Web Plugins
Web plugins aie iegulai Java EE web modules designed to woik with Lifeiay.
Lifeiay suppoits integiation with vaiious Enteipiise Seivice Bus (ESB) imple-
mentations, as well as Single Sign-On implementations, woikow engines and
so on. Tese aie implemented as web modules used by Lifeiay poitlets to pio-
vide functionality.
13.6. PLUGIN MANAGEMENT 409
Installing Plugins fromRepositories
Figure 13.17: Plugins Installation Portlet Tab Default View
Lifeiay Poital has a section of the contiol panel called Plugins lnstallation,
which you can nd undei the Seivei heading. Tis section not only allows you
to see what plugins aie installed in youi poital, but also it enables you to iun
the seaich indexei on those poitlets that suppoit it and install new poitlets.
Use the dockbais Go to menu to select Control Panel. Undei the Seivei head-
ing, select Plugins Installation. You should now see the page which allows you
to conguie and install poitlets.
Te default view of the Plugins lnstallation page shows which plugins aie
alieady installed on the system and whethei oi not they aie active. Te Poitlet
Plugins tab allows you ieindex ceitain poitlets to impiove theii seaichability.
410 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Te Teme and Layout Template Plugins tabs display which poital ioles can
access them.
Figure 13.18: Plugins Installation Theme Tab Default View
lf you would like to see what plugins aie available, you can do so by clicking
the Install More buuon, wheie changes based on which tab you aie viewing.
Please note the machine iunning Lifeiay must have access to the lnteinet to
iead the Ocial and Community iepositoiies. lf the machine does not have
lnteinet access, you will need to download the plugins fiom the site and install
them manually. We will discuss how to do this latei in this chaptei.
lts easy to navigate fiom the initial page of the Plugin lnstallei to diei-
ent pages since the plugins aie listed alphabetically. You can also change the
numbei of items pei page and navigate to a specic page if you know wheie a
paiticulai plugin appeais in the list. Tis is a standaid featuie of Lifeiay and
you will see it in most of Lifeiays poitlets.
Afei you click the Install More buuon, a new view appeais. Tis view has
13.6. PLUGIN MANAGEMENT 411
Figure 13.19: Installing Plugins
multiple tabs, and by default, displays the Portlet Plugins tab. Note the list dis-
played is a list of all of the plugins available acioss all of the iepositoiies to
which the seivei is subsciibed. Above this is a seaich mechanism which allows
you to seaich foi plugins by theii name, by whethei oi not they aie installed, by
tag oi by which iepositoiy they belong to. To install a plugin, choose the plu-
gin by clicking on its name. loi example, if you want to use online web foims
on youi web site, you might want to install the Web loim poitlet. Tis poitlet
piovides a handy inteiface which allows you to cieate foims foi useis to ll out.
You can specify an addiess to which the iesults will be emailed.
lind the Web loim Poitlet in the list by seaiching foi it oi biowsing to it.
Once you have found it, click on its name. Anothei page will be displayed which
desciibes the poitlet plugin in moie detail. Below the desciiption is an Install
buuon. Click this buuon to install youi plugin.
Once you click Install, youi chosen plugin will automatically download and
412 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
be installed on youi instance of Lifeiay. lf you have the Lifeiay console open,
you can view the deployment as it happens. When it is nished, you should be
able to go back to the Add Application window and add youi new plugin to a
page in youi poital.
Te same pioceduie is used foi installing new Lifeiay themes, layout tem-
plates, hooks and web modules. lnstead of the Portlet Plugins tab, you would use
the appiopiiate tab foi the type of plugin you wish to install to view the list of
plugins of that type. loi themes, convenient thumbnails (plus a laigei veision
when you click on the details of a paiticulai theme) aie shown in the list.
Figure 13.20: Installing the Web FormPortlet
Afei clicking on the Install buuon foi a theme, the theme becomes available
on the Look and Feel tab of any page.
Installing Plugins Manually
lnstalling plugins manually is almost as easy as installing plugins via the Plugin
lnstallei. Teie aie seveial scenaiios in which you would need to install plugins
manually iathei than fiom Lifeiays iepositoiies
Youi seivei is iewalled without access to the lnteinet. Tis makes it im-
possible foi youi instance of Lifeiay to connect to the plugin iepositoiies.
You aie installing poitlets which you have eithei puichased fiom a ven-
doi, downloaded sepaiately oi developed youiself.
13.6. PLUGIN MANAGEMENT 413
loi secuiity ieasons, you do not want to allow poital administiatois to
install plugins fiom the lnteinet befoie they aie evaluated.
You can still use the contiol panel to install plugins that aie not available
fiom the online iepositoiies. Tis is by fai the easiest way to install plugins.
lf youi seivei is iewalled, you will not see any plugins displayed in the
Poitlet Plugins oi Teme Plugins tabs. lnstead, you will need to click the Upload
File tab. Tis gives you a simple inteiface foi uploading a .war le containing
a plugin to youi Lifeiay Poital.
Click the Browse buuon and navigate youi le system to nd the poitlet oi
theme .war you have downloaded. Te othei eld on the page is optional you
can specify youi own context foi deployment. lf you leave this eld blank, the
default context dened in the plugin (oi the .war le name itsell) will be used.
Tats all the infoimation the Plugin lnstallei needs in oidei to deploy youi
poitlet, theme, layout template, hook oi web module. Click the Install buuon
and youi plugin will be uploaded to the seivei and deployed. lf it is a poitlet,
you should see it in the Add Content window. lf it is a theme, it will be available
on the Look and Feel tab in the page denition.
Figure 13.21: Installing a Plugin Manually
lf you do not wish to use the Update Managei oi Plugin lnstallei to deploy
plugins, you can also deploy them at the opeiating system level. Te ist time
Lifeiay staits, it cieates a hot deploy foldei which is, by default, cieated inside
the Lifeiay Home foldei. Tis foldei geneially iesides one diiectoiy up fiom
wheie youi application seivei is installed, though it may be elsewheie depend-
ing on which application seivei you aie iunning. To nd out wheie the Lifeiay
Home foldei is foi youi application seivei, please see the section on youi seivei
414 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
in chaptei 1. Te ist time Lifeiay is launched, it will cieate a foldei stiuctuie in
Lifeiay Home to house vaiious conguiation and administiative data. One of
the foldeis it cieates is called deploy. lf you copy a poitlet oi theme plugin into
this foldei, Lifeiay will deploy it and make it available foi use just as though
youd installed it via the Plugin lnstallei in the contiol panel. ln fact, this is
what the Plugin lnstallei is doing behind the scenes.
You can change the defaults foi this diiectoiy stiuctuie so it is stoied any-
wheie you like by modifying the appiopiiate piopeities in youi portal-ext-
.properties le. Please see the above section on the portal-ext.proper-
ties le foi moie infoimation.
To have Lifeiay hot deploy a poitlet oi theme plugin, copy the plugin into
youi hot deploy foldei, which by default is in [Liferay Home]/deploy. lf you
aie watching the Lifeiay console, you should see messages like the following
16:11:47,616 INFO [PortletAutoDeployListener:71] Copying portlets for
/liferay-portal-6.0.4/deploy/weather-portlet-6.0.4.1.war
Expanding:
/liferay-portal-6.0.4/deploy/weather-portlet-6.0.4.1.war
into
/liferay-portal-6.0.4/tomcat-6.0.26/temp/20100729161147694
Copying 1 file to
/liferay-portal-6.0.4/tomcat-6.0.26/temp/20100729161147694/WEB-INF
Copying 1 file to
/liferay-portal-6.0.4/tomcat-6.0.26/temp/20100729161147694/WEB-INF/classes
Copying 1 file to
/liferay-portal-6.0.4/tomcat-6.0.26/temp/20100729161147694/WEB-INF/classes
Copying 1 file to
/liferay-portal-6.0.4/tomcat-6.0.26/temp/20100729161147694/META-INF
Copying 37 files to
/liferay-portal-6.0.4/tomcat-6.0.26/webapps/weather-portlet
Copying 1 file to
/liferay-portal-6.0.4/tomcat-6.0.26/webapps/weather-portlet
Deleting directory
/liferay-portal-6.0.4/tomcat-6.0.26/temp/20100729161147694
16:11:48,072 INFO [PortletAutoDeployListener:81] Portlets for
/liferay-portal-6.0.4/deploy/weather-portlet-6.0.4.1.war
copied successfully. Deployment will start in a few seconds.
Jul 29, 2010 4:11:50 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory weather-portlet
13.6. PLUGIN MANAGEMENT 41
16:11:50,585 INFO [PortletHotDeployListener:222] Registering portlets
for weather-portlet
\index{portlet}
16:11:50,784 INFO [PortletHotDeployListener:371] 1 portlet for
weather-portlet is available for use
Te available for use message means youi plugin was installed coiiectly and
is available foi use in the poital.
Plugin Troubleshooting
Sometimes plugins fail to install. Teie can be dieient ieasons foi installation
failuie based on seveial factois, including
Lifeiay conguiation
Te containei upon which Lifeiay is iunning
Changing the conguiation options in multiple places
How Lifeiay is being launched
You can ofen tell whethei oi not you have a plugin deployment pioblem
by looking at the Lifeiay seivei console. lf the hot deploy listenei iecognizes
the plugin, youll see a plugin copied successfully message. lf this message is
not followed up by an available for use message then you have an issue with
youi plugin deployment conguiation, piobably due to one of the factois listed
above.
Lets take a look at each of these factois.
Liferay Conguration Issues

Tip: Tis applies to Lifeiay veisions piioi to veision 4.3..


Lifeiay veisions above 4.3. aie able to auto detect the type of
seivei it is iunning on, which makes things a lot easiei. lf you aie
iunning a newei veision of Lifeiay, you can skip this section. lf
you aie upgiading fiom one of these veisions, continue ieading.
41 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Lifeiay by default comes as a bundle oi as a .war le. Tough eveiy eoit has
been made to make the .war le as geneiic as possible, sometimes the default
seuings aie inappiopiiate foi the containei upon which Lifeiay is iunning. Most
of these pioblems weie iesolved in Lifeiay 4.3. with the addition of code that
allows Lifeiay to deteimine which application seivei it is iunning on and adjust
the way it deploys plugins as a iesult. lf you have upgiaded fiom one of these
oldei veisions, you may still have seuings in youi portal.ext.properties
le that aie no longei needed. One of these seuings is the manual oveiiide of
the default value of auto.deploy.dest.dir.
ln veisions of Lifeiay piioi to 4.3., theie is a piopeity called auto.de-
ploy.dest.dir that denes the foldei wheie plugins aie deployed afei the
hot deploy utilities have nished piepaiing them. Tis foldei maps to a foldei
the containei denes as an auto-deploy oi a hot deploy foldei. By default in
oldei veisions of Lifeiay, this piopeity is set to ../webapps. Tis default value
woiks foi Tomcat containeis (if Tomcat has been launched fiom its bin foldei)
but will not woik foi othei containeis that dene theii hot deploy foldeis in a
dieient place. ln newei veisions of Lifeiay, this value is automatically set to
the default foi the application seivei upon which Lifeiay is iunning.
loi example, Glasssh denes the hot deploy foldei as a foldei called auto-
deploy inside of the domain foldei in which youi seivei is iunning. By default,
this is in <Glassfish Home>/domains/domain1/autodeploy. JBoss denes
the hot deploy foldei as a ioot foldei inside the paiticulai seivei conguiation
you aie using. By default, this is in <JBoss Home>/server/default/deploy.
WebLogic denes this foldei inside of the domain diiectoiy. By default, this is
in <Bea Home>/user_projects/domains/<domain name>/autodeploy.
Te best thing to do when upgiading to newei veisions of Lifeiay Poital is
to iemove this piopeity altogethei. lt is not needed, as the autodetection of the
containei handles the hot deploy location. lf, foi whatevei ieason, you need to
customize the location of the hot deploy foldei, follow the instiuctions below.
You will ist need to deteimine wheie the hot deploy foldei is foi the con-
tainei you aie iunning. Consult youi pioduct documentation foi this. Once
you have this value, theie aie two places in which you can set it in the por-
tal-ext.properties le and in the Plugin lnstallei poitlet.
To change this seuing in the portal-ext.properties le, biowse to wheie
Lifeiay was deployed in youi application seivei. lnside of this foldei should be
a WEB-INF/classes foldei. Heie you will nd the portal-ext.properties
le. Open this le in a text editoi and look foi the piopeity auto.deploy.-
dest.dir. lf it does not appeai in the le, you can add it. Te safest way to set
this piopeity, as we will see latei, is to dene the piopeity using an absolute
path fiom the ioot of youi le system to youi application seiveis hot deploy
13.6. PLUGIN MANAGEMENT 41
foldei. loi example, if you aie using Glasssh, and you have the seivei installed
in /java/glassfish, youi auto.deploy.dest.dir piopeity would look like
the following
auto.deploy.dest.dir=/java/glassfish/domains/domain1/autodeploy
Remembei, if you aie on a Windows system, use foiwaid slashes instead of
back slashes, like so
auto.deploy.dest.dir=C:/java/glassfish/domains/domain1/autodeploy
Save the le and then iestait youi containei. Now plugins should install
coiiectly.
lnstead of changing the hot deploy destination diiectoiy in youi portal-
ext.properties le, you can do it via the Plugin lnstallei. To change the
seuing this way, navigate to the Plugins lnstallation page of the contiol panel,
click the Install More buuon. Tis will biing you to the Plugin lnstallei page.
Next, click on the Conguration tab of the Plugin lnstallei page. Teie aie a
numbei of seuings you can change on this tab, including the default foldeis foi
hot deploy, wheie Lifeiay should look foi plugin iepositoiies and so on.
Te seuing to change is the eld labeled Destination Directory. Change this
to the full path to youi containeis auto deploy foldei fiom the ioot of youi le
system. When you aie nished, click the Save buuon at the bouom of the foim.
Te seuing will now take eect without youi having to iestait youi containei.
Note the seuing in the contiol panel oveiiides the seuing in the piopeities le.
lf you aie having hot deploy tiouble in Lifeiay veisions 4.3. and gieatei, it
is possible the administiatoi of youi application seivei has changed the default
foldei foi auto deploy in youi application seivei. ln this case, you would want
to set auto.deploy.dest.dir to the customized foldei location as you would
with oldei veisions of Lifeiay. ln Lifeiay 4.3. and gieatei, this seuing still exists
but is blank. Add the piopeity to youi portal-ext.properties le and set
its value to the fully qualied path to the auto deploy foldei conguied in youi
application seivei.
Deploy Issues for Specic Containers
Some containeis, such as WebSpheie, dont have a hot deploy featuie. Unfoi-
tunately, these containeis do not woik with Lifeiays hot deploy system. But
this does not mean you cannot install plugins on these containeis. You can de-
ploy plugins manually using the application seiveis deployment tools. Lifeiay
is able to pick up the poitlet plugins once they get deployed to the containei
418 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Figure 13.22: Changing the Hot Deploy Destination Directory
13.6. PLUGIN MANAGEMENT 419
manually, especially if you add it to the same Enteipiise Application pioject
that was cieated foi Lifeiay.
When Lifeiay hot deploys poitlet and theme .war les, it sometimes makes
modications to those les iight befoie deployment. ln oidei to successfully
deploy plugins using an application seivei vendois tools, you will want to iun
youi plugins thiough this piocess befoie you auempt to deploy them.
Navigate back to the Conguration tab of the Plugin lnstallei. Entei the loca-
tion you would like plugin .war les to be copied to afei they aie piocessed by
Lifeiays plugin installei piocess into the Destination Directory eld. You will
use this as a staging diiectoiy foi youi plugins befoie you install themmanually
with youi seiveis deployment tools. When you aie nished, click Save.
Now you can deploy plugins using the Plugin lnstallei poitlet oi by diop-
ping .war les into youi auto deploy diiectoiy. Lifeiay will pick up the les,
modify them and then copy the iesult into the destination diiectoiy you have
conguied. You may then deploy them fiom heie to youi application seivei.
Example: WebSphere Application Server
1. lf you dont have one alieady, cieate a portal-ext.properties le in the
Lifeiay Home foldei of youi Lifeiay installation. Add the following diiective
to it
auto.deploy.dest.diiSlifeiay.home/webspheie-deploy
2. Cieate a foldei called websphere-deploy inside youi $LIFERAY_HOME foldei.
Tis is the foldei wheie the Lucene index, Jackiabbit cong and deploy fold-
eis aie.
3. Make suie the web.xml le inside the plugin you want to install has the
following context paiametei in it
com.ibm.webspheie.poitletcontainei.PoitletDeploymentEnabled
false
Lifeiay veisions .2.2 and highei will automatically inject this into the web.xml
le on WebSpheie containeis.
4. Te WebSpheie deploy occuis in two steps. You will ist use Lifeiays tools
to pie-deploy the le and then use WebSpheies tools to do the actual de-
ployment. Tis is because Lifeiay makes deployment-time modications to
the plugins iight befoie they aie actually deployed to the application seivei.
loi othei application seiveis, this can usually be done in one step, because
420 CHAPTER 13. LEVERAGING THE LIFERAY MARKETPLACE
Lifeiay can make the modications and then copy the iesulting .war le into
an autodeploy foldei to have it actually deployed. Because WebSpheie does
not have an autodeploy featuie, we need to sepaiate these two steps.
. Deploy youi .wai le using Lifeiays Plugin lnstallei oi by copying it into
$LIFERAY_HOME/deploy. Lifeiay will make its modications, and because
we changed the auto.deploy.dest.dir in the ist step, it will copy the
iesulting .war le into $LIFERAY_HOME/websphere-deploy. You will see
a copied successfully message in the log.
. Use WebSpheies tools to deploy the .war le. Make the context ioot foi the
.war le equal to the le name (i.e., /my-first-portlet). Once the .war
le is deployed, save it to the mastei conguiation.
. Go back to the Applications Enterprise Applications scieen in the Web-
Spheie Admin Console. You will see youi poitlet is deployed but not yet
staited. Stait it.
8. Lifeiay will immediately iecognize the poitlet has been deployed and iegistei
it. Te poitlet will be automatically staited and iegisteied upon subsequent
iestaits of WebSpheie.
Expeiienced WebSpheie system administiatois can fuithei automate this
by wiiting a sciipt which watches the websphere-deploy diiectoiy and uses
wsadmin commands to then deploy plugins automatically.
Changing the Conguration Options in Multiple Places
Sometimes, especially duiing development when seveial people have adminis-
tiative access to the seivei at the same time, the auto deploy foldei location may
inadveitently be customized in both the portal-ext.properties le and in
the contiol panel. lf this happens, the value in the contiol panel takes piece-
dence ovei the value in the piopeities le. lf you go into the contiol panel and
change the value to the coiiect seuing, plugin deployment will stait woiking
again.
13.7 Summary
ln this chaptei, we intioduced Lifeiay Maiketplace, youi one-stop shop foi
biowsing and downloading Lifeiay-compatible applications. We looked at how
to biowse, puichase, download, and install apps. You can do this eithei thiough
13.7. SUMMARY 421
lifeiay.com/maiketplace oi thiough Lifeiay Poitals contiol panel. When you
puichase apps, you can do so via youi peisonal account oi on youi companys
behalf. loi infoimation about developing and uploading apps to Lifeiay Mai-
ketplace, please see the Maiketplace chaptei of the Lifeiay Developei guide at
hup//www.lifeiay.com/maiketplace/developei-guide.
Afei discussing Lifeiay Maiketplace, we discussed geneial plugin manage-
ment. We coveied Lifeiay poitlet plugins as well as layout, theme, hook, Ext,
and web plugins. linally, we looked at how to manually deploy plugins to Lif-
eiay and discussed some conguiation issues.
Cu~v1rv 14
lNs1~ii~1ioN ~Nu Sr1Uv
Lifeiay Poital is one of the most exible applications on the maiket today with
iegaid to application seivei enviionments. You can install Lifeiay Poital on
eveiything fiom a shaied Tomcat installation to a multi-node clustei iunning a
commeicial application seivei and on eveiything in between. ln fact, Lifeiay is
used successfully in all of these scenaiios eveiy day.
Youll nd that because Lifeiay is extiemely exible in its deployment op-
tions, it is easy to install as well. lf you alieady have an application seivei,
you can use the tools foi deployment that came with youi application seivei. lf
you dont have an application seivei, Lifeiay piovides seveial application seivei
bundles fiom which to choose. Tese aie veiy easy to install and with a small
amount of conguiation can be made into pioduction-ieady systems.
14.1 Editions of Liferay
Lifeiay ships in two dieient editions Lifeiay Poital Community Edition (CE)
and Lifeiay Poital Enteipiise Edition (EE). CE is the same Lifeiay Poital that
has been available foi yeais fiequently updated and buisting with the latest
featuies, the Community Edition of Lifeiay Poital is oeied foi fiee undei the
Lessei GNU public license, an open souice license. Tis license gives you the
422
14.1. EDITIONS OF LIFERAY 423
exibility to link Lifeiay with youi own code in youi poitlet, theme, hook, lay-
out, Ext oi web plugins, no mauei what license you use foi youi code. lf, how-
evei, you modify Lifeiay diiectly, those modications need to be ieleased as
open souice. Tis is ieally the best of both woilds you have the fieedom to
do what you want with youi code if you use plugins, but if you modify Lifeiay
diiectly, the community ieceives the benets of any enhancements that youve
made.
Lifeiay Poital EE is a suppoited veision of Lifeiay Poital foi the enteipiise.
Haidened foi secuiity and designed to be iock solid stable, EE is oeied with a
subsciiption and suppoit package, allowing oiganizations to build theii poitals
on a stable veision of the pioduct that is oeied ovei an extended peiiod of time.
Because the ielease cycle foi EE is longei than that foi CE, each enteipiise ie-
lease is suppoited foi foui yeais. All bug xes in Lifeiay Poital aie backpoited to
youi veision of Lifeiay foi the duiation of youi subsciiption. Tis gives oigani-
zations the peace of mind that comes fiom knowing that theii Lifeiay-poweied
web sites aie stable and will iun foi yeais to come, enabling them to build theii
sites on a pioven, stable platfoim. Additionally, Lifeiay oeis tiaining and con-
sulting on the Enteipiise Edition to ensuie long-teim suppoit and stability foi
oui clients.
Liferays Versioning Schema
Lifeiays ielease piocess follows a piesciibed stiuctuie that is consistent fiom
one ielease to the next. Each ielease has a specic numbei sequence auached to
it signifying the type of ielease it is, whethei its a majoi, minoi oi maintenance
ielease. Each ielease also has a teim auached to it to indicate its intended level
of quality.
EE subsciibeis have access to additional maintenance ieleases, along with
specic Fix Packs and Hot Fixes that make applying updates to pioduction envi-
ionments safei and fastei.
Lets stait with an explanation of Lifeiays veision stiuctuie. Lifeiay vei-
sions aie oiganized in a stiaightfoiwaid numeiical system consisting of a thiee
digit numbei. loi example, .1.2. Tese numbeis iepiesent the type of the ie-
lease Majoi.Minoi.Maintenance.
Major Release
A change in the ist digit of the veision (e.g., .x to .x) is a majoi ielease. Tis
means that
424 CHAPTER 14. INSTALLATION AND SETUP
Teie aie majoi changes in functionality oi new functionality based on
high demand.
Teie aie aichitectuial changes, changes to APls (as pait of the depieca-
tion piocess), oi changes to inteinal schema.
Minor Release
A change to the second digit of the veision scheme (e.g., .0 to .1) is a minoi
ielease. Tis means that
Teie aie new featuies and bug xes fiom piioi ieleases.
Customizations may be aected when installing.
Customeis should leveiage the upgiade tools and documentation.
Maintenance Release
A change in the thiid digit of the veision scheme (e.g, .1. to .1.) is a main-
tenance ielease. Tis means that
Each maintenance ielease piovides an impioved level of secuiity and ie-
liability.
Customizations aie geneially safe, but we iecommend doing a ieview.
No new featuies aie included.
Tese iules aie ielaxed when a minoi oi majoi ielease is still in beta quality.
Now lets delve into the evolution of veisions.
Release Process
Each veision of Lifeiay has a suiname that species the expected quality of
that ielease. Tis is needed because pie-ieleases of Lifeiay look veiy much like
maintenance ieleases when viewed solely thiough theii veision numbeis. Te
suiname in geneial ieplaces the thiid digit in the veision, but is visible thiough
the logs and administiation Uls. Heie is a desciiption of each suiname and what
it means
14.1. EDITIONS OF LIFERAY 42
Milestone and Beta: (.2 M1, .2 B1, .2 B2, ) Teie can be zeio oi moie
of these types within each minoi oi majoi ielease. Tese ieleases aie
meant foi testing and to piovide Lifeiay feedback thiough the beta testing
categoiy in the foiums. Teie will likely be majoi changes in milestone
ieleases, but beta ieleases aie consideied featuie complete and should
have only bug xes.
Release Candidates: (.1 RC1, .1 RC2) Teie can be zeio, one, oi moie of
these iight afei the beta ieleases. Tese ieleases appeai neai the end of
the ielease piocess and aie candidates foi ielease. As such, they should
have minimal to no bugs, but because they aie veiy new, some minoi
bugs may have slipped by.
General Availability: (.1 GA1, .1 GA2, .) Teie can be one oi moie of
these ieleases. A Geneial Availability ielease is a ie-label of the last ie-
lease candidate, based on inteinal testing and feedback fiom beta testeis.
Tese ieleases aie stable and aie made available via Lifeiays Downloads
page foi CE and on the Customei Poital foi EE.
Comments and Recommendations
At this point you might be asking youiself questions like, which veision should
l use` What if l was using a pievious veision` Will the update to a new main-
tenance ielease cost a lot` Heie aie some comments and iecommendations to
addiess these questions.
When staiting a new pioject, always use the latest stable veision avail-
able, that is, the latest available GA. At the time of wiiting, the most
iecent veision is Lifeiay CE .1 GA2 (.1.1) oi Lifeiay EE .1 GA2 (.1.20).
Always update to the latest maintenance ielease available foi the func-
tional veision (majoi oi minoi) that you aie using. loi example, if you
staited youi pioject with Lifeiay .1.0 GA1, it is iecommended that you
switch to GA2 to take advantage of bug xes and impiovements. lf you
have a subsciiption, you can benet fiom the xes fastei by iequesting
x packs and hot xes fiom the suppoit team.
You aie always welcome to use any pieview, beta oi ielease candidate.
ln fact, thats why they existso as many people as possible stait using it
and piovide us theii feedback. Please note, we do not iecommend using
pie-ieleases (milestones, betas, oi ielease candidates) in pioduction. You
42 CHAPTER 14. INSTALLATION AND SETUP
may not want to use these ieleases even duiing development if you have
tight deadlines, since you may nd ioad blocks.
Plugins that woik in any GA oi x pack veision will woik in any latei
maintenance ielease. Tat is, a plugin developed foi Lifeiay .1 GA1 will
also woik in Lifeiay GA2 oi a GA2 x pack.
loi moie details on updating Lifeiay Poital, see Upgiading Lifeiay in chaptei
1.
Lifeiay Poital is a veiy exible application that iuns well on seveial dieient
seivei enviionments. lts simple to install and comes in eithei a Community
Edition oi an Enteipiise Edition, depending on youi needs. Lifeiay follows a
systematic veisioning system that makes it easy to keep cuiient with the latest
updates. Te stiength of the Lifeiay community helps detect potential issues
eaily that aie then iepoited thiough the foiums and aie latei xed in a seiies of
maintenance ieleases.
Now lets leain about Lifeiay bundles.
14.2 Obtaining Liferay Portal
Te CE veision of Lifeiay is fieely downloadable fiom oui web site.
1
Click
the Downloads link at the top of the page and you aie piesented with multiple
options foi geuing a copy of Lifeiay, including oui convenient bundles oi a .war
package foi installation on youi application seivei of choice.
Te EE veision of Lifeiay is piovided to you as a iesult of youi suppoit sub-
sciiption. Eveiything you need is piovided in the Customei Poital, including
download links that allow you to obtain a copy of a Lifeiay bundle oi a .war
package foi installation on youi application seivei of choice.
So what is a bundle anyway` A bundle is an open souice application seivei
with Lifeiay pieinstalled. Tis is the most convenient way to install Lifeiay.
Lifeiay is bundled with a numbei of open souice application seiveis, all you
need to do is choose the one that best ts youi needs. lf you dont cuiiently
have an application seivei, you may want to stait with the Tomcat bundle, as
Tomcat is one of the smallest and most stiaightfoiwaid bundles to conguie. lf
you have an open souice application seivei piefeience, choose the seivei you
piefei fiom the available Lifeiay Poital bundles. All of the bundles ship with a
Java Runtime Enviionment foi Windows, if you aie using a dieient opeiating
1
hup//www.lifeiay.com
14.3. INSTALLING A BUNDLE 42
system, you will need to have a JDK (Java Development Kit) installed piioi to
launching Lifeiay.
Please note that Lifeiay is not able to piovide application seivei bundles foi
piopiietaiy application seiveis such as WebLogic oi WebSpheie, because the li-
censes foi these seiveis dont allow foi iedistiibution. Lifeiay Poital, howevei,
iuns just as well on these application seiveis as it does on open souice appli-
cation seiveis. A .war le and dependency .jars aie piovided foi piopiietaiy
application seiveis and youll need to follow a pioceduie to install Lifeiay on
them.
liist well go ovei installing Lifeiay fiom a bundle and afei this well pio-
vide instiuctions foi installing Lifeiay manually on all the application seiveis it
suppoits.
14.3 Installing a bundle
Lifeiay bundles contain the same diiectoiy stiuctuie iegaidless of application
seivei. Te top-level foldei is named foi the ielease of Lifeiay. Tis foldei is
called Liferay Home and we iefei to it thoughout this documentation.
Figure 14.1: Bundle
directory structure
lnside this foldei, theie aie foldeis foi vaiious
puiposes
Data: Tis foldei is used to stoie the embedded
HSQL database which the bundles use, as well as
the conguiation and data foi the Jackiabbit JSR-10
content iepositoiy and the Lucene seaich index.
Deploy: Plugins which you wish to deploy to Lif-
eiay can be copied into this foldei. lt is also used
by Lifeiay Maiketplace and Lifeiays giaphical plu-
gin installei utility.
[Application Server]: Te name of this foldei is
dieient depending on which bundle you have downloaded. Tis foldei con-
tains the application seivei in which Lifeiay has been installed.
lnstalling a bundle is as easy as uncompiessing the aichive, copying a JDBC
diivei and then staiting the application seivei. Lets use the Tomcat bundle as
an example
1. Unzip the bundle to a location of youi choice.
2. lf youie seuing up Lifeiay to be an actual seivei, copy youi databases JDBC
diivei .jar to [Tomcat]/lib/ext (see the setup wizaid section below). lf
youie seuing up Lifeiay foi demo puiposes, you can skip this step.
428 CHAPTER 14. INSTALLATION AND SETUP
3. Stait Tomcat in the same way as you would if you had downloaded it manu-
ally. Tomcat is launched by way of a sciipt which is found in its bin foldei. lf
you diop to a command piompt and go to this foldei, you can launch Tomcat
via the following command on Windows
staitup
oi the following command on Linux/Mac/Unix
./startup.sh
Te Lifeiay/Tomcat bundle then launches. lf you aie on Windows, anothei
command piompt window appeais with Tomcats console in it. lf you aie on
Linux, you can see the Tomcat console by issuing the following command
tail -f ../logs/catalina.out
Once Tomcat has completed its stait up, it automatically launches a web
biowsei that displays Lifeiays setup wizaid. lf foi some ieason youi biowsei
doesnt load the wizaid, launch youi biowsei and go to hup//localhost8080.
Lifeiay CE ships with a sample web site that showcases Lifeiays featuies. lt
contains many links desciibing the featuies of Lifeiay that well covei in detail
thioughout this book.
lf youie installing Lifeiay on youi own machine to exploie its featuies, you
likely want to leave the sample site theie so you can examine it. lf, howevei,
youie installing Lifeiay on youi seivei to iun youi own site, its best to stait
with a clean system. Befoie iunning the setup wizaid, you should iemove the
sample data fiom youi Lifeiay installation. You must do this befoie iunning
the setup wizaid to get a clean database, and its as simple as undeploying the
applications that install the sample data.
Teie aie two applications included in the bundle that you need to iemove
iesouices-impoitei-web
welcome-theme
To iemove them, all you have to do is undeploy them. Te method foi doing
this dieis by application seivei and that, of couise, depends on the bundle you
have chosen. loi example, on Tomcat you delete the application foldeis fiom
the [Tomcat Home]/webapps foldei. On Glasssh, you use the administiative
console to undeploy them.
lf you foiget to undeploy the sample applications befoie you iun thiough
the setup wizaid and connect Lifeiay to youi ieal database, the sample data is
14.4. APP SERVERS 429
cieated in youi database, and you wont have a clean installation. Make suie
you get the sample data undeployed befoie seuing up youi seivei.
lf youie using Lifeiay EE, you dont have the sample site so you dont need
to woiiy about this. Te next step is to iun thiough the setup wizaid, which
well covei below.
As you can see, bundles aie the easiest way to get staited with Lifeiay. Tey
come pie-conguied with a iunning Lifeiay instance that can be used immedi-
ately to exploie all of the things that Lifeiay can do. Bundles aie the fastest way
to cieate full pioduction-ieady Lifeiay installations. lf youie using a bundle,
skip to the section on the setup wizaid below to continue youi installation.
Of couise, its not always possible to use a bundle. You may alieady have
an application seivei upon which you want to install Lifeiay. Te bulk of this
chaptei desciibes howto install Lifeiay on all the application seiveis it suppoits,
both open souice and piopiietaiy.
14.4 App servers
When it comes time to install Lifeiay Poital on youi seivei, youll nd its easiest
to do this by staiting with a bundle. But many enteipiises cant do that. Teie
may be an existing infiastiuctuie into which youie installing Lifeiay oi you
may have standaidized on a paiticulai application seivei. Youll be happy to
know that Lifeiay Poital has been designed to woik well with all the leading
application seiveis and that its easy and stiaightfoiwaid to install. But befoie
we get staited, we need to go ovei a few concepts, namely, the Lifeiay Home
foldei, databases and Lifeiays main conguiation le. Tese weie touched on
in the section on bundles above but well look at them in moie detail now.
Liferay Home
Lifeiay Poital uses a special foldei dened as Liferay Home. Tis foldei is one
foldei highei than the location of the application seivei itself. Tis is why the
bundles place the application seivei one foldei in fiom the bundles ioot foldei.
lf Lifeiay is unable to cieate the iesouices it needs in this foldei oi if it nds
itself iunning on ceitain application seiveis, it cieates a foldei called liferay in
the home foldei of the usei lD that is iunning Lifeiay and that becomes Lifeiay
Home.
As desciibed above in the Bundles section, the home foldei is veiy impoitant
to the opeiation of Lifeiay. Te afoiementioned foldeis (data and deploy) aie
430 CHAPTER 14. INSTALLATION AND SETUP
cieated theie and you can also put a special conguiation le called portal-
ext.properties theie. Tis le is fully documented in chaptei 20, a iefeience
foi Lifeiay piopeities.

Note: To use database piopeities fiom a


portal-ext.properties le you must disable the Setup
Wizaid by specifying setup.wizard.enabled=false in that
portal-ext.properties. Also, note that piopeity values
in portal-setup-wizard.properties (the le cieated in
Lifeiay Home by the Setup Wizaid) oveiiide piopeity values in
portal-ext.properties.
Lets move on to examining the database.
Liferays database
As stated above, if you cieate youi database and giant a usei lD full access to it,
Lifeiay can use that usei lD to cieate its indexes and tables automatically. Tis
is the iecommended way to set up Lifeiay, as it allows you to take advantage
of Lifeiays ability to automatically maintain its database duiing upgiades oi
thiough vaiious plugin installs which may cieate tables of theii own. lt is by
fai the best way to set up youi Lifeiay installation.
lf youll be seuing up Lifeiays database with the iecommended peimissions,
you can skip to the next section.

Note: Tis is not the iecommended set up foi Lifeiay installa-


tions but is documented heie so enteipiises with moie iestiictive
standaids can install Lifeiay with moie stiict but suboptimal
database seuings. lf its at all possible, Lifeiay iecommends that
you use the automatic method as documented above instead of
the pioceduie outlined below.
Even though Lifeiay can cieate its database automatically, some enteipiises
piefei not to allow the usei lD conguied in an application seivei to have the
peimissions ovei the database necessaiy foi Lifeiay and its plugins to maintain
theii tables. loi these oiganizations, Select, lnseit, Update and Delete aie the
only peimissions allowed so we will go ovei how to set up the database manu-
ally. lf youi oiganization is willing to giant the Lifeiay usei lD peimissions to
14.4. APP SERVERS 431
cieate and diop tables in the database and this is the iecommended congu-
iation by all means, use the iecommended conguiation.
Cieating the database is simple giant the lD Lifeiay uses to access the
database full iights to do anything to the database. Ten install Lifeiay and
have it cieate the database. Once the database is cieated, iemove the peimis-
sions foi cieating tables and diopping tables fiom the usei lD.
Teie aie some caveats to iunning Lifeiay like this. Many Lifeiay plugins
cieate new tables when theyie deployed. ln addition to this, Lifeiay has an
automatic database upgiade function which iuns when the veision of Lifeiay
is upgiaded to a new ielease. lf the usei lD that accesses the database doesnt
have enough iights to cieate/modify/diop tables in the database, you must giant
those iights to the lD befoie you deploy one of these plugins oi stait youi up-
giaded Lifeiay foi the ist time. Once the tables aie cieated oi the upgiade is
complete, you can iemove those iights until the next deploy oi upgiade. Ad-
ditionally, youi developeis may cieate plugins that need to cieate theii own
tables. Tese aie just like Lifeiays plugins that do the same thing and they can-
not be installed if Lifeiay cant cieate these tables automatically. lf you wish to
install these plugins, you will need to giant iights to cieate tables in the database
befoie you auempt to install them.
Once you have youi database ieady, you can install Lifeiay on youi seivei.
Liferay installation overview
Befoie we begin, its impoitant to go ovei the vaiious facets of the installation.
Tey aie
1. Cieate youi database (see above).
2. Deteimine whethei you want to use the Lifeiay managed data souice oi a
data souice managed by youi application seivei. Te Lifeiay managed data
souice is iecommended.
3. Gathei ciedentials foi sending email notications to useis. Lifeiay suppoits
a JNDl mail session as well as its built-in mail session.
4. lnstall Lifeiay accoiding to the instiuctions foi youi application seivei (see
below).
. Cieate a portal-ext.properties le in the Lifeiay Home foldei. Tis is a
simple text piopeities le that youll use to oveiiide Lifeiays default piop-
eities (see below). Tis is wheie youll place the mail session conguiation
ciedentials you collected in step 3.
432 CHAPTER 14. INSTALLATION AND SETUP
Te easiest way to install Lifeiay is to set up youi database and then follow
the instiuctions foi youi application seivei. Tis method uses the setup wizaid
to cieate a woiking conguiation. Well go thiough the steps in oidei, so ist
well look at the options foi data souices.
Using data sources
Lifeiay comes bundled with its own built-in data souice. lts conguied by a
numbei of piopeities which aie set in a piopeities le. By default, the setup
wizaid asks you foi the necessaiy values and cieates a conguiation le that
uses the built-in data souice to connect to the database.
Lifeiay always iecommends that you use the built-in data souice. Some-
times, howevei, oiganizations piefei to use the data souice piovided by theii
application seivei of choice. ln this instance, a JNDl lookup piovides a han-
dle to the data souice and the application seivei manages the connection pools.
Lifeiay suppoits using youi application seiveis data souice if you wish to do
that.
To do this, youll need to cieate youi own conguiation le and skip the
setup wizaid. Since youd be cieating this le aer the wizaid anyway, this
isnt such a big deal.
Since mail sessions aie conguied in a similai way to data souices, well look
at them next.
Using mail sessions
Lifeiays default conguiation looks foi a mail seivei on the same machine on
which Lifeiays iunning and it tiies to send mail via SMTP to this seivei. lf this
is not youi conguiation, youll need to modify Lifeiays defaults. To do this,
youll use a portal-ext.properties le (see below).
ln a similai fashion to databases, you have two ways to conguie youi mail
seivei
Use youi application seiveis mail session.
Use the built-in mail session.
To use youi application seiveis mail session, you must cieate it in youi ap-
plication seivei and it should point to youi mail seivei. Once youve done that,
youie ieady to point Lifeiay to it. You can do this thiough the conguiation
le oi thiough Lifeiays contiol panel afei its been installed.
14.4. APP SERVERS 433
Lets look next at this conguiation le and, if youie choosing not to use
the setup wizaid, show you how to get Lifeiay connected to youi database and
youi mail seivei.
The portal-ext.properties le
Lifeiays piopeities les diei fiom the conguiation les of most othei piod-
ucts in that changing the default conguiation le is discouiaged. ln fact, the
le that contains all the defaults is stoied inside of a .jar le, making it moie
dicult to customize. Why is it set up this way` Because Lifeiay uses the
concept of overriding the defaults in a sepaiate le, iathei than going in and
customizing the default conguiation le. You put only the seuings you want
to customize in youi own conguiation le and then you have a le that con-
tains only the seuings you need. Tis makes it fai easiei to deteimine whethei a
paiticulai seuing has been customized and it makes the seuings moie poitable
acioss dieient installations of Lifeiay.
Te default conguiation le is called portal.properties and it iesides
inside of the portal-impl.jar le. Tis .jar le is in Lifeiay Poitals WEB-
INF/lib foldei. Te le used to oveiiide the conguiation manually is portal-
ext.properties.
Complicating maueis, the setup wizaid cieates a le called portal-setup-
wizard.properties. Tis le peifoims the same function as portal-ext.pro-
perties, and you can use it in place of that le if you wish. Te portal-ext.pro-
perties le is iead befoie the portal-setup-wizard.properties file, so
if you have both les in youi conguiation, note that the seuings in the setup
wizaid le oveiiide the ones in portal-ext.properties.
Tis le should be cieated in youi Lifeiay Home foldei. Youll use this le
thioughout this book to change many of Lifeiays seuings. An exhaustive list
of the conguiable piopeities is piovided in chaptei 20.

Warning: Te conguiation you choose in the setup wiz-


aid is saved in a portal-setup-wizard.properties le in
youi Lifeiay Home diiectoiy. ln the setup wizaid, howevei,
if you specify a dieient Lifeiay Home diiectoiy than the de-
fault, the portal-setup-wizard.properties le thats saved
theie will not be iead upon iestaiting youi seivei. To have Lif-
eiay iead youi portal-setup-wizard.properties le, cieate
a portal-ext.properties le in youi new Lifeiay Home diiectoiy and
434 CHAPTER 14. INSTALLATION AND SETUP

add the following line to it, wheie ${liferay.home} is the new Lifeiay
Home diiectoiy that you chose
include-and-override=${liferay.home}/portal-setup-wizard.properties
Without this woikaiound, Lifeiay will not iead the
portal-setup-wizard.properties le with youi saved conguia-
tion when you iestait youi seivei and youll see the setup wizaid again.
You now have all the backgiound infoimation you need. Next you need
to make youi decision will you use Lifeiays built-in data souice, oi the one
piovided by youi application seivei` lf youie planning to use the one piovided
by youi seivei, you cant use Lifeiays installation wizaid, and youll have to
follow the instiuctions in the section below titled Manual Conguiation.
ln eithei case, youi next step is to install Lifeiay onto youi application seivei.
Once this is done, if youie using the iecommended built-in data souice, you can
use the setup wizaid, which well covei next.
14.5 Using Liferays setup wizard
To make it easy to conguie Lifeiay optimally foi youi use, the ist thing you
see when biowsing to youi newly installed Lifeiay bundle is a setup wizaid.
Tis gives you a convenient way to conguie Lifeiay foi youi puiposes.

Te wizaid is an extiemely helpful tool, especially if youie


seuing up Lifeiay foi the ist time oi cieating a completely fiesh
poital instance. lf youie a Lifeiay veteian and you alieady have
youi database infoimation and vaiious piopeities set up, you can
skip the wizaid by adding this line to youi portal-ext.properties
le
setup.wizard.enabled=false
Teie aie thiee sections of the wizaid the poital, the adminstiatoi and the
database. loi the poital, you need to supply the following infoimation
Portal Name: the name of the web site youie poweiing with Lifeiay. ln this
book, well build a social netwoik foi youi nose. Tis site is called Nosestei so
weve supplied Nosester in the scieenshot below.
14.5. USING LIFERAYS SETUP WIZARD 43
Default Language: choose the default locale wheie youi site iesides.
loi the adminstiatoi, you need to supply the following infoimation
First Name: the ist name of the usei that has the administiatoi account.
Last Name: the last name of the usei that has the administiatoi account.
Email: the email addiess of the usei that has the administiatoi account.
Figure 14.2: Supply the information for your site and your sites
administrative account in the setup wizard.
Lifeiay suppoits just about all the leading databases today
DB2
lngies
MySQL
Oiacle
PostgieSQL
SQL Seivei
43 CHAPTER 14. INSTALLATION AND SETUP
Sybase
ln addition to these, Lifeiay also suppoits a fewembedded databases that aie
designed foi development. We havent listed these heie because youie seuing
up a pioduction Lifeiay seivei and you shouldnt use an embedded database
with a pioduction box.
Befoie you ll out the database section of Lifeiays setup wizaid, you should
alieady have cieated a database foi Lifeiay to use. Tis database must have
UTl-8 as its chaiactei set, because Lifeiay is an inteinationalized application
and needs the UTl-8 chaiactei set to display text in many dieient languages.
Check the documentation foi youi database to see how to do this.
Once you have youi database cieated, cieate a usei that can do anything
to the database, including cieate and diop tables. lts impoitant that this usei
has complete iights ovei the Lifeiay database, because Lifeiay manages its own
tables. Once you have youi database and the ciedentials foi this usei, you can
continue.
Open the Database section of the wizaid. liom the select box, choose youi
database. Youll see a foim which lets you specify the URL to the database,
the diivei class and the usei ciedentials (see below). Most of this is lled out
alieady, all you should need to do is supply the name of youi database and the
seivei its iunning on, as well as the usei ciedentials.
Once youve lled out the foim, click Finish Conguration. Youll see a mes-
sage stating that Lifeiay is being installed as it cieates the tables and data it
needs in its database. When its nished, it tells you the location of the cong-
uiation le (portal-setup-wizard.properties) wheie it saved all of youi
seuings. liom heie, you can go to youi home page.

ln Lifeiay .1 GA2 (both .1.1 CE and .1.20 EE), the admin


usei testlifeiay.com is cieated by the setup wizaid even when
a dieient usei is specied. Tis means that two admin useis aie
cieated testlifeiay.com and the specied usei. Unless youie
just installing Lifeiay foi testing puiposes, you should deactivate
the testlifeiay.com usei afei youi database has been cieated.
Congiatulations' Youve just installed Lifeiay Poital' Te next thing you
need to do is set up youi mail conguiation, so Lifeiay can send email notica-
tions to useis. Tis is coveied in the Manual Conguiation section below.
14.6. MANUAL CONFIGURATION 43
Figure 14.3: Fill out the information for your database. Weve chosen
MySQL in this example and have created a database called nosester to hold
our Liferay data.
14.6 Manual Conguration
You dont have to use the setup wizaid to conguie Lifeiay. Te setup wiz-
aid behind the scenes cieates a conguiation le that you can cieate manually.
Cieate a text le called portal-ext.properties in youi Lifeiay Home foldei.
Tis le oveiiides default piopeities that come with Lifeiay. Te ist seuing
youll oveiiide is the default conguiation that points Lifeiay to the embedded
HSQL database.
As stated above, theie aie two ways to set up the connection
Use the built-in connection pool.
Use youi application seiveis connection pool.
Use the setup wizaid if youie using the built-in connection pool. lf you
want to use youi application seiveis pool, continue with this pioceduie.
lf you want to use youi application seiveis connection pool, you will have
to cieate one in youi application seivei that points to youi database. lt should
438 CHAPTER 14. INSTALLATION AND SETUP
be called jdbc/LiferayPool. To cause Lifeiay to use this connection pool, add
the following diiective to youi portal-ext.properties le
jdbc.default.jndi.name=jdbc/LiferayPool
Next, install Lifeiay accoiding to the instiuctions foi youi application seivei.
Once its installed, you can set up the mail conguiation.
loi mail, you can use Lifeiays contiol panel to cieate the conguiation and
this is the iecommended way. Go to Control Panel Server Administration
Mail and entei youi seuings foi youi mail session seuings. lf, howevei,
youie seuing up a lot of Lifeiay machines and theyie all going to have simi-
lai mail conguiations, its easiei to do the conguiation once and then copy
the conguiation le to multiple machines. ln this case, youll want to use the
portal-ext.properties le. To use the built-in mail session, use the follow-
ing piopeities and customize theii values foi youi enviionment
mail.session.mail.pop3.host=localhost
mail.session.mail.pop3.password=
mail.session.mail.pop3.port=110
mail.session.mail.pop3.user=
mail.session.mail.smtp.auth=false
mail.session.mail.smtp.host=localhost
mail.session.mail.smtp.password=
mail.session.mail.smtp.port=25
mail.session.mail.smtp.user=
mail.session.mail.store.protocol=pop3
mail.session.mail.transport.protocol=smtp
To use youi application seiveis mail session, cieate it ist. Ten specify it
in the portal-ext.properties le
mail.session.jndi.name=mail/MailSession
When youve nished, save the le.
Next, follow the instiuctions foi installing Lifeiay on youi paiticulai appli-
cation seivei in the section below.
14.7 Installing Liferay on an existing application server
Tis section contains detailed instiuctions foi installing Lifeiay Poital using its
.wai le distiibution. Tis allows system administiatois to deploy Lifeiay in
existing application seivei installations. lt is iecommended that you have a
good undeistanding of how to deploy Java EE applications in youi application
seivei of choice.
14.7. INSTALLING LIFERAY ON AN EXISTING APPLICATION SERVER 439
Installing Liferay in ve easy steps
Teie aie ve geneiic steps to installing Lifeiay on an existing application seivei
1. Obtain the Lifeiay .war le and the dependencies aichive.
2. Make suie you dont have an application listening at the ioot (/) of youi
seivei. lf you do, move it to a dieient context oi undeploy it.
3. Shut youi application seivei down.
4. Extiact the dependencies to a location on youi seiveis global classpath. Tis
allows both Lifeiay and plugins to access these dependencies.
. Stait youi application seivei, deploy the Lifeiay .war le and stait it.
Te instiuctions below aie specic foi each application seivei that Lifeiay
suppoits. Lifeiay suppoits a wide combination of application seiveis and databases.
Because of this, this section assumes MySQL as the database, that the database
has alieady been cieated and that youie using the setup wizaid. lf youie not
using the setup wizaid, see the sections above foi infoimation on how to set up
Lifeiay manually.
We also assume youi application seivei is alieady installed and iunning suc-
cessfully. lf you still need to install youi application seivei, please follow youi
vendois instiuctions ist.
Te following instiuctions assume an installation on a local machine. When
installing to a iemote seivei, substitute localhost with the host name oi lP of
the seivei.

Tip: Note that Lifeiay requires JDK oi gieatei. Do not at-


tempt to install Lifeiay .x on an application seivei that iuns
undei Java 1.4 oi lowei, it will not woik. lf you aie iunning an
application seivei that ships with a JDK and that JDK is 1.4 oi
lowei, youll need to upgiade youi application seivei to iun cui-
ient veisions of Lifeiay Poital.
Without fuithei ado, lets get to the application seiveis. Te ist one well
covei is Mule Tcat. lf you dont have an application seivei piefeience, and you
want suppoit all the way down to the application seivei fiomLifeiay, then Mule
Tcat is youi solution. Afei we covei Mule Tcat, well look at all the suppoited
application seiveis in alphabetical oidei.
440 CHAPTER 14. INSTALLATION AND SETUP
14.8 Installing Liferay on Mule Tcat
Lifeiay Poital Tcat Edition is a combination of Lifeiay Poital, the leading open
souice poital, and Tcat Seivei, an enteipiise giade administiation console foi
the Apache Tomcat application seivei.
Tcat Seivei piovides seveial tools to make Tomcat moie administiatoi fiiendly,
especially in oiganizations used to leveiaging administiation consoles like those
found in othei moie complex JEE application seiveis. You may use the console
to
Monitoi and contiol all Tomcat instances on multiple seiveis and acioss
multiple enviionments
Deploy and view applications acioss instances
Tioubleshoot pioblems acioss all instances, including view JMX paiame-
teis, viewing iemote logs and moie
Piovide gianulai entitlement contiols foi the above functions and moie
Tis isnt a complete guide to Mule Tcat, it just coveis Lifeiay installation.
loi full documentation, youll nd moie detailed infoimation at MuleSofs web
site.
2
To obtain Lifeiay Poital Tcat Edition, you need access to the Lifeiay Cus-
tomei Poital and the Mulesof Tcat Seivei web site. lf you aie not a cuiient
Lifeiay customei and would like to tiy the pioduct, please contact Lifeiay via
email at saleslifeiay.com.
loi this section, well limit ouiselves to the Windows and Linux 4-bit in-
stallation wizaids. loi moie detailed installation instiuctions, please consult
the Mulesof Tcat Seivei installation documents located at
hup//www.mulesof.oig/documentation/display/TCAT/Home
lnstalling Tcat Seivei on Linux
lnstalling Tcat Seivei on Windows
lnstalling Tcat Seivei on Solaiis
lnstalling Tcat Seivei on Mac OS X
Adding Tcat Seivei Capabilities to an Existing Apache Tomcat lnstall
2
hup//www.mulesof.oig/documentation/display/TCAT/Home
14.8. INSTALLING LIFERAY ON MULE TCAT 441
liist, download the Lifeiay Tcat bundle fiom the Lifeiay customei poital.
Youll need two les
Liferay Portal 6.1 EE Tcat Admin: contains the Tcat administiation con-
sole and Lifeiay Poital EE and all appiopiiate plugins.
Liferay Portal 6.1 EE Tcat Agent: contains a vanilla Tomcat application
seivei and the Tcat management agent.
Next, download the appiopiiate Tcat platfoim installation.
3
You may select
installation wizaids foi Windows (32 and 4-bit), Mac, Unix, Solaiis and Linux
(32 and 4-bit) as well as a manual installation zip.
Afei obtaining the sofwaie bundles, you can pioceed with installation and
conguiation of the Administiation Console.
Installing the Administration Console on Windows
loi Windows, Tcat comes with an installei to assist with installation and con-
guiation. Afei downloading, execute the installei, accepting the appiopiiate
license agieement.
Upon accepting the license agieement, the system piesents you with two
installation choices, a standaid oi custom installation.
Figure 14.4: Installation selection
3
hup//www.mulesof.com/download-tcat
442 CHAPTER 14. INSTALLATION AND SETUP
You should select the Custom installation option to piovide beuei contiol
of wheie Tcat Seivei is installed.
Figure 14.5: Installation component selection
Afei selecting the custominstallation option, the Tcat installei piompts you
to select the desiied components.
Tcat Server: a veision of Apache Tomcat that includes the appiopiiate
management agents used by Tcat.
Administration Console: the administiation console foi monitoiing and
managing all available Tcat seiveis. Tis console contains tools used foi
application deployment, log access, seivei contiol and othei administia-
tion tools.
Tomcat Documentation: the documentation that comes noimally with
an Apache Tomcat distiibution. You do not need to select this option.
Tomcat Examples: the examples that comes noimally with an Apache
Tomcat distiibution. You do not need to select this option.
Tomcat Manager Application: the managei application that comes noi-
mally with an Apache Tomcat distiibution. You do not need to select this
option.
14.8. INSTALLING LIFERAY ON MULE TCAT 443
loi this step in the installation piocess, select the Administiation Console in
addition to Tcat Seivei.
Figure 14.6: Installation location
Afei selecting Tcat Seivei and the Administiation Console foi installation,
the installation wizaid piompts you foi an installation diiectoiy. Please select
the desiied installation diiectoiy foi the Tcat Seivei.
Afei selecting the appiopiiate installation location, the installation wizaid
piompts you to specify the appiopiiate poit numbeis. lf this is the ist time
installing Tcat and no othei Apache Tomcat installations aie piesent, then you
may ietain the above poits. Howevei, if theie aie othei installations, you will
need to select new poits. loi the puipose of this installation, we will assume
the above poits aie coiiect.
To ensuie the opeiating system staits the Tcat Seivei and Administiatoi
Console, you must conguie the Tcat Seivei piocess as a Windows seivice. Te
next step in the installation wizaid helps with this piocess.
ln the Windows seivice installation scieen, please select lnstall Tcat Seivei
as a Windows seivice. You may choose an appiopiiate seivice name othei than
TcatServer.
Te nal step in the installation wizaid is to conguie Stait Menu shoitcuts.
You may choose to customize the shoitcut location oi accept the default.
444 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.7: Port congurations
Figure 14.8: Windows service installation
14.8. INSTALLING LIFERAY ON MULE TCAT 44
Figure 14.9: Start menu shortcuts
Afei conguiing the shoitcuts, the Tcat Seivei Windows installei peifoims
the installation as pieviously conguied.
Installing the Administraton Console on Linux (Ubuntu)
loi Linux, Tcat comes with an installei to assist with installation and conguia-
tion. Afei downloading, execute the installei, accepting the appiopiiate license
agieement. To execute the installei, make suie
you have added execution peimissions to the installei le (chmod a+x
[file name])
you execute it with ioot piivileges (dont woiiy the installed seivice is
executed by a pie-dened system usei with no ioot piivileges)
Upon accepting the license agieement, the system piesents you with two
installation choices a standaid oi custom installation.
You should select the Custom installation option to piovide beuei contiol
of wheie Tcat Seivei is installed.
Afei selecting the custominstallation option, the Tcat installei piompts you
to select the desiied components.
44 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.10: Installation type
Figure 14.11: Installation component selections
Tcat Server: a veision of Apache Tomcat that includes the appiopiiate
management agents used by Tcat.
Administration Console: the administiation console foi monitoiing and
managing all available Tcat seiveis. Tis console contains tools used foi
application deployment, log access, seivei contiol and othei administia-
tion tools.
Tomcat Documentation: the documentation that comes noimally with
an Apache Tomcat distiibution. You do not need to select this option.
14.8. INSTALLING LIFERAY ON MULE TCAT 44
Tomcat Examples: the examples that comes noimally with an Apache
Tomcat distiibution. You do not need to select this option.
Tomcat Manager Application: the managei application that comes noi-
mally with an Apache Tomcat distiibution. You do not need to select this
option.
loi this step in the installation piocess, select the Administiation Console in
addition to Tcat Seivei, which is the default seuing.
Afei selecting Tcat Seivei and the Administiation Console foi installation,
the installation wizaid piompts you foi an installation diiectoiy.
Figure 14.12: Installation location
Please select the desiied installation diiectoiy foi the Tcat Seivei. Te oeied
default diiectoiy is dieient if the installation piocess has been staited as ioot.
Afei selecting the appiopiiate installation location, the installation wizaid
piompts you to specify the appiopiiate poit numbeis. lf this is the ist time
installing Tcat and no othei Apache Tomcat installations aie piesent, then you
may ietain the above poits. Howevei, if theie aie othei installations, you will
need to select new poits. loi the puipose of this installation, we will assume
the above poits aie coiiect.
loi secuiity consideiations, Tcat iuns as a non-ioot system usei. lf the usei-
name specied at this step does not exist, its cieated as a system daemon usei.
448 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.13: Port conguration
Figure 14.14: Congure Tcat systemuser
14.8. INSTALLING LIFERAY ON MULE TCAT 449
Figure 14.15: Install service
To ensuie the opeiating system staits the Tcat Seivei and Administiatoi
Console, you must cieate a seivice staitup sciipt in /etc/init.d. Te next
step in the installation wizaid helps with this piocess.
ln the seivice installation scieen, you may entei an appiopiiate seivice name
oi use the default. lf you have multiple installations of Tcat, you should select
a moie appiopiiate name than what is supplied by default.
Figure 14.16: Symbolic link creation
40 CHAPTER 14. INSTALLATION AND SETUP
Te nal conguiation step befoie installation is the cieation of a symbolic
link so the Tcat executable can be accessed moie easily. Tis step is optional
and you may choose to not cieate the symbolic link.
Figure 14.17:
Now that Tcat is installed, you can add Lifeiay to it.
Adding Liferay Portal packages
Afei completing the TcatSeivei Administiation Console installation, you can
conguie the Lifeiay Poital packages foi Tcat.
liist, extiact the pieviously downloaded Lifeiay Poital .1 EE Tcat Admin
into a tempoiaiy diiectoiy. Once extiacted, locate the le tcat-init.groovy
and the diiectoiy tcat\_init.
Te tcat-init.groovy le contains instiuctions foi the TcatSeivei admin-
istiation console to
Pie-load the Lifeiay Poital and Plugins WAR les into the application
iepositoiy
Load the appiopiiate Lifeiay application piole that should be applied to
all othei Tcat managed seiveis
Load the Lifeiay specic deployment managei
14.8. INSTALLING LIFERAY ON MULE TCAT 41
Figure 14.18: Liferay Portal Tcat packages
Te tcat\_init foldei contains the managed seivei pioles, Lifeiay WAR
les and administiation sciipts.
Copy the tcat-init.groovy le and tcat\_init foldei to the pieviously
conguied installation location.
Afei successfully completing the installation on Windows, you should see
a TcatSeivei entiy in the Seivices console, similai to the scieen shot below.
By default, the TcatSeivei seivice is inactive but is set to stait automatically
upon boot. Go ahead and choose to stait the seivice.
lf youie using Linux, you should see an entiy foi the Tcat seivice initializa-
tion sciipt in /etc/init.d. Te sciipt name is the name you choose duiing the
installation piocess.
To stait the Tcat Seivei Administiation Console, execute the seivice sciipt
in /etc/init.d.
Tcat Server Managed Server Installation
Te steps to install the Tcat Seivei managed seivei aie quite similai to those foi
installing the Tcat Seivei Administiation Console.
liist, launch the wizaid. Duiing the installation component conguiation
step, unselect Administiation Console fiom the list of components.
Te next step is to specify an installation location. lf you have othei instal-
lations of Tcat on this machine, you should choose anothei destination. loi
42 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.19: The installation directory after copying the tcat\_init
folder and tcat-init.groovy into the TcatServer installation directory.
example, if you have alieady installed the Tcat Seivei Administiation Con-
sole to C:\\TcatServer6, you should peihaps install the managed seivei to
C:\\TcatServer6Managed.
Duiing the managed seivei installation, as with the administiation console
installation, you will be piompted to conguie the appiopiiate poit numbeis.
lf you do not have anothei Tcat Seivei instance (e.g. administiation console oi
anothei managed seivei), you may choose the default poits. Otheiwise, you
should select non-conicting poits. loi instance
HTTP poit 8180
HTTPS iediiect poit 81443
Tcat Seivei shutdown poit 810
AJP connectoi poit 8109
Secuie Agent Poit 2443
14.8. INSTALLING LIFERAY ON MULE TCAT 43
Figure 14.20: Windows services console
Figure 14.21: Tcat service startup on Linux
44 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.22: Installation location
Figure 14.23: Managed server port congurations
14.8. INSTALLING LIFERAY ON MULE TCAT 4
To ensuie the opeiating system staits the Tcat Seivei and Administiatoi
Console, you must conguie the Tcat piocess as a Windows seivice oi Linux
daemon. Te next step in the installation wizaid helps with this piocess.
Te nal step in the installation wizaid is to conguie Stait Menu shoitcuts.
You may choose to customize the shoitcut location oi simply accept the default.
Since this is foi a managed seivei, you may wish to name it similai to the seivice
name.
Afei conguiing the shoitcuts, the Tcat Seivei installei peifoims the instal-
lation as pieviously conguied.
Once you have installed the managed seivei, theie is one moie step to pei-
foim on the managed seivei. You must modify the catalina.properties le
located in the conf diiectoiy of youi Tcat Seivei installation.
You will need to change the text
common.loader=${catalina.base}/lib,${catalina.base}/lib/\*.jar, \
${catalina.home}/lib,${catalina.home}/lib/\*.jar
To
common.loader=${catalina.base}/lib,${catalina.base}/lib/\*.jar, \
${catalina.home}/lib,${catalina.home}/lib/\*.jar, \
${catalina.home}/lib/ext,${catalina.home}/lib/ext/\*.jar
By modifying the common.loader piopeity, you instiuct Tcat Seivei to load
eveiything in the lib/ext foldei as pait of the classpath.
Registering the managed server
Afei completing the installation piocess and staiting the appiopiiate TcatSeivei
piocesses, open a biowsei to [SERVER NAME]:[PORT]/console. Using the
pievious installation example, you should point youi biowsei to
http://localhost:8080/console
Te biowsei should iendei the TcatSeivei Administiation Console shown
below.
Te default login is admin/admin.
Once you have logged into the administiation console, you will be piesented
with a global dashboaid that you may customize once you have dismissed the
Tcat Seivei - Qick Stait panel.
liist make suie that you have staited the pieviously installed managed seivei.
Clicking on the Servers tab in the console, you will see a seivei listed as Unreg-
istered.
4 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.24: Tcat Admin Console log in
Uniegisteied seiveis aie seiveis that have the Tcat management agent in-
stalled but aie not added to the administiation console. You may add the un-
iegisteied seivei by selecting eithei Register oi Register & Add To Group.
lf you choose to use Register & Add To Group, the seivei is added to the
desiied seivei gioup (e.g. Development). loi the puipose of this guide, well
iegistei the seivei to the Development gioup.
Afei iegisteiing the seivei, you will have access to viewits health status, log
les and moie. leel fiee to walk thiough the console to examine its capabilities,
like ieviewing log les, cuiient thiead status and deployed web applications.
Moie infoimation is available at MuleSofs web site.
Managing and Monitoring Servers
Using the Seivei Dashboaid
Woiking with Seivei Gioups
Monitoiing Seiveis (View Apps, Tieads, etc)
14.8. INSTALLING LIFERAY ON MULE TCAT 4
Figure 14.25: Customizable Tcat Admin Console
Monitoiing a JMX Agent
Sciipts to Save JMX Metiics to CSV liles
Managing Tcat Web Applications
Monitoiing Applications
Deploying Applications
Using the Repositoiy
Seuing Secuiity on Repositoiy Aitifacts
48 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.26: Monitoring a registered server
Deploying Liferay Portal
As pait of the installation piocess, the cuiient veision of Lifeiay Poital and a
numbei of Lifeiay Plugins have been piovisioned into the Tcat iepositoiy. You
can view them by clicking on the Repositoiy tab.
Teie aie two components in the Tcat Repositoiy
Proles: application pioles to be applied to the Tcat managed seiveis.
Contains conguiation, shaied libiaiies and moie.
Applications: deployable WAR les foi web applications and Lifeiay Plu-
gins.
14.8. INSTALLING LIFERAY ON MULE TCAT 49
Figure 14.27: Tcat Repository proles
To begin Lifeiay deployment, we must ist cieate a Lifeiay license piole to
be deployed to the managed seivei
1. liist cieate a new woikspace undei Proles. Select Proles in the lef naviga-
tion and then click the New Workspace buuon.
2. Within the new woikspace Liferay Portal Trial License, cieate anothei foldei
called deploy.
3. ln the deploy foldei, select New Artifact and upload a new license le.
Afei completing the above, you have successfully uploaded youi Lifeiay
Poital license le into the Tcat iepositoiy. Te nal step is to cieate a seivei
piole fiom the Administration tab.
40 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.28: Tcat Repository: Applications
Server Proles shows the list of available Seivei Pioles and the option to
cieate a new piole.
When cieating a seivei piole foi the Lifeiay Poital Tiial License, you will
need to select the woikspace foldei cieated in the pievious step. Tis ensuies
that when you apply the piole, Tcat uses the latest veision of the license le.
Once youve cieated the seivei piole foi youi Lifeiay Poital EE license, you
may begin deploying Lifeiay to the managed seivei.
Te ist step is to apply two seivei pioles, one foi the license and the othei
foi Lifeiay Poital. Applying the license piole does not iequiie a iestait of the
seivei.
Te second piole to be applied is the Lifeiay seivei piole. ln the example
shown we applied the piole foi Lifeiay Poital EE .1.
Te Lifeiay Poital seivei piole iequiies a seivei iestait. lf you have the
managed seivei conguied as a Windows oi Linux seivice, you may iestait the
14.8. INSTALLING LIFERAY ON MULE TCAT 41
Figure 14.29: Creating a newworkspace for Liferay license prole
seivei diiectly fiom the console by selecting the seivei and clicking Restait.
With both pioles applied, we can now deploy the Lifeiay Poital WAR to
the appiopiiate seivei.
Te Deployments tab contains tools that assist in cieating a deployment and
taigeting it to specic seiveis. Once you cieate a deployment, you may taiget
it to any numbei of seiveis oi deployment gioups.
When cieating a deployment, you may choose a WAR le alieady uploaded
into the iepositoiy oi you may choose to upload a new WAR le. We iecom-
mend using a WAR le fiom the iepositoiy foi non-development deployments.
Tis ensuies you consistently deploy the coiiect veision to youi enviionments.
Since we aie deploying Lifeiay Poital foi the ist time, we choose the ROOT.wai
le.
Afei selecting the appiopiiate web application, you may choose which Seiveis
to deploy to. ln this example, we deploy to the Tomcat instance labeled Liferay
42 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.30: Viewing server proles
Portal Instance 1.
Afei choosing to deploy the application, the Tcat console infoims you of
the cuiient deployment status (e.g. Successful). Assuming you followed the
pievious steps and the deployment successfully completes, you will be able to
access Lifeiay Poital on the taiget Tomcat instance.
Deploying Liferay plugins on Mule Tcat
Lifeiay Poital Tcat Edition woiks with all the appiopiiate Lifeiay EE Plugins,
including
Kaleo woikow engine
Knowledge base
14.8. INSTALLING LIFERAY ON MULE TCAT 43
Figure 14.31: Apply Liferay Portal trial license
Chat
Piivate messaging
You may choose to deploy these plugins to the appiopiiate seiveis by follow-
ing the same steps as foi deploying Lifeiay Poital, specifying the appiopiiate
plugin WAR le instead of the ROOT.wai.
Othei plugins that may be downloaded and added to this iepositoiy include
Audit
Repoit engine and console
Diools integiation.
44 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.32: Apply Liferay prole
You may download these plugins fiomthe Lifeiay Customei Poital and man-
ually add them to the Tcat iepositoiy.
Mule Tcat piovides an enteipiise giade solution to managing Tomcat seiveis.
lf you need a complete stack, combining Lifeiay Poital with Mule Tcat gives you
eveiything you need to iun a fully suppoited and iobust poital enviionment foi
youi enteipiise.
14.9 Installing Liferay on GlassFish 3
Liferay Home is thiee foldeis above youi Glasslish domain foldei.
loi example, if youi domain location is
/glassfish-3.1-web/glassfish3/glassfish/domains/domain1,
Lifeiay Home is
14.9. INSTALLING LIFERAY ON GLASSFISH 3 4
Figure 14.33: Choosing a web application for deployment
/glassfish-3.1-web/glassfish3/.
lf you dont alieady have an existing Glasslish seivei, we iecommend that
you download a Lifeiay/Glasslish bundle.
4
lf you have an existing Glasslish
seivei oi would like to install Lifeiay on Glasslish manually, please follow the
steps below.
Befoie you begin, make suie you have downloaded the latest Lifeiay .war
le and Lifeiay Poital dependencies.

Te Lifeiay .war le should be called


liferay-portal-6.1.x-[date].war
and the dependencies le should be called
liferay-portal-dependencies-6.1.x-[date].zip
4
hup//www.lifeiay.com/downloads/lifeiay-poital/available-ieleases

hup//www.lifeiay.com/downloads/lifeiay-poital/additional-les
4 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.34: Completing Liferay Portal deployment
Tese instiuctions assume that you aie iunning the latest suppoited veision
of Glasssh (cuiiently 3.1.2.2), have alieady conguied a domain and seivei,
and that you have access to the Glasslish administiative console.
Lets stait out by installing the JAR les you will need.
Dependency Jars
Lifeiay depends on jai les found in the Lifeiay Dependencies Aichive. You
should also have installed youi database diivei.
1. Navigate to the foldei that coiiesponds to the domain in which youll be
installing Lifeiay. lnside this foldei is a sub-foldei named lib.
Unzip the Lifeiay dependencies aichive so that its .jar les aie extiacted
into this lib foldei.
14.9. INSTALLING LIFERAY ON GLASSFISH 3 4
Figure 14.35: Accessing Liferay Portal on Liferay Portal Instance 1
2. Make suie the JDBC diivei foi youi database is accessible to Glasslish as
well. Obtain the JDBC diivei foi youi veision of the database seivei. ln the
case of MySQL, use mysql-connector-java-{$version}-bin.jar. You
can download the latest MySQL JDBC diivei.

Extiact the JAR le and copy


it to lib.
Teiiic, you have youi JAR les just wheie youll need them. Next well
conguie youi domain.
Domain Conguration Teie aie a couple of modications you need to make
in youi domain to use Lifeiay Poital.
1. Befoie staiting Glasslish, modify youi domains conguiation to do the fol-
lowing

hup//www.mysql.com/pioducts/connectoi/
48 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.36: Uploading newplugins into Tcat
Set the le encoding
Set the usei time-zone
Set the piefeiied piotocol stack
Pievent the application seivei fiomseuing static elds (nal oi non-nal)
to null
lnciease the default amount of memoiy available.
Modify
/glassfish-3.1-web/glassfish3/glassfish/domains/domain1/config/domain.xml
meiging in the following JVMoptions into the cuiient list of JVMoptions
within youi <java-config> element
<jvm-options>-Dfile.encoding=UTF8</jvm-options>
14.9. INSTALLING LIFERAY ON GLASSFISH 3 49
<jvm-options>-Djava.net.preferIPv4Stack=true</jvm-options>
<jvm-options>-Dorg.apache.catalina.loader.WebappClassLoader. \
ENABLE_CLEAR_REFERENCES=false</jvm-options>
<jvm-options>-Duser.timezone=GMT</jvm-options>
<jvm-options>-Xmx1024m</jvm-options>
<jvm-options>-XX:MaxPermSize=512m</jvm-options>
Be suie that any existing options with values such as
-Dfile.encoding
-Djava.net.preferIPv4Stack
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES
-Duser.timezone
-XX:MaxPermSize
aie ieplaced with the new values listed above.
loi example, ieplace
<jvm-options>-Xmx256m</jvm-options>
with this
<jvm-options>-Xmx1024m</jvm-options>
2. Delete, iename oi move the domain1/docroot/index.html le to anothei
location to allow youi Lifeiay Poital default page to be displayed.
Next, lets get youi database conguied.
Database Conguration
lf you want to use Glasslish to manage youi domains data souice, follow the
instiuctions found in this section. lf you want to use Lifeiay Poital to manage
youi data souice, you can skip this section.
1. Stait youi domains application seivei if it is not alieady iunning.
2. Go to the Glasslish console URL hup//localhost4848.
3. Undei Common Tasks, navigate to Resources JDBC JDBC Connection
Pools
4. Click New.
40 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.37: Navigate to JDBCConnection Pools
Figure 14.38: Glasssh JDBCConnection Pool
14.9. INSTALLING LIFERAY ON GLASSFISH 3 41
. ln the ist scieen (Step 1 of 2), give youi connection pool the name Liferay-
Pool, the iesouice type of javax.sql.ConnectionPoolDataSource and
select youi database diivei vendoi (e.g. MySQL) as follows
. Click Next to advance to the next step in cieating youi JDBC connection
pool.
. On the this scieen (Step 2 of 2), scioll down to the Additional Properties sec-
tion.
Figure 14.39: Glasssh JDBCConnection Pool Properties
8. Replace oi add the following piopeities
URL: the URL of youi connection pool.
loi example,
jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8 \
&amp;emulateLocators=true
Note, if you aie using the above example, you should specify the name of
youi database in place of lportal. Likewise, if youi database is not on the
same host as Glasslish, specify youi the database seiveis host name in place
of localhost. Lastly, specify youi database type in place of jdbc:mysql.
user: the name of youi database usei.
42 CHAPTER 14. INSTALLATION AND SETUP
password: youi database useis passwoid.
10. Click Finish.
You should now see youi LiferayPool connection pool listed undei Re-
sources JDBC JDBC Connection Pools
11. Test youi connection by selecting youi LiferayPool connection pool and
clicking Ping.
lf you get a message stating Ping Succeeded, youve succeeded in seuing up
a connection pool of youi data souice'
13. Now, youll setup a JDBC iesouice to iefei to the LiferayPool connection
pool you just cieated.
14. Navigate to Resources JDBC JDBC Resources to show the cuiient JDBC
iesouices listed by theii JNDl names.
1. Click New.
1. Set the JNDl name to jdbc/LiferayPool and select LiferayPool as the
pool name.
1. Click OK.
Congiatulations' Youve nowconguied youi domains data souice on Glass-
lish'
Mail Conguration
lf you want to use Glasslish to manage youi mail session, follow Glasslishs
documentation on conguiing a JavaMail session with a JNDl name of
mail/MailSession
lf you want to use Lifeiay Poital to manage youi mail session, you can skip this
step.
14.9. INSTALLING LIFERAY ON GLASSFISH 3 43
Domain Conguration - Continued
Lets tie up some loose ends with iegaids to Lifeiay being able to access youi
database and mail session.
2. Shutdown youi domains application seivei if it is cuiiently iunning.
3. Cieate a portal-ext.properties le in the Liferay Home foldei men-
tioned at the beginning of this Glasslish installation section.
4. lf you aie using Glasssh to manage youi data souice, add the following to
youi portal-ext.properties le in youi Liferay Home to iefei to youi
data souice
jdbc.default.jndi.namejdbc/LifeiayPool
Otheiwise, if you aie using Liferay Portal to manage youi data souice, follow
the instiuctions in the Deploy Liferay section foi using the setup wizaid.
4. lf want to use Liferay Portal to manage youi mail session, you can conguie
the mail session within Lifeiay Poital. Tat is, afei staiting youi poital as
desciibed in the Deploy Liferay section, go to Control Panel Server Admin-
istration Mail and entei the seuings foi youi mail session.
lf you aie using GlassFish to manage youi mail session, add the following to
youi portal-ext.properties le to iefeience that mail session
mail.session.jndi.name=mail/MailSession
Lifeiay can now communicate with youi database and mail session. So lets
go ahead and deploy Lifeiay.
Deploy Liferay
Heie aie the steps youll need to followto deploy Lifeiay Poital to youi domains
seivei. Befoie you deploy Lifeiay Poital, lets considei whethei you want to also
stait the setup wizaid.
Start the setup wizard along with Liferay Portal - Do this if you want
to conguie youi poital, set up youi sites administiative account and/oi
manage youi database within Lifeiay.
44 CHAPTER 14. INSTALLATION AND SETUP
lf this is youi ist time staiting Lifeiay Poital .1, the setup wizaid is auto-
matically invoked. lf you want to ie-iun the wizaid, specify setup.wizard.en-
abled=true in youi piopeities le (e.g. portal-setup-wizard.properties).
setup.wizard.enabled=true
Te setup wizaid is then invoked duiing seivei staitup.
Start Liferay Portal without invoking the setup wizard - Do this if want
to pieseive youi cuiient poital seuings.
To stait the seivei without tiiggeiing the setup wizaid, specify setup.wiz-
ard.enabled=false in youi piopeities (e.g. portal-setup-wizard.pro-
perties oi portal-ext.properties le).
setup.wizard.enabled=false
Once you iun the setup wizaid, the portal-setup-wizard.properties
le it cieates alieady has setup.wizard.enabled=false conveniently speci-
ed foi you.

Piopeity values in portal-setup-wizard.properties


oveiiide piopeity values in portal-ext.properties.
1. Stait youi domains application seivei.
2. Go to the Glasslish console URL hup//localhost4848
3. Click Applications in the tiee on the lef.
4. Click Deploy.
. Undei Packaged File to Be Uploaded to the Server, click Choose File and biowse
to the location of the Lifeiay Poital .war le. Entei Context Root: /
. Entei Application Name: liferay-portal
. Click OK.
14.10. INSTALLING LIFERAY ON JETTY 7 4
Figure 14.40: Deploying Liferay in GlassFish 3.1.x
lf you disabled the setup wizaid, youi sites home page opens in youi
biowsei at hup//localhost8080.
Otheiwise, the setup wizaid opens in youi biowsei.
See the section on the setup wizaid above foi how to use the setup wizaid.
Youi installation of Lifeiay Poital on Glasslish is complete'
14.10 Installing Liferay on Jetty 7
Liferay Home is one foldei above Jeuys install location.
loi this section, well iefei to Jeuy seiveis installation location as
$JETTY_HOME
4 CHAPTER 14. INSTALLATION AND SETUP
lf you do not alieady have an existing Jeuy seivei, we iecommend you download
a Lifeiay/Jeuy bundle fiom Lifeiays web site.

lf you have an existing Jeuy


seivei oi would like to install Lifeiay on Jeuy manually, please follow the steps
below.
Befoie you begin, make suie you have downloaded the latest Lifeiay .war
le and Lifeiay Poital dependencies.
8
Te Lifeiay .war le should be called
liferay-portal-6.1.x-<date>.war and the dependencies le should be called
liferay-portal-dependencies-6.1.x-<date>.zip.
Now that you have all of youi installation les, youie ieady to stait in-
stalling and conguiing Lifeiay on Jeuy.
Dependency Jars
Lets woik with the Lifeiay depenency jai les ist.
1. Cieate foldei $JETTY_HOME/lib/ext/liferay.
2. Unzip the jai les found in the Lifeiay Poital Dependencies zip le to youi
$JETTY_HOME/lib/ext/liferay foldei. Take caie to extiact the zip les
.jar les diiectly into this foldei.
3. Next, you need seveial .jar les which aie included as pait of the Lifeiay
souice distiibution. Many application seiveis ship with these alieady on
the class path but Jeuy does not. Te best way to get the appiopiiate vei-
sions of these les is to download the Lifeiay souice code and get them
fiom theie. Once you have downloaded the Lifeiay souice, unzip the souice
into a tempoiaiy foldei. Well iefei to the location of the Lifeiay souice as
$LIFERAY_SOURCE.
Copy the following jais fiom$LIFERAY_SOURCE/lib/development to youi
$JETTY_HOME/lib/ext/liferay foldei
activation.jar
jta.jar
mail.jar
persistence.jar

hup//www.lifeiay.com/downloads/lifeiay-poital/available-ieleases
8
hup//www.lifeiay.com/downloads/lifeiay-poital/additional-les
14.10. INSTALLING LIFERAY ON JETTY 7 4
4. Make suie the JDBC diivei foi youi database is accessible to Jeuy. Obtain the
JDBC diivei foi youi veision of the database seivei. ln the case of MySQL,
use mysql-connector-java-{$version}-bin.jar
9
. Extiact the JAR le
and copy it to $JETTY_HOME/lib/ext/liferay.
Now that youi .jar les aie in place, lets conguie youi domain.
Jetty Conguration
To get Jeuy ieady foi iunning Lifeiay Poital, you must make a numbei of mod-
ications that involve conguiation les, initialization les and iun sciipts.
1. Cieate a start.config le to modify the behavioi of Jeuys start.jar. lts
best to base youi start.config le on the default one found in start.jar.
2. Extiact the default stait cong le org/eclipse/jetty/start/start.con-
fig fiom the start.jar into $JETTY_HOME/etc. Te le $JETTY_HOME/-
etc/start.config should be in the $JETTY_HOME/etc foldei.
3. Add the following piopeity assignment to $JETTY_HOME/etc/start.config
to specify wheie Jeuy should wiite its logs
jeuy.logsS(jeuy.home)/logs
4. Add the following diiective to $JETTY_HOME/etc/start.config to load
all of the .jar and .zip les found in youi $JETTY_HOME/lib/liferay
foldei into youi class path
S(jeuy.home)/lib/lifeiay/*
Now that youi class loading is specied, lets cieate initialization les and
iun sciipts that invoke these conguiation diiectives duiing Jeuys staitup pio-
cess.
2. Cieate initialization le $JETTY_HOME/bin/start.ini
START=../etc/start.config
OPTIONS=Server,jsp,resources
../etc/jetty.xml
../etc/jetty-deploy.xml
../etc/jetty-webapps.xml
../etc/jetty-contexts.xml
../etc/jetty-testrealm.xml
9
hup//www.mysql.com/pioducts/connectoi/
48 CHAPTER 14. INSTALLATION AND SETUP
Tis initialization le does the following
Sets $JETTY_HOME/etc/start.config as youi staiting conguiation
le.
Sets youi seivei options.
Species a sequence of deployment desciiptoi les to be piocessed.
3.Cieate a iun sciipt appiopiiate to youi opeiating system
On Windows, cieate $JETTY_HOME/bin/run.bat
@echo off
if "" == "%JAVA_HOME%" goto errorJavaHome
set "JAVA_OPTS=-Djetty.version=7.5.4 -Djetty.version.date=20111024 \
-Dfile.encoding=UTF8 -Djava.io.tmpdir=../temp \
-Djava.net.preferIPv4Stack=true -Duser.timezone=GMT \
-Xmx1024m -XX:MaxPermSize=256m"
"%JAVA_HOME%/bin/java" %JAVA_OPTS% -jar ../start.jar
goto end
:errorJavaHome
echo JAVA_HOME not defined.
goto end
:end
On Unix/Linux, cieate $JETTY_HOME/bin/run.sh
#!/bin/sh
if [ ! $JAVA_HOME ]
then
echo JAVA_HOME not defined.
exit
fi
export JAVA_OPTS="-Djetty.version=7.5.4 -Djetty.version.date=20111024 \
-Dfile.encoding=UTF8 -Djava.io.tmpdir=../temp \
-Djava.net.preferIPv4Stack=true -Duser.timezone=GMT \
-Xmx1024m -XX:MaxPermSize=256m"
$JAVA_HOME/bin/java $JAVA_OPTS -jar ../start.jar
14.10. INSTALLING LIFERAY ON JETTY 7 49
3. Cieate a context le $JETTY_HOME/contexts/root.xml to specify the con-
text, classpath and iesouice base of youi web application
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="extraClasspath">
<SystemProperty name="jetty.home" />/lib/jetty-server-
<SystemProperty name="jetty.version" />.v
<SystemProperty name="jetty.version.date" />.jar,
<SystemProperty name="jetty.home" />/lib/jetty-util-
<SystemProperty name="jetty.version" />.v
<SystemProperty name="jetty.version.date" />.jar,
<SystemProperty name="jetty.home" />/lib/jetty-webapp-
<SystemProperty name="jetty.version" />.v
<SystemProperty name="jetty.version.date" />.jar</Set>
<Set name="resourceBase">
<SystemProperty name="jetty.home" />/webapps/root</Set>
</Configure>
4. Lastly, cieate the following foldeis
$JETTY_HOME/logs - foi log les
$JETTY_HOME/temp - foi tempoiaiy les. Note, this foldei is specied to
oui JVM as a tempoiaiy foldei in the iun sciipt you cieated pieviously.
Now that youi geneial Jeuy staitup les aie set in place, lets considei how
you will manage youi data souice.
Database Conguration
lf you want to manage youi data souice within Jeuy, continue following the
instiuctions in this section. lf you want to use the built-in Lifeiay data souice,
you can skip this section.
1. Management of databases in Jeuy is done via the le $JETTY_HOME/etc/jet-
ty.xml. Edit jetty.xml and inseit the following text within the ioot ele-
ment <Configure> to specify the data pool foi youi data souice. Be suie to
pass in value jdbc/LiferayPool as the second aigument.
<New id="LiferayPool" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/LiferayPool</Arg>
480 CHAPTER 14. INSTALLATION AND SETUP
<Arg>
<New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<Set name="Url">jdbc:mysql://localhost/lportal?
useUnicode=true&amp;characterEncoding=UTF-8</Set>
<Set name="User">root</Set>
<Set name="Password">root</Set>
</New>
</Arg>
</New>
Be suie to ieplace the URL database value (i.e. lportal), usei value and
passwoid value with values specic to youi database.
2. Youi data pool needs Jeuys JNDl and Jeuy Plus libiaiies loaded to access
those classes at iuntime. Youi $JETTY_HOME/etc/start.config le should
have sections that load these libiaiies as long as jndi and plus options aie
specied at staitup.
To set these options, edit youi $JETTY_HOME/bin/start.ini le and add
jndi and plus as values foi the OPTIONS vaiiable
OPTIONS=Server,jsp,resources,jndi,plus
Supei' Now you have youi database specied and ieady foi use with Lifeiay
on Jeuy. Lets considei youi mail session next.
Mail Conguration
lf you want to manage youi mail session within Jeuy, use the following in-
stiuctions. lf you want to use the built-in Lifeiay mail session, you can skip this
section.
Management of mail sessions in Jeuy is done via the conguiation le $JET-
TY_HOME/etc/jetty.xml. Edit jetty.xml and inseit the following text within
the ioot element <Configure> to specify youi mail session. Be suie to pass in
value mail/MailSession as the ist aigument and to ieplace the mail session
values with youi own.
<New id="MailSession" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>mail/MailSession</Arg>
<Arg>
<New class="org.eclipse.jetty.jndi.factories.MailSessionReference">
<Set name="user"></Set>
<Set name="password"></Set>
<Set name="properties">
<New class="java.util.Properties">
<Put name="mail.pop3.host">pop.gmail.com</Put>
14.10. INSTALLING LIFERAY ON JETTY 7 481
<Put name="mail.pop3.port">110</Put>
<Put name="mail.smtp.host">smtp.gmail.com</Put>
<Put name="mail.smtp.password">password</Put>
<Put name="mail.smtp.user">user</Put>
<Put name="mail.smtp.port">465</Put>
<Put name="mail.transport.protocol">smtp</Put>
<Put name="mail.smtp.auth">true</Put>
<Put name="mail.smtp.starttls.enable">true</Put>
<Put name="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</Put>
<Put name="mail.imap.host">imap.gmail.com</Put>
<Put name="mail.imap.port">993</Put>
<Put name="mail.store.protocol">imap</Put>
</New>
</Set>
</New>
</Arg>
</New>
Gieat' Now youll be able to use this mail session with Lifeiay.
Conguring data sources and mail sessions
Lets ievisit youi conguiation to make suie well be able to access youi data
souice and mail session fiom Lifeiay Poital.
1. liist, navigate to the Liferay Home foldei, which is one foldei above Jeuys
install location. Cieate a le named portal-ext.properties.
2. lf you aie using Jey to manage youi data souice, add the following to youi
portal-ext.properties le in youi Liferay Home to iefei to youi data
souice
jdbc.default.jndi.name=jdbc/LiferayPool
Otheiwise, if you aie using Liferay Portal to manage youi data souice, follow
the instiuctions in the Deploy Liferay section foi using the setup wizaid.
3. lf want to use Liferay Portal to manage youi mail session, you can conguie
the mail session within Lifeiay Poital. Tat is, afei staiting youi poital as
desciibed in the Deploy Liferay section, go to Control Panel Server Admin-
istration Mail and entei the seuings foi youi mail session.
Otheiwise, if you aie using Jey to manage youi mail session, add the fol-
lowing to youi portal-ext.properties le to iefeience that mail session
mail.session.jndi.name=mail/MailSession
Lets stait youi seivei and deploy Lifeiay Poital'
482 CHAPTER 14. INSTALLATION AND SETUP
Deploy Liferay
Lifeiay can be deployed as an exploded web aichive within $JETTY_HOME/web-
apps.
1. lf you alieady have an application foldei $JETTY_HOME/webapps/root, delete
it oi move it to a location outside of $JETTY_HOME/webapps.
2. Ten extiact the contents of the Lifeiay poital .war le into $JETTY_HOME/web-
apps/root.
3. Befoie you stait Lifeiay Poital, lets considei whethei you want to also stait
the setup wizaid.
Start the setup wizard along with Liferay Portal - Do this if you want
to conguie youi poital, setup youi sites administiative account and/oi
manage youi database within Lifeiay.
lf this is youi ist time staiting Lifeiay Poital .1, the setup wizaid is invoked
on seivei staitup. lf you want to ie-iun the wizaid, specify setup.wizard.en-
abled=true in youi piopeities le (e.g. portal-setup-wizard.properties).
setup.wizard.enabled=true
Te setup wizaid is invoked duiing seivei staitup.
Start Liferay Portal without invoking the setup wizard - Do this if want
to pieseive youi cuiient poital seuings.
To stait the seivei without tiiggeiing the setup wizaid, specify setup.wiz-
ard.enabled=false in youi piopeities (e.g. portal-setup-wizard.pro-
perties oi portal-ext.properties le).
setup.wizard.enabled=false
Te portal-setup-wizard.properties le the setup wizaid cieates has
setup.wizard.enabled=false conveniently specied foi you.

Piopeity values in portal-setup-wizard.properties


oveiiide piopeity values in portal-ext.properties.
14.11. INSTALLING LIFERAY ON JBOSS 5.1 483
Now its time to launch Lifeiay Poital'
4. Stait Lifeiay Poital by executing run.bat (Windows) oi run.sh (Unix/Linux)
sciipt fiom $JETTY_HOME/bin.
lf the setup wizaid was disabled, youi sites home page opens in youi
biowsei at hup//localhost8080.
Otheiwise, the setup wizaid opens in youi biowsei.
See the section on the setup wizaid above foi moie infoimation about the
setup wizaid.
Youve just installed and deployed Lifeiay Poital on Jeuy - way to go'
14.11 Installing Liferay on JBoss 5.1
Liferay Home is one foldei above JBosss install location.
1. Download and install JBoss EAP .1.x into youi piefeiied diiectoiy. Tis
diiectoiy is iefeiied to as $JBOSS_HOME thioughout this section.
2. Download the latest veision of the Lifeiay Poital .war le.
3. Download Lifeiays Poital Dependencies.
Now that you have all of youi installation les, you aie ieady to stait in-
stalling and conguiing Lifeiay on JBoss.
Conguring Dependencies
liist well take caie of dependencies and potential conicts.
1. Unzip Lifeiays dependencies to $JBOSS_HOME/server/default/lib.
2. Download youi database diivei .jar le and put it into the foldei as well.
loi demonstiation puiposes, well download the MySQL Connectoi/J diivei
fiom hup//dev.mysql.com/downloads/connectoi/j/ and put its .jar le into
the $JBOSS_HOME/server/default/lib foldei.
3. Next well delete JBosss Hibeinate Validatoi and HSQL JARs to pievent con-
icts with Lifeiays JARs. Remove the following les fiom$JBOSS_HOME/com-
mon/lib
484 CHAPTER 14. INSTALLATION AND SETUP
hibernate-validator.jar
hsqldb.jar
hsqldb-plugin.jar
Next we need to clean up the entiies foi the JAR les that we deleted.
1. Open $JBOSS_HOME/server/default/conf/login-config.xml in a text
editoi.
2. Comment out the blocks with the name HsqlDBRealm and JmsXARealm aiound
lines 41-4.
Well also delete some othei les that can cause conicts with Lifeiay when
its deployed.
1. Remove the following les fiom$JBOSS_HOME/../server/default/deploy
/messaging
ejb2-container-jboss-beans.xml
ejb2-timer-service.xml
ejb3-connections-jboss-beans.xml
ejb3-container-jboss-beans.xml
ejb3-interceptors-aop.xml
ejb3-timerservice-jboss-beans.xml
hsqldb-ds.xml
jms-ra.rar
mail-ra.rar
mail-service.xml
profile-service-secured.jar
uuid-key-generator.sar
2. Delete the following in $JBOSS_HOME/../server/default/deployers
jboss-ejb3-endpoint-deployer.jar
messaging-definitions-jboss-beans.xml
Deploying Liferay
Now that weve added all of the necessaiy dependencies and iemoved unnec-
essaiy les, its time to deploy Lifeiay.
1. Navigate to $JBOSS_HOME/../server/default/deploy/ROOT.war and delete
all the content of the foldei.
14.11. INSTALLING LIFERAY ON JBOSS 5.1 48
2. Extiact the contents of the Lifeiay WAR le into this foldei.
3. Cieate a le named jboss-classloading.xml in
$JBOSS_HOME/../server/default/ROOT.war/WEB-INF
and add the following contents to it
<classloading xmlns="urn:jboss:classloading:1.0"
parent-first="false"
domain="LiferayDomain"
export-all="NON_EMPTY"
import-all="true">
</classloading>
Tis conguiation le denes a domain that does not allow paient classes to
load ist. lnstead, Lifeiay Poitals classes aie expoited. Since JBoss comes
with its own Hibeinate JARs, the above conguiation is needed to tell Lifeiay
to ignoie these JARs and to use its own JARs instead. lf you omit this con-
guiation, you may encountei a Hibeinate exception. lts also necessaiy to
add a jboss-classloading.xml le to the WEB-INF foldei of each Lifeiay
plugin, see the Deploying Plugins section below.
4. Cieate a portal.ext.properties le in $LIFERAY_HOME (one level above
$JBOSS_HOME) and add the following piopeities
hibernate.validator.apply_to_ddl=false
hibernate.validator.autoregister_listeners=false
. Delete the following les fiomthe $JBOSS_HOME/ROOT.war/WEB-INF/lib
jaxrpc.jar
stax.jar
xercesImpl.jar
xml-apis.jar
. Add the following lines to youi portal.ext.properties le
NOTE Te autodeploy foldei must be set with the full name of the foldei,
you cant use any vaiiables to dene the location.
auto.deploy.jboss.dest.dir=${jboss.home.dir}/server/default/deploy
auto.deploy.deploy.dir=C:/JBoss-<version>/deploy
. Stait the JBoss Application Seivei.
Lifeiay is now successfully installed on JBoss .1.
48 CHAPTER 14. INSTALLATION AND SETUP
Deploying plugins
Add a jboss-classloading.xml to the WEB-INF foldei of each plugin, with
the following content
<classloading xmlns="urn:jboss:classloading:1.0"
domain="PLUGINNAME-portlet"
parent-domain="LiferayDomain"
parent-first="false"
top-level-classloader="false"
export-all="NON_EMPTY"
import-all="false">
</classloading>
Te LiferayDomain iefeienced in the above conguiation is the domain we
dened above duiing step 3 of the Deploying Liferay section. Conguiing plu-
gins to use the Lifeiay domain ensuies that if JBoss and Lifeiay have dieient
veisions of a JAR le, the plugin uses Lifeiays veision. Without this congu-
iation, Lifeiay plugins might end up using the wiong veisions of JAR les. You
can conguie this befoie oi afei the plugin WAR is deployed, as long as JBoss
is not iunning. Of couise, its best to make this conguiation befoie deploy-
ment. Otheiwise, if theies a JAR conict, youll have to shut down youi seivei,
conguie the plugin to use the Lifeiay domain, and iestait the seivei.
To set up a hot deploy foldei and have plugins automatically copied to the
iight place, add the following lines to youi portal-ext.properties le
\index{plugin}
\index{hot deploy}
auto.deploy.jboss.dest.dir=${jboss.home.dir}/server/default/deploy
auto.deploy.deploy.dir=/opt/jboss-eap-5.1/deploy
Te ist line is the value foi the default seivei, if youve installed Lifeiay in
something othei than the default, change it accoidingly. Te path in the second
line should point to the deploy foldei conguied foi JBoss.
Lifeiay also iuns on JBoss . Lets see how wed get it installed on that
veision of JBoss.
14.12 Installing Liferay on JBoss 7
Liferay Home is one foldei above JBosss install location.
1. Download and install JBoss AS .0.x into youi piefeiied diiectoiy. Tis di-
iectoiy is iefeiied to as $JBOSS_HOME thioughout this section.
14.12. INSTALLING LIFERAY ON JBOSS 7 48
2. Download the latest veision of the Lifeiay Poital .war le.
3. Download Lifeiays Poital Dependencies.
Now that you have all of youi installation les, you aie ieady to stait in-
stalling and conguiing Lifeiay on JBoss.
Dependency Jars
Lets woik with the dependency jai les ist.
1. Cieate foldei $JBOSS_HOME/modules/com/liferay/portal/main and un-
zip the jai les found in the Lifeiay Poital Dependencies zip le to this foldei.
Make suie theie aie no subdiiectoiies, the les should be in this foldei di-
iectly.
2. Download youi database diivei .jar le and put it into the same foldei as
above. loi demonstiation puiposes, well download the MySQL Connectoi/J
diivei fiom hup//dev.mysql.com/downloads/connectoi/j/ and put its .jar
le into the $JBOSS_HOME/modules/com/liferay/portal/main foldei.
3. Cieate the le module.xml in the $JBOSS_HOME/modules/com/liferay/por-
tal/main foldei and inseit the following contents.
<?xml version="1.0"?>
<module xmlns="urn:jboss:module:1.0" name="com.liferay.portal">
<resources>
<resource-root path="mysql-connector-java-5.1.18-bin.jar" />
<resource-root path="portal-service.jar" />
<resource-root path="portlet.jar" />
</resources>
<dependencies>
<module name="javax.api" />
<module name="javax.mail.api" />
<module name="javax.servlet.api" />
<module name="javax.servlet.jsp.api" />
<module name="javax.transaction.api" />
</dependencies>
</module>
lf youie using a dieient database diivei, ieplace the path of the MySQL
iesouice ioot entiy with that of youi database diivei.
Gieat' You have youi .jar les ieady foi youi domain.
488 CHAPTER 14. INSTALLATION AND SETUP
Conguring JBoss
Lets make some adjustments in youi conguiation to suppoit using Lifeiay.
You can specify the JBoss seivei instances conguiation in the XML le
$JBOSS_HOME/standalone/configuration/standalone.xml. Well iefei
to this le simply as standalone.xml. You must also make some modica-
tions to youi conguiation and staitup sciipts found in the $JBOSS_HOME/bin/
foldei. But lets stait with the changes to standalone.xml.
1. Make the following modications to standalone.xml.
2. Disable the welcome ioot of the web subsystems viitual seivei default host
by specifying enable-welcome-root="false".
<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
<connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost" />
<alias name="example.com" />
</virtual-server>
</subsystem>
3. lnseit the following <configuration> element within the web subsystem
element
<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
<configuration>
<jsp-configuration development="true" />
</configuration>
4. Add a timeout foi the deployment scannei by seuing deployment-timeout="120"
as seen in the exceipt below.
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
<deployment-scanner name="default" path="deployments" scan-enabled="true"
scan-interval="5000" relative-to="jboss.server.base.dir" deployment-timeout="120"/>
</subsystem>
. Add the following JAAS secuiity domain to the secuiity subsystem<security-domains>
dened in element <subsystem xmlns="urn:jboss:domain:security:1.0">.
<security-domain name="PortalRealm">
<authentication>
<login-module code="com.liferay.portal.security.jaas.PortalLoginModule" flag="required"/>
</authentication>
</security-domain>
14.12. INSTALLING LIFERAY ON JBOSS 7 489
Now its time foi some changes to youi conguiation and staitup sciipts.
2. Make the following modications to youi standalone domains conguiation
sciipt le standalone.conf (standalone.conf.bat on Windows) found
in youi $JBOSS_HOME/bin/ foldei.
Tese modications change the following options
Set the le encoding
Set the usei time-zone
Set the piefeiied piotocol stack
lnciease the default amount of memoiy available.
Make the following edits as applicable to youi opeiating system
On Windows, comment out the initial JAVA_OPTS assignment as demon-
stiated in the following line
iem set JAVAOPTS-Xms4M -Xmx12M -XXMaxPeimSize2M
Ten add the following JAVA_OPTS assignment one line above the :JAVA_OPTS_SET
line found at end of the le
set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true \
-Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
On Unix, meige the following values into youi seuings foi JAVA_OPTS
ieplacing any matching auiibutes with the ones found in the assignment
below
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true \
-Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m
Te piesciibed sciipt modications aie now complete foi youi Lifeiay in-
stallation on JBoss. Next well considei the database and mail conguiation.
490 CHAPTER 14. INSTALLATION AND SETUP
Database Conguration
lf you want JBoss to manage youi data souice, follow the instiuctions in this
section. lf you want to use the built-in Lifeiay data souice, you can skip this
section.
Modify standalone.xml adding youi data souice and diivei within the
<datasources> element of youi data souices subsystem.
1. liist, add youi data souice within the <datasources> element.
<datasource jndi-name="java:/jdbc/LiferayPool"
pool-name="LiferayPool"
enabled="true"
jta="true"
use-java-context="true"
use-ccm="true">
<connection-url>
jdbc:mysql://localhost/lportal
</connection-url>
<driver>
mysql
</driver>
<security>
<user-name>
root
</user-name>
<password>
root
</password>
</security>
</datasource>
Be suie to ieplace the URL database value (i.e. lportal), usei value and
passwoid value with values specic to youi database.
2. Ten add youi diivei to the <drivers> element also found within the <datasources>
element.
<drivers>
<driver name="mysql" module="com.liferay.portal"/>
</drivers>
Youi nal data souices subsystem should look something like this
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:/jdbc/LiferayPool"
pool-name="LiferayPool"
14.12. INSTALLING LIFERAY ON JBOSS 7 491
enabled="true"
jta="true"
use-java-context="true"
use-ccm="true">
<connection-url>
jdbc:mysql://localhost/lportal
</connection-url>
<driver>
mysql
</driver>
<security>
<user-name>
root
</user-name>
<password>
root
</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.liferay.portal"/>
</drivers>
</datasources>
</subsystem>
Now that youve conguied youi data souice, lets go ovei how to conguie
youi mail session within JBoss.
Mail Conguration
At the time this document was wiiuen, JavaMail was not yet suppoited in
JBoss AS .0.1 - howevei, it was implemented in the JBoss AS .1 alpha (see
hups//issues.jboss.oig/biowse/AS-11. lf you want JBoss to manage youi
mail session, use the following instiuctions which aie based on the implemen-
tation found in JBoss AS .1 alpha. lf you want to use the built-in Lifeiay mail
session, you can skip this section.
Specify youi mail subsystem in standalone.xml as in the following exam-
ple
<subsystem xmlns="urn:jboss:domain:mail:1.0">
<mail-session jndi-name="java:/mail/MailSession" >
<smtp-server address="smtp.gmail.com" port="465">
<login name="username" password="password"/>
</smtp-server>
<pop3-server address="pop.gmail.com" port="110"/>
<imap-server address="imap.gmail.com" port="993">
<login name="username" password="password"/>
</imap-server>
</mail-session>
</subsystem>
492 CHAPTER 14. INSTALLATION AND SETUP
Youve got mail' Next, well make suie Lifeiay is conguied to piopeily
connect with youi new mail session and database.
Conguring data sources and mail sessions
Now that youi data souice and mail session aie set up, you need to ensuie Lif-
eiay Poital can access them.
1. liist, navigate to the Lifeiay Home foldei, which is one foldei above JBosss
install location (i.e. $JBOSS/..).
2. lf youie using JBoss to manage youi data souice, add the following to youi
portal-ext.properties le in youi Liferay Home to iefei to youi data
souice
jdbc.default.jndi.name=java:jdbc/LiferayPool
lf youie using Liferay Portal to manage youi data souice, follow the instiuc-
tions in the Deploy Liferay section foi using the setup wizaid.
3. lf youie using Liferay Portal to manage youi mail session, this conguiation
is done within Lifeiay Poital. Tat is, afei staiting youi poital as desciibed
in the Deploy Liferay section, go to Control Panel Server Administration
Mail and entei the seuings foi youi mail session.
lf youie using JBoss to manage youi mail session, add the following to youi
portal-ext.properties le to iefeience that mail session
mail.session.jndi.name=java:mail/MailSession
Youve completed the steps necessaiy foi youi deployment of Lifeiay so Lif-
eiay Poital can now communicate with youi data souice and mail sessionway
to go' Now youie ieady to deploy Lifeiay Poital.
Deploy Liferay
1. lf the foldei $JBOSS_HOME/standalone/deployments/ROOT.war alieady
exists in youi JBoss installation, delete all of its subfoldeis and les. Othei-
wise, cieate a newfoldei $JBOSS_HOME/standalone/deployments/ROOT.war.
2. Unzip the Lifeiay .war le into the ROOT.war foldei.
14.12. INSTALLING LIFERAY ON JBOSS 7 493
3. To tiiggei deployment of ROOT.war, cieate an empty le named ROOT.war.do-
deploy in youi $JBOSS_HOME/standalone/deployments/ foldei. On staitup,
JBoss detects the piesence of this le and deploys it as a web application.
4. Remove eclipselink.jar fiom$JBOSS_HOME/standalone/deployments-
/ROOT.war/WEB-INF/lib to assuie the Hibeinate peisistence piovidei is
used instead of the one piovided in the eclipselink.jar. Note, JBoss .0.2
has a known issue hup//community.jboss.oig/thiead/19944 in deteimining
which peisistence piovidei to use.
. Befoie you stait Lifeiay Poital, lets considei whethei you want to also stait
the setup wizaid.
Start the setup wizard along with Liferay Portal - Do this if you want
to conguie youi poital, set up youi sites administiative account and/oi
manage youi database within Lifeiay.
lf this is youi ist time staiting Lifeiay Poital .1, the setup wizaid is invoked
on seivei staitup. lf you want to ie-iun the wizaid, specify setup.wizard.en-
abled=true in youi piopeities le (e.g. portal-setup-wizard.properties).
setup.wizard.enabled=true
Te setup wizaid is invoked duiing seivei staitup.
Start Liferay Portal without invoking the setup wizard - Do this if want
to pieseive youi cuiient poital seuings.
To stait the seivei without tiiggeiing the setup wizaid, specify setup.wiz-
ard.enabled=false in youi piopeities (e.g. portal-setup-wizard.pro-
perties oi portal-ext.properties le).
setup.wizard.enabled=false
Te portal-setup-wizard.properties le the setup wizaid cieates has
setup.wizard.enabled=false conveniently specied foi you.

Piopeity values in portal-setup-wizard.properties


oveiiide piopeity values in portal-ext.properties.
494 CHAPTER 14. INSTALLATION AND SETUP
Now its time to stait Lifeiay Poital on JBoss'
. Stait the JBoss application seivei.
lf the setup wizaid was disabled, youi sites home page opens automati-
cally in youi biowsei at hup//localhost8080.
Otheiwise, the setup wizaid opens in youi biowsei.
See the section on the setup wizaid above foi how to use Lifeiays setup
wizaid.
Now you aie tiuly the boss when it comes to deploying Lifeiay Poital on
JBoss'
14.13 Installing Liferay on JOnAS 5.2
JOnAS is somewhat unique among the open-souice application seiveis foi two
ieasons it is built entiiely on an OSGi coie, allowing foi dynamic deployment
of simultaneous webapps and containeis and allows the clean sepaiation of the
conguiation diiectoiy fiom the seivei itself. ln fact, the sepaiation of the con-
guiation is iecommended by the developeis of JOnAS as a way to cleanly de-
ploy so you can ieveit to default seuings latei.
lf you dont have an existing JOnAS installation, it is iecommeded to use the
available Lifeiay-JOnAS bundle.
10
Given the unique natuie of the seivei, theie aie a few steps to considei in
the conguiation stage. Otheiwise, installing on JOnAS follows much the same
pauein as othei seiveis conguie, copy dependencies and deploy.
Conguring JOnAS for Liferay
A piistine JOnAS installation comes with a numbei of samples, tutoiials and
template conguiation les. A lot of this is unnecessaiy and iiielevant foi in-
stalling Lifeiay. ln addition, the seivei alieady contains an application deployed
to the ioot context, which you must iemove piioi to installing the Lifeiay .war
package (and which youd want to iemove anyway foi a pioduction conguia-
tion). JOnAS allows you to decide wheie to place all the seivei conguiation
and deployment seuings, also called $JONAS_BASE. Te foldei cieated by un-
zipping the JOnAS application (likely called jonas-full-5.2.2 oi similai) is
10
hup//www.lifeiay.com/ja/downloads/lifeiay-poital/available-ieleases
14.13. INSTALLING LIFERAY ON JONAS 5.2 49
iefeiied to as $JONAS_ROOT. Tis allows a unique, clean sepaiation between
application and conguiation.
Te stiuctuie of $JONAS_BASE is
/conf - configuration files
/deploy - main deployment directory (Liferay is deployed here)
/lib - used for extending the main server classloaders
+----/ext - extensions for unbundled applications
/logs - logs for the running instance
/work - the working directory, used by containers such as Tomcat
/repositories - contains OSGi bundles for deployment; not used for Liferay installation
By default, the $JONAS_BASE diiectoiy is the same as $JONAS_ROOT. Cieat-
ing a new $JONAS_BASE is a simple piocess, outlined in the JOnAS Conguia-
tion Guide.
11
To iemove sample les and unneeded conguiation
1. Navigate to the diiectoiy you unpackaged JOnAS into, $JONAS_BASE.
2. lind the following sample diiectoiies and iemove them
/examples
/tutoiial
3. Navigate to $JONAS_BASE/conf and iemove the following les
db2.piopeities
liiebiidSQL.piopeities
HSQL1.piopeities
jetty\*.xml
lnstantDB1.piopeities
lnteiBase1.piopeities
MailMimePaitDS1.piopeities
MailSession1.piopeities
McKoi1.piopeities
11
hup//jonas.ow2.oig/JONAS22/doc/doc-en/html/conguiationguide.html
49 CHAPTER 14. INSTALLATION AND SETUP
MySQL.piopeities
Oiacle1.piopeities
PostgieSQL1.piopeities
spy.piopeities
Sybase1.piopeities
Tis disables the default seuings foi the databases available in JOnAS, as well
as iemoving conguiation foi Jeuy as a containei to use foi the webapp.
4. To iemove the default application installed on the ioot context
a. Go to the $JONAS_BASE/deploy diiectoiy and iemove
ctxioot.xml
doc.xml
jdbc-ds.xml
jonasAdmin.xml
b. Go to the $JONAS_ROOT/repositories diiectoiy to iemove the application
by iemoving
oig/moitbay/
oig/ow2/jonas/documentation/
oig/ow2/jonas/jonas-admin/
oig/ow2/jonas/jonas-ctxioot/
Tis will fully iemove the Maven deployment plan and aitifact foi the JOnAS
default application, as well as the administiation console fiom loading on the
ioot context.
Now that JOnAS is piepaied foi conguiing Lifeiay to iun on the seivei as
its ioot application, you can begin tuning the seuings foi Lifeiay. By default,
JOnAS has its own deployment of Hypeisonic it uses inteinally. Tis inteinal
use of HSQL must be disabled, along with othei JOnAS seivices, so they wont
conict with Lifeiays.
To tuin of HSQL and othei JOnAS-level seivices
14.13. INSTALLING LIFERAY ON JONAS 5.2 49
1. Open the le jonas.properties in the diiectoiy $JONAS_BASE/conf.
2. lind the conguiation section foi the JOnAS database managei, staiting
aiound line 340
#
###################### JOnAS DBM Database service configuration
...
jonas.service.dbm.datasources hsql
3. Change the datasouices denition aiound line 33 to iead
jonas.service.dbm.datasources
Teieby pieventing the HSQL database fiom being used inteinally.
4. lind the seivices conguiation aiound line 82
jonas.services jtm,db,security,resource,ejb3,jaxws,web,ear,depmonitor
. Modify the seivices being loaded to iead
jonas.services jtm,resource,ejb3,jaxws,web,ear,validation,depmonitor
Tis pievents the inteinal db and security seivices fiom inteifeiing with
Lifeiay.
. To put JOnAS into pioduction mode foi piopei deployment of Lifeiay, nd
the piopeity aiound line 1
jonas.development true
And change it to false
jonas.development false
Tis allows JOnAS to staitup appiopiiately with Lifeiay installed.
498 CHAPTER 14. INSTALLATION AND SETUP
Conguring Containers in JOnAS
Now that the application seivei has all extianeous seivices and applications
disabled, you can now tweak the conguiation of the containeis within JOnAS
Tomcat and OSGi. By default, the Tomcat containei is set to listen on a dieient
HTTP poit and HTTPS poit than Lifeiay uses by default.
To change the Tomcat poits foi Lifeiays use
1. Open the le tomcat6-server.xml inside of $JONAS_BASE/conf.
2. lind the Connector denition aiound line 9
<Connector port="9000" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="9043" />
Change it to ieect the default poits
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
3. lf you aie using any othei seuings in Tomcats seivei seuings, you can adjust
the poits if needed (such as changing the AJP poit fiom 9009 to 8009.
To modify the OSGl defaults to ensuie iequiied java packages aie boot-
siapped by the loadei
1. Open the le defaults.properties inside of $JONAS_BASE/conf/osgi.
2. lind the declaiation foi javase-packages aiound line 93
javase-packages \${javase-\$\{javase.version\}\}
And add the following packages to make it iead
javase-packages \${javase-\$\{javase.version\}\},
com.sun.jmx.mbeanserver, com.sun.crypto.provider,
org.apache.felix.framework
To ensuie the iequiied packages aie loaded.
14.13. INSTALLING LIFERAY ON JONAS 5.2 499
Starting JOnAS
Once you have the iequiied conguiation in place, all that is lef is to copy
the poital dependencies and the Lifeiay .war le and stait the seivei. JOnAS
maintains libiaiies inside $JONAS_BASE/lib/ext and the application inside
$JONAS_BASE/deploy.
To install liferay-portal-dependencies-6.1.x-<date>.zip
1. Unzip the aichive liferay-portal-dependencies-6.1.x-<date>.zip
on youi local lesystem.
2. Navigate to $JONAS_BASE/lib/ext.
3. Copy the .jar les fiomliferay-portal-dependencies-6.1.x-<date>/
to $JONAS_BASE/lib/ext.
4. lnstall any additional libiaiies needed, such as database connectois.
To deploy the liferay-portal-6.1.x-<date>.war le
1. Copy the liferay-portal-6.1.x-<date>.war le fiom its cuiient diiec-
toiy.
2. Navigate to $JONAS_BASE/deploy.
3. Paste the liferay-portal-6.1.x-<date>.war le into the deploy diiec-
toiy.
Once the necessaiy les have been installed, all that is needed is to stait
JOnAS
1. Navigate to $JONAS_BASE/bin.
2. Run the command jonas.bat start on Windows and ./jonas start on
UNlX-lixe systems.
JOnAS staits and Lifeiay opens a biowsei to http://localhost:8080.
00 CHAPTER 14. INSTALLATION AND SETUP
14.14 Installing Liferay on Resin 4
Liferay Home is one foldei above Resins install location.
loi this section, we will iefei to youi Resin seiveis installation location
as $RESIN_HOME. lf you do not alieady have an existing Resin seivei, we iec-
ommend you download a Lifeiay/Resin bundle.
12
lf you have an existing Resin
seivei oi would like to install Lifeiay on Resin manually, please follow the steps
below.
Befoie you begin, make suie you have downloaded the latest Lifeiay .war
le and Lifeiay Poital dependencies.
13
Te Lifeiay .war le should be called
liferay-portal-6.1.x-<date>.war and the dependencies le should be called
liferay-portal-dependencies-6.1.x-<date>.zip.
Now that you have all of youi installation les, you aie ieady to stait in-
stalling and conguiing Lifeiay on Resin.
Dependency Jars
Lets woik with the dependency jai les ist.
1. Unzip the jai les found in the Lifeiay Poital Dependencies zip le to youi
$RESIN_HOME/ext-lib foldei. Take caie to extiact the zip les .jar les
diiectly into this foldei.
2. Next, you need seveial .jar les which aie included as pait of the Lifeiay
souice distiibution. Many application seiveis ship with these alieady on
the class path but Resin does not. Te best way to get the appiopiiate vei-
sions of these les is to download the Lifeiay souice code and get them
fiom theie. Once you have downloaded the Lifeiay souice, unzip the souice
into a tempoiaiy foldei. Well iefei to the location of the Lifeiay souice as
$LIFERAY_SOURCE.
3. Go to $LIFERAY_SOURCE/lib/development and copy saxpath.jar into
$RESIN_HOME/lib.
4. Copy the following les fiom$LIFERAY_SOURCE/lib/portal to $RESIN_-
HOME/lib.
12
hup//www.lifeiay.com/downloads/lifeiay-poital/available-ieleases
13
hup//www.lifeiay.com/downloads/lifeiay-poital/additional-les
14.14. INSTALLING LIFERAY ON RESIN 4 01
log4j.jar
slf4j-api.jar
slf4j-log4j12.jar
lf foldei $RESIN_HOME/extlib doesnt exist, cieate it.
. Make suie the JDBC diivei foi youi database is accessible by Resin. Obtain
the JDBC diivei foi the database you want to use. ln the case of MySQL, use
mysql-connector-java-{$version}-bin.jar. You can download the
latest MySQL JDBCdiivei fiomhup//www.mysql.com/pioducts/connectoi/.
Extiact the JAR le and copy it to $RESIN_HOME/extlib.
Gieat' now you have youi .jar les in place. Next, lets conguie Resin foi
Lifeiay.
Conguring Resin
Te piimaiy le used in conguiing youi domain is $RESIN_HOME/conf/res-
in.xml. You need to make common modications necessaiy to suppoit Lifeiay
Poital. Youll also cieate a iun sciipt and add a foldei to hold Resins logs. But
lets stait with the changes to resin.xml.
1. Make the following modications to youi resin.xml. Tese modications
to youi application clustei make the following conguiation changes
Set the le encoding.
Set the piefeiied piotocol stack.
Set the usei time-zone.
lnciease the default amount of memoiy available.
To accomplish this, inseit the following <jvm-arg> elements as seivei de-
faults foi youi main application clustei. Please see the following example
<cluster id="app-tier">
...
<server-default>
...
<jvm-arg>-Dfile.encoding=UTF-8</jvm-arg>
<jvm-arg>-Djava.net.preferIPv4Stack=true</jvm-arg>
<jvm-arg>-Duser.timezone=GMT</jvm-arg>
<jvm-arg>-Xmx1024m</jvm-arg>
02 CHAPTER 14. INSTALLATION AND SETUP
<jvm-arg>-XX:MaxPermSize=256m</jvm-arg>
...
</server-default>
</cluster>
2. Cieate an appiopiiate sciipt in $RESIN_HOME/bin to help you stait Resin.
lf youie on Windows, cieate a batch sciipt $RESIN_HOME/bin/run.bat
and inseit the following text in the sciipt
..\resin.exe console
lf youie on Unix/Linux, cieate shell sciipt $RESIN_HOME/bin/run.sh
and inseit the following text in the sciipt
#!/bin/sh
./resin.sh $
3. Cieate the foldei $RESIN_HOME/log if it doesnt alieady exist. As you iun
Resin, the seivei geneiates these log les heie
access
jvm-default
watchdog-manager
Now that youve completed some impoitant common conguiation tasks to
suppoit Lifeiay, lets considei database conguiation.
Database Conguration
lf you want to manage youi data souice within Resin, continue following the
instiuctions in this section. lf you want to use the built-in Lifeiay data souice,
you can skip this section.
Management of databases in Resin is done via the conguiation le $RESIN_-
HOME/conf/resin.xml. Edit resin.xml and inseit a <database> element foi
youi database. Be suie to give it the JNDl name jdbc/LiferayPool and add it
within the application tiei clustei element as in the example below
14.14. INSTALLING LIFERAY ON RESIN 4 03
<cluster id="app-tier">
...
<database>
<jndi-name>jdbc/LiferayPool</jndi-name>
<driver type="com.mysql.jdbc.Driver">
<url>jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8</url>
<user>root</user>
<password>root</password>
</driver>
<prepared-statement-cache-size>8</prepared-statement-cache-size>
<max-connections>20</max-connections>
<max-idle-time>30s</max-idle-time>
</database>
...
</cluster>
Be suie to ieplace the URL database value (i.e. lportal), usei value and
passwoid value with values specic to youi database.
Resin is now managing youi database connection. Lets considei next how
to conguie mail.
Mail Conguration
lf you want to manage youi mail session within Resin, use the following in-
stiuctions. lf you want to use the built-in Lifeiay mail session, you can skip this
section.
Management of mail sessions in Resin is done via the conguiation le $RES-
IN_HOME/conf/resin.xml. Edit resin.xml and inseit a <mail> element that
species youi mail session. Be suie to give it the JNDl name mail/MailSession.
Add youi mail element within the application tiei clustei element. Use the ex-
ample below, ieplacing its values with the values of youi mail session.
<cluster id="app-tier">
...
<mail jndi-name="mail/MailSession">
<properties>
mail.pop3.host=pop.gmail.com
mail.pop3.port=110
mail.pop3.user=
mail.pop3.password=
mail.smtp.host=smtp.gmail.com
mail.smtp.password=password
mail.smtp.user=user
mail.smtp.port=465
mail.transport.protocol=smtp
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.imap.host=imap.gmail.com
mail.imap.port=993
04 CHAPTER 14. INSTALLATION AND SETUP
mail.store.protocol=imap
</properties>
</mail>
...
</cluster>
You can specify additional piopeities foi youi mail session as needed.
Now that youi mail session is squaied away, well make suie Lifeiay can
access it.
Conguring data source and mail session
Lets make suie Lifeiays connected to youi data souice and mail session.
1. liist, navigate to the Liferay Home foldei, which is one foldei above Resins
install location (i.e. $RESIN_HOME/..).
2. lf youie using Resin to manage youi data souice, add the following to youi
portal-ext.properties le in youi Liferay Home to iefei to youi data
souice
jdbc.default.jndi.namejdbc/LifeiayPool
lf youie using Liferay Portal to manage youi data souice, follow the instiuc-
tions in the Deploy Liferay section foi using the setup wizaid.
3. lf want to use Liferay Portal to manage youi mail session, conguie the mail
session within Lifeiay Poital. Tat is, afei staiting youi poital as desciibed
in the Deploy Liferay section, go to Control Panel Server Administration
Mail and entei the seuings foi youi mail session.
lf youie using Resin to manage youi mail session, add the following to youi
portal-ext.properties le to iefeience that mail session
mail.session.jndi.name=mail/MailSession
Gieat' Now Lifeiay can access youi database and youi mail session. Now,
lets deploy Lifeiay.
14.14. INSTALLING LIFERAY ON RESIN 4 0
Deploy Liferay
Lifeiay can be deployed as an exploded web aichive within $RESIN_HOME/webapps.
1. lf you alieady have an application foldei $RESIN_HOME/webapps/ROOT, delete
it oi move it to a location outside of $RESIN_HOME/webapps.
2. Extiact the contents of the Lifeiay poital .war le into RESIN_HOME/web-
apps/ROOT. Te following les should now exist in youi RESIN_HOME/web-
apps/ROOT foldei
dtd (foldei)
eiiois (foldei)
html (foldei)
layouupl (foldei)
META-lNl (foldei)
wap (foldei)
WEB-lNl (foldei)
index.jsp
3. Befoie you stait Lifeiay Poital, considei whethei you want to also stait the
setup wizaid.
Start the setup wizard along with Liferay Portal - Do this if you want
to conguie youi poital, set up youi sites administiative account and/oi
manage youi database within Lifeiay.
lf this is youi ist time staiting Lifeiay Poital .1, the setup wizaid is in-
voked on seivei stait up. lf you want to ie-iun the wizaid, specify setup.wiz-
ard.enabled=true in youi piopeities le (e.g. portal-setup-wizard.pro-
perties).
setup.wizard.enabled=true
Te setup wizaid is invoked duiing seivei staitup.
Start Liferay Portal without invoking the setup wizard - Do this if want
to pieseive youi cuiient poital seuings.
0 CHAPTER 14. INSTALLATION AND SETUP
To stait the seivei without tiiggeiing the setup wizaid, specify setup.wiz-
ard.enabled=false in youi piopeities (e.g. portal-setup-wizard.pro-
perties oi portal-ext.properties le).
setup.wizard.enabled=false
Te portal-setup-wizard.properties le the setup wizaid cieates has
setup.wizard.enabled=false conveniently specied foi you.

Piopeity values in portal-setup-wizard.properties


oveiiide piopeity values in portal-ext.properties.
4. Stait Lifeiay Poital by executing youi run.bat (Windows) oi run.sh (Unix/Linux)
sciipt fiom $RESIN_HOME/bin.
lf the setup wizaid was disabled, youi sites home page opens in youi
biowsei at hup//localhost8080.
Otheiwise, the setup wizaid opens in youi biowsei.
Please see the section above desciibing how to use the setup wizaid.
Congiatulations' Youve installed Lifeiay Poital on Resin and have it up and
iunning.
14.15 Installing Liferay on Tomcat 7
Liferay Home is one foldei above Tomcats install location.
loi this section, we will iefei to youi Tomcat seiveis installation location
as $TOMCAT_HOME. lf you do not alieady have an existing Tomcat seivei, we
iecommend you download a Lifeiay/Tomcat bundle.
14
lf you have an existing
Tomcat seivei oi would like to install Lifeiay on Tomcat manually, please follow
the steps below.
Befoie you begin, make suie you have downloaded the latest Lifeiay .war
le and Lifeiay Poital dependencies.
1
Te Lifeiay .war le should be called
14
hup//www.lifeiay.com/downloads/lifeiay-poital/available-ieleases
1
hup//www.lifeiay.com/downloads/lifeiay-poital/additional-les
14.15. INSTALLING LIFERAY ON TOMCAT 7 0
liferay-portal-6.1.x-<date>.war and the dependencies le should be called
liferay-portal-dependencies-6.1.x-<date>.zip.
Next, lets get staited by addiessing Lifeiays libiaiy dependencies.
Dependency Jars
Lifeiay Poital needs to have the Lifeiay Poital Dependency JARs, an appiopiiate
JDBC diivei and a few othei JARs installed.
1. Cieate foldei $TOMCAT_HOME/lib/ext.
2. Extiact the Lifeiay dependencies le to $TOMCAT_HOME/lib/ext. lf the les
do not extiact to this diiectoiy, you can copy the dependencies aichive to this
diiectoiy, extiact them and then delete the aichive.
3. Next, you need seveial .jar les which aie included as pait of the Lifeiay
souice distiibution. Many application seiveis ship with these alieady on
the class path but Tomcat does not. Te best way to get the appiopiiate
veisions of these les is to download the Lifeiay souice code and get them
fiom theie. Once you have downloaded the Lifeiay souice, unzip the souice
into a tempoiaiy foldei. Well iefei to the location of the Lifeiay souice as
$LIFERAY_SOURCE.
4. Copy the following jais fiom$LIFERAY_SOURCE/lib/development to youi
$TOMCAT_HOME/lib/ext foldei
activation.jar
jms.jar
jta.jar
jutf7.jar
mail.jar
persistence.jar
2. Copy the following jai fiom$LIFERAY_SOURCE/lib/portal to youi $TOMCAT_HOME/lib/ext
foldei
ccpp.jar
08 CHAPTER 14. INSTALLATION AND SETUP
Note: Tomcat useis should not copy the ccpp.jar le into theii $TOM-
CAT_HOME/lib/ext foldei and should delete it fiom this foldei if it alieady
exists.
3. Copy the following jais fiom$LIFERAY_SOURCE/lib/development to youi
$TOMCAT_HOME/temp/liferay/com/liferay/portal/deploy/dependen-
cies foldei
resin.jar
script-10.jar
4. Make suie the JDBC diivei foi youi database is accessible by Tomcat. Obtain
the JDBCdiivei foi youi veision of the database seivei. ln the case of MySQL,
use mysql-connector-java-{$version}-bin.jar.
1
Extiact the JAR le
and copy it to $TOMCAT_HOME/lib/ext.
. Lifeiay iequiies an additional .jai on Tomcat installations to manage tiansac-
tions. Tis is included in the bundle but you need to add it if youie installing
Lifeiay manually.
1
Place this le in Tomcats lib/ext foldei.
Now that you have the necessaiy libiaiies in place, well move on to cong-
uiing youi domain.
Tomcat Conguration
Te steps in this section focus on
Seuing enviionment vaiiables
Cieating a context foi youi web application
Modifying the list of classes/JARs to be loaded
Specifying URl encoding
Lets get staited with oui conguiation tasks.
1
You can download the latest MySQL JDBC diivei fiom
hup//www.mysql.com/pioducts/connectoi/
1
You may nd this .jai heie hup//www.oiacle.com/technetwoik/java/javaee/jta/index.html
14.15. INSTALLING LIFERAY ON TOMCAT 7 09
1. Cieate a setenv.bat (Windows) oi setenv.sh le (Unix, Linux, Mac OS)
in the $TOMCAT_HOME/bin diiectoiy. When you stait Tomcat, Catalina calls
setenv.bat oi setenv.sh. Edit the le and populate it with following con-
tents
setenv.bat
if exist "%CATALINA_HOME%/jre@java.version@/win" (
if not "%JAVA_HOME%" == "" (
set JAVA_HOME=
)
set "JRE_HOME=%CATALINA_HOME%/jre@java.version@/win"
)
set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true \
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false \
-Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
setenv.sh:
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8 \
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false \
-Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m"
Tis sets the chaiactei encoding to UTl-8, sets the time zone to Gieenwich
Mean Time and allocates memoiy to the Java viitual machine.
2. Cieate the diiectoiy $TOMCAT_HOME/conf/Catalina/localhost and cie-
ate a ROOT.xml le in it. Edit this le and populate it with the following
contents to set up a poital web application
<!--<Realm
className="org.apache.catalina.realm.JAASRealm"
appName="PortalRealm"
userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal"
roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole"
/>-->
<!--
Uncomment the following to disable persistent sessions across reboots.
-->
<!--<Manager pathname="" />-->
<!--
Uncomment the following to not use sessions. See the property
"session.disabled" in portal.properties.
-->
\index{portal.properties}
<!--<Manager className="com.liferay.support.tomcat.session.SessionLessManagerBase" />-->
10 CHAPTER 14. INSTALLATION AND SETUP
Seuing crossContext="true" allows multiple web apps to use the same
class loadei. ln the content above you will also nd commented instiuctions and
tags foi conguiing a JAAS iealm, disabling peisistent sessions and disabling
sessions in geneial.
3. Open $TOMCAT_HOME/conf/catalina.properties and ieplace the line
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib, \
${catalina.home}/lib/*.jar
with
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib, \
${catalina.home}/lib/*.jar,${catalina.home}/lib/ext,${catalina.home}/lib/ext/*.jar
This allows Catalina to access the dependency jars you extracted to
`$TOMCAT_HOME/lib/ext`.
4. To ensuie consistent use of UTl-8 URl Encoding, edit server.xml in the
$TOMCAT_HOME/conf diiectoiy and add the auiibute URIEncoding="UTF-8"
to youi connectoi on poit 8080. Below is an example of specifying this en-
coding on the connectoi
<Connector port="8080"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />
. Make suie theie is no support-catalina.jar le in $TOMCAT_HOME/webapps.
lf you nd one, iemove it.
Excellent woik' Now lets considei conguiation of youi database.
Database Conguration
lf you want Tomcat to manage youi data souice, use the following pioceduie.
lf you want to use Lifeiays built-in data souice, you can skip this section.
1. Make suie youi database seivei is installed and woiking. lf its installed on
a dieient machine, make suie its accessible fiom youi Lifeiay machine.
2. Add youi data souice as a iesouice in the context of youi web application
specied in $TOMCAT_HOME/conf/Catalina/localhost/ROOT.xml.
14.15. INSTALLING LIFERAY ON TOMCAT 7 11
Note the above iesouice denition assumes youi database name is lportal
and youi MySQL useiname and passwoid aie both root. Youll have to update
these values with youi own database name and ciedentials.
Youi Tomcat managed data souice is now conguied. Lets move on to youi
mail session.
Mail Conguration
lf you want to manage youi mail session within Tomcat, use the following in-
stiuctions. lf you want to use the built-in Lifeiay mail session, you can skip this
section.
Cieate a mail session bound to mail/MailSession. Edit ROOT.xml in the
$TOMCAT_ HOME/conf/Catalina/localhost diiectoiy and conguie a mail
session. Be suie to ieplace the mail session values with youi own.
<Context...>
<Resource
name="mail/MailSession"
auth="Container"
type="javax.mail.Session"
mail.pop3.host="pop.gmail.com"
mail.pop3.port="110"
mail.smtp.host="smtp.gmail.com"
mail.smtp.port="465"
mail.smtp.user="user"
mail.smtp.password="password"
mail.smtp.auth="true"
mail.smtp.starttls.enable="true"
mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
mail.imap.host="imap.gmail.com"
mail.imap.port="993"
mail.transport.protocol="smtp"
mail.store.protocol="imap"
/>
</Context>
Supei' Youi mail session is conguied. Next, well make suie Lifeiay will be
able to access youi mail session and database.
Conguring your database and mail session
ln this section well specify appiopiiate piopeities foi Lifeiay to use in connect-
ing to youi database and mail session.
1. lf you aie using Tomcat to manage youi data souice, add the following to
youi portal-ext.properties le in youi Liferay Home to iefei to youi
data souice
12 CHAPTER 14. INSTALLATION AND SETUP
jdbc.default.jndi.name=jdbc/LiferayPool
Otheiwise, if you aie using Liferay Portal to manage youi data souice, follow
the instiuctions in the Deploy Liferay section foi using the setup wizaid.
2. lf want to use Liferay Portal to manage youi mail session, you can conguie
the mail session within Lifeiay Poital. Tat is, afei staiting youi poital as
desciibed in the Deploy Liferay section, go to Control Panel Server Admin-
istration Mail and entei the seuings foi youi mail session.
Otheiwise, if you aie using Tomcat to manage youi mail session, add the
following to youi portal-ext.properties le to iefeience that mail session
mail.session.jndi.name=mail/MailSession
lts just that easy' Now its time to deploy Lifeiay Poital on youi Tomcat
seivei.
Deploy Liferay
Well deploy Lifeiay as an exploded web aichive within youi $TOMCAT_HOME/web-
apps foldei.
1. lf you aie manually installing Lifeiay on a clean Tomcat seivei, delete the
contents of the $TOMCAT_HOME/webapps/ROOT diiectoiy. Tis undeploys
the default Tomcat home page. Ten extiact the Lifeiay .war le to
\$TOMCAT\_HOME/webapps/ROOT
2. Befoie you stait Lifeiay Poital, considei whethei you want to use the setup
wizaid.
Start the setup wizard along with Liferay Portal - Do this if you want
to conguie youi poital, set up youi sites administiative account and/oi
manage youi database within Lifeiay.
lf this is youi ist time staiting Lifeiay Poital .1, the setup wizaid is in-
voked on seivei staitup. lf you want to ie-iun the wizaid, specify setup.wiz-
ard.enabled=true in youi piopeities le (e.g. portal-setup-wizard.pro-
perties).
14.15. INSTALLING LIFERAY ON TOMCAT 7 13
setup.wizard.enabled=true
Te setup wizaid is invoked duiing seivei staitup.
Start Liferay Portal without invoking the setup wizard - Do this if you
want to pieseive youi cuiient poital seuings.
To stait the seivei without tiiggeiing the setup wizaid, specify setup.wiz-
ard.enabled=false in youi piopeities (e.g. portal-setup-wizard.pro-
perties oi portal-ext.properties le).
setup.wizard.enabled=false
Te portal-setup-wizard.properties le the setup wizaid cieates should
have setup.wizard.enabled=false conveniently specied foi you.

Piopeity values in portal-setup-wizard.properties


oveiiide piopeity values in portal-ext.properties.
l bet you cant wait to stait Lifeiay Poitallets do it'
3. Stait Tomcat by executing
$TOMCAT_HOME/bin/startup.bat
oi
$TOMCAT_HOME/bin/startup.sh
lf the setup wizaid was disabled, youi sites home page opens in youi
biowsei at hup//localhost8080.
Otheiwise, the setup wizaid opens in youi biowsei.
To use the setup wizaid, please see the section above.
Congiatulations on successfully installing and deploying Lifeiay on Tomcat'
14 CHAPTER 14. INSTALLATION AND SETUP
14.16 Installing Liferay on WebLogic 10
Liferay Home is one foldei above the domain to which you will be installing
Lifeiay. loi example, if youi domain location is
/Oracle/Middleware/user_projects/domains/base_domain
then youi Lifeiay Home is
/Oracle/Middleware/user_projects/domains.
loi this section, we will iefei to youi WebLogic seiveis installation location
as $WEBLOGIC_HOME.
Befoie you begin, make suie you have downloaded the latest Lifeiay .war
le and Lifeiay Poital dependencies.
18
Te Lifeiay .war le should be called
liferay-portal-6.1.x-<date>.war and the dependencies le should be called
liferay-portal-dependencies-6.1.x-<date>.zip.
Tese instiuctions assume you have alieady conguied a domain and seivei
and that you have access to the WebLogic console.

WebLogic 10.0 suppoits JDK 1. but does not suppoit JDK 1..
Now that you have all of youi installation les, you aie ieady to stait in-
stalling and conguiing Lifeiay on WebLogic.
Dependency Jars
Lifeiay iequiies seveial .jar les including the Lifeiay Dependency JARs and
a JAR le foi youi database diivei. Te following steps desciibe how to install
these .jar les piopeily.
1. Navigate to the foldei which coiiesponds to the domain to which you will
be installing Lifeiay. lnside this foldei is a lib foldei. Unzip the Lifeiay de-
pendencies aichive to this foldei so the dependency .jar les aie extiacted
into the lib foldei.
18
hup//www.lifeiay.com/downloads/lifeiay-poital/additional-les
14.16. INSTALLING LIFERAY ON WEBLOGIC 10 1
2. lf WebLogic does not alieady have access to the JDBCdiivei foi youi database,
copy the diivei to youi domains lib foldei as well.
3. You will also need the xercesImpl.jar copied to youi domains lib foldei
oi you will get SAX paising eiiois afei you deploy Lifeiay. You may down-
load this fiom hup//xeices.apache.oig.
4. Cieate a foldei $WEBLOGIC-HOME/jrockit_150_15/jre/lib/endorsed.
Ten copy commons-lang.jar, liferay-rhino.jar, serializer.jar
and xalan.jar to the endoised foldei you just cieated.
Now that you have youi WebLogic installation is loaded up with JAR les
foi Lifeiay to use, lets considei how to conguie youi database.
Database Conguration
lf you want WebLogic to manage youi data souice, use the following pioceduie.
lf you want to use Lifeiays built-in data souice, you can skip this section.
Figure 14.41: WebLogic Data Sources
1. Biowse to youi WebLogic Console. Click the Lock & Edit buuon above the
Domain Stiuctuie tiee on the lef side of the page.
2. liom the Domain Stiuctuie tiee on the lef, select Data Sources. Ten click
the New buuon on the iight side of the scieen.
1 CHAPTER 14. INSTALLATION AND SETUP
3. Give the Data Souice a name, such as LiferayDataSource.
4. Dene the JNDl name as jdbc/LiferayPool.
. Select youi Database Type, the Diivei class and then click the Next buuon.
. Accept the defaults on the next scieen by clicking Next.
. On the next scieen, put in youi Database Name, Host Name, Database User
Name and Password. lf you have been following the defaults we have been
using so fai, you would use lportal, localhost, root, and no passwoid as the
values. Click Next.
8. Te next scieen allows you to test youi database conguiation. Click the Test
Conguration buuon. lf the test succeeds, you have conguied youi database
coiiectly. Select the check box of the seivei to which you want to deploy this
Data Souice (AdminServer is the default). Click Finish.
9. Click the Activate Changes buuon on the lef, above the Domain Stiuctuie
tiee.
Gieat woik' Youi data souice can now be managed fiom within WebLogic.
Next, lets considei the mail session foi youi domain.
Mail Conguration
lf you want WebLogic to manage youi mail sessions, use the following pio-
ceduie. lf you want to use Lifeiays built-in mail sessions, you can skip this
section.
1. ln the Domain Stiuctuie tiee, select Mail Sessions. Ten click the Lock & Edit
buuon again to enable modifying these seuings.
2. Click the New buuon which is now enabled on the iight side of the scieen.
3. Give the Mail Session a name, such as LiferayMail.
4. Select youi new LifeiayMail session fiom the list by clicking on it.
. On the scieen that appeais, dene the JNDl name as mail/MailSession
and set youi JavaMail piopeities. Click the Save buuon.
. Click the Targets tab. Select the check box of the seivei to which you want
deploy this Data Souice to (AdminSeivei is the default).
14.16. INSTALLING LIFERAY ON WEBLOGIC 10 1
Figure 14.42: WebLogic: Mail Sessions
. Click the Activate Changes buuon on the lef side of the scieen, above the
Domain Stiuctuie tiee.
Now you have youi mail session specied and ieady foi Lifeiay to use.
Domain Conguration - Continued
Lets ievisit domain conguiation to make suie well be able to access youi data
souice and mail session fiom Lifeiay Poital.
1. liist, navigate to the Liferay Home foldei.
2. Ten, if you aie using WebLogic to manage youi data souice, add the follow-
ing to youi portal-ext.properties le in youi Liferay Home to iefei to
youi data souice
jdbc.default.jndi.namejdbc/LifeiayPool
Otheiwise, if you aie using Liferay Portal to manage youi data souice, follow
the instiuctions in the Deploy Liferay section foi using the setup wizaid.
3. lf want to use Liferay Portal to manage youi mail session, you can conguie
the mail session within Lifeiay Poital. Tat is, afei staiting youi poital as
desciibed in the Deploy Liferay section, go to Control Panel Server Admin-
istration Mail and entei the seuings foi youi mail session.
18 CHAPTER 14. INSTALLATION AND SETUP
Otheiwise, if you aie using WebLogic to manage youi mail session, add the
following to youi portal-ext.properties le to iefeience that mail session
mail.session.jndi.name=mail/MailSession
Lifeiay can now communicate with youi data souice and mail session. lts
now time to deploy Lifeiay'
Deploy Liferay
lollow the instiuctions in this section to deploy Lifeiay Poital to youi domain.
Befoie you deploy Lifeiay Poital, considei whethei you want to use the setup
wizaid.
Start the setup wizard along with Liferay Portal - Do this if you want
to conguie youi poital, set up youi sites administiative account and/oi
manage youi database within Lifeiay.
lf this is youi ist time staiting Lifeiay Poital .1, the setup wizaid is in-
voked on seivei staitup. lf you want to ie-iun the wizaid, specify setup.wiz-
ard.enabled=true in youi piopeities le (e.g. portal-setup-wizard.pro-
perties).
setup.wizard.enabled=true
Te setup wizaid is invoked duiing seivei staitup.
Start Liferay Portal without invoking the setup wizard - Do this if you
want to pieseive youi cuiient poital seuings.
To stait the seivei without tiiggeiing the setup wizaid, specify setup.wiz-
ard.enabled=false in youi piopeities (e.g. portal-setup-wizard.pro-
perties oi portal-ext.properties le).
setup.wizard.enabled=false
Te portal-setup-wizard.properties le the setup wizaid cieates has
setup.wizard.enabled=false conveniently specied foi you.
14.16. INSTALLING LIFERAY ON WEBLOGIC 10 19

Piopeity values in portal-setup-wizard.properties


oveiiide piopeity values in portal-ext.properties.
Now that you have enabled oi disabled the setup wizaid, lets move on to
deployment of Lifeiay Poital.
Figure 14.43: WebLogic Deployments
1. ln the Domain Stiuctuie tiee, select Deployments. Ten click the Lock & Edit
buuon above the Domain Stiuctuie tiee.
2. Click the Install buuon on the iight side of the scieen.
3. Click the Upload your le(s) link.
4. Biowse to wheie you have stoied the Lifeiay .war le, select it and then
click Next.
. Select the Lifeiay .war le fiom the list and click Next.
. Leave Install this deployment as an application selected and click Next.
. Give the application a name (the default name is ne). Leave the othei de-
faults selected and then click Finish.
8. WebLogic deploys Lifeiay. When it nishes, a summaiy scieen is displayed.
Click the Activate Changes link on the lef above the Domain Stiuctuie tiee.
9. ln the Deployments scieen, select the Lifeiay application and click the Start
buuon. Select Servicing All Requests in the pop up.
20 CHAPTER 14. INSTALLATION AND SETUP
10. Click Yes to continue on the next scieen to launch Lifeiay Poital.
lf the setup wizaid was disabled, youi sites home page opens in youi
biowsei at hup//localhost001.
Otheiwise, the setup wizaid opens in youi biowsei.
loi moie infoimation on how to use the setup wizaid, please see the section
above.
Congiatulations on youi deployment of Lifeiay Poital on WebLogic 10'
14.17 Installing Liferay on Oracle WebLogic 10.3
Liferay Home is one foldei above the domain to which you will be installing
Lifeiay.
loi example, if youi domain location is
/Oracle/Middleware/user_projects/domains/base_domain
then youi Lifeiay Home is
/Oracle/Middleware/user_projects/domains
loi this section, we will use $WEBLOGIC_HOME to iefei to youi WebLogic
seiveis installation /Oracle/Middleware.
Befoie you begin, make suie you have downloaded the latest Lifeiay .war
le and Lifeiay Poital dependencies.
19
Te Lifeiay .war le should be called
liferay-portal-6.1.x-<date>.war and the dependencies le should be called
liferay-portal-dependencies-6.1.x-<date>.zip.
Tese instiuctions assume you have alieady conguied a domain and seivei
and that you have access to the WebLogic console.
lf you still have the mainWebApp module installed, iemove it ist.

Teie is a known issue with the Sun and JRockit JVMs bun-
dled with WebLogic 10.3.2.
20
To iesolve, use Sun JVM 1..0u24
oi JRockit JVM 1..024.
Lets get staited by installing the JAR les Lifeiay needs.
19
hup//www.lifeiay.com/downloads/lifeiay-poital/additional-les
14.17. INSTALLING LIFERAY ON ORACLE WEBLOGIC 10.3 21
Dependency Jars
Lifeiay needs the JAR les contained in the Lifeiay Dependencies Aichive and
the diivei JAR le applicable foi youi database.
1. Navigate to the foldei that coiiesponds to the domain to which you will be
installing Lifeiay. lnside this foldei is a lib foldei. Unzip the Lifeiay De-
pendencies Aichive to this foldei so the dependency .jar les ieside in the
lib foldei.
2. lf WebLogic does not alieady have access to the JDBCdiivei foi youi database,
copy the diivei to youi domains lib foldei as well.
So fai so good. Youi JAR les aie in place and ieady foi Lifeiay.
Stait Oiacle WebLogic if you want to conguie youi database and/oi mail
session within Oiacle WebLogic.
Database Conguration
lf you want WebLogic to manage youi data souice, use the following pioceduie.
lf you want to use Lifeiays built-in data souice, you can skip this section.
Figure 14.44: WebLogic Data Sources
1. Select Services Data Sources. Click New Generic Data Source.
22 CHAPTER 14. INSTALLATION AND SETUP
2. Give youi data souice a name, such as Liferay Data Source. Te JNDl name
should be jdbc/LiferayPool.
3. Choose the type of database and click Next. liomthe scieenshot, you can see
we have chosen MySQL. Te database diivei class is selected automatically.
Figure 14.45: Creating a data source in WebLogic 10.3
4. Click Next thiee times. You should be on the Connection Properties scieen.
Entei the database name, the host name, the poit, the database usei name and
the passwoid. WebLogic uses this infoimation to constiuct the appiopiiate
JDBC URL to connect to youi database. Click Next.
14.17. INSTALLING LIFERAY ON ORACLE WEBLOGIC 10.3 23
. WebLogic next conims the infoimation you piovided. loi MySQL, some
additional paiameteis must be added to the URL. Modify the JDBC URL so
it has the piopei paiameteis. Piovide youi database name, host name, usei
name and passwoid as the values. Click Next.
. Click Test Conguration to make suie WebLogic can connect to youi database
successfully. When it does, click Finish.
. You will be back to the list of data souices. Notice youi new data souice has
no value in the Target column. Click on youi data souice to edit it.
8. Click the Targets tab and check o the seivei instance(s) to which you wish
to deploy youi data souice. Ten click Save.
Next, lets conguie a mail session in WebLogic.
Mail Conguration
lf you want WebLogic to manage youi mail sessions, use the following pio-
ceduie. lf you want to use Lifeiays built-in mail sessions, you can skip this
section.
Figure 14.46: WebLogic Mail Sessions
24 CHAPTER 14. INSTALLATION AND SETUP
1. Select Mail Sessions and cieate a new mail session which points to youi mail
seivei.
2. Give it the name Lifeiay Mail and give it the JNDl name of mail/MailSession
and click Next.
3. Choose youi seivei and then click Finish.
Now lets make suie Lifeiay can access this mail session.
Domain Conguration - Continued
Lets ievisit domain conguiation to make suie well be able to access youi data
souice and mail session fiom Lifeiay Poital.
1. Cieate a portal-ext.properties le in the Lifeiay Home foldei, which is
one foldei up fiom youi domains home foldei.
lf you aie using WebLogic to manage youi data souice, add the following
to youi portal-ext.properties le in Liferay Home to iefei to youi data
souice
jdbc.default.jndi.name=jdbc/LiferayPool
lf you aie using Liferay Portal to manage youi data souice, follow the in-
stiuctions in the Deploy Liferay section foi using the setup wizaid.
lf want to use Liferay Portal to manage youi mail session, you can conguie
the mail session in the Contiol Panel. Afei staiting youi poital as desciibed in
the Deploy Liferay section, go to Control Panel Server Administration Mail
and entei the seuings foi youi mail session.
lf you aie using WebLogic to manage youi mail session, add the following to
youi portal-ext.properties le to iefeience that mail session
mail.session.jndi.name=mail/MailSession
2. Lastly, you must piovide WebLogic a iefeience to Java Seivei laces (JSl)
to use that libiaiy. lnseit the following deployment desciiptoi within the
<weblogic-web-app> element of WEB-INF/weblogic.xml found in youi
Lifeiay Poital .war
14.17. INSTALLING LIFERAY ON ORACLE WEBLOGIC 10.3 2
<library-ref>
<library-name>jsf</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
Now its the moment youve been waiting foi Lifeiay deployment'
Deploy Liferay
lollow the instiuctions in this section to deploy Lifeiay Poital to youi domain.
Befoie you deploy Lifeiay Poital, considei whethei you want to use the setup
wizaid.
Start the setup wizard along with Liferay Portal - Do this if you want
to conguie youi poital, set up youi sites administiative account and/oi
manage youi database within Lifeiay.
lf this is youi ist time staiting Lifeiay Poital .1, the setup wizaid is in-
voked on seivei staitup. lf you want to ie-iun the wizaid, specify setup.wiz-
ard.enabled=true in youi piopeities le (e.g. portal-setup-wizard.pro-
perties).
setup.wizard.enabled=true
Te setup wizaid is invoked duiing seivei staitup.
Start Liferay Portal without invoking the setup wizard - Do this if you
want to pieseive youi cuiient poital seuings.
To stait the seivei without tiiggeiing the setup wizaid, specify setup.wiz-
ard.enabled=false in youi piopeities (e.g. portal-setup-wizard.pro-
perties oi portal-ext.properties le).
setup.wizard.enabled=false
Te portal-setup-wizard.properties le the setup wizaid cieates has
setup.wizard.enabled=false conveniently specied foi you.
2 CHAPTER 14. INSTALLATION AND SETUP

Piopeity values in portal-setup-wizard.properties


oveiiide piopeity values in portal-ext.properties.
Now, lets deploy Lifeiay Poital.
1. Stait WebLogic.
2. Select Deployments and click the Install buuon. Upload jsf-1.2.war fiom
WebLogics common les diiectoiy and select Install this deployment as a
library.
Figure 14.47: WebLogic Deployments
3. Afei installing the JSl libiaiies, go back to deployments and select the Lif-
eiay .war le fiom the le system oi click the Upload Your File(s) link to
upload it and then click Next.
4. Select Install this deployment as an application and click Next.
. lf the default name is appiopiiate foi youi installation, keep it. Otheiwise,
give it a name of youi choosing and click Next.
14.18. INSTALLING LIFERAY ON WEBSPHERE 8.0 2
. Click Finish. Afei the deployment nishes, click Save.
Lifeiay launches in one of the following manneis
lf the setup wizaid was disabled, youi sites home page opens in youi
biowsei at hup//localhost001.
Otheiwise, the setup wizaid opens in youi biowsei.
Please see the section above foi how to use the setup wizaid.

Note: Afei Lifeiay is installed, you may see an eiioi initial-


izing the Web Pioxy poitlet. Because the XSL paisei cong-
uied by default within WebLogic cannot compile a style sheet
in this poitlet, Lifeiay disables it by default. To ie-enable
this poitlet, extiact xalan.jar and serializer.jar fiom the
Lifeiay .war aichive and copy them to youi JDKs endoised
foldei foi libiaiies. lf you aie using JRockit, this foldei may be
[$WEBLOGIC_HOME]/jrockit_160_05/jre/lib/ext, if you aie using Sun
JDK, this foldei may be [$WEBLOGIC_HOME]/jdk160_24/jre/lib/ext.
Congiatulations' You aie now iunning Lifeiay on Oiacle WebLogic.
14.18 Installing Liferay on WebSphere 8.0

Tip: Tioughout this installation and conguiation piocess,


WebSpheie piompts you to Click Save to apply changes to Mas-
tei Conguiation. Do so inteimiuently to save youi changes.
Liferay Home is in a foldei called liferay in the home foldei of the usei lD
that is iunning WebSpheie.
Preparing WebSphere for Liferay
When the application seivei binaiies have been installed, stait the Prole Man-
agement Tool to cieate a piole appiopiiate foi Lifeiay.
28 CHAPTER 14. INSTALLATION AND SETUP
1. Click on Create. Choose Application Server. Click Next.
2. Click the Advanced piole cieation option and then click Next. Why Ad-
vanced` You can specify youi own values foi seuings such as the location
of the piole and names of the piole, node and host. You can assign youi
own poits. You can optionally choose whethei to deploy the administiative
console and sample application and also add web-seivei denitions if you
wish. Web seivei denitions aie used with lBM HTTP Seivei. loi moie
infoimation about these options, please see the WebSpheie documentation.
Figure 14.48: Choose the Advanced prole option to specify your own
settings.
14.18. INSTALLING LIFERAY ON WEBSPHERE 8.0 29
3. Check the box Deploy administrative console. Tis gives you a web-based
Ul foi woiking with youi application seivei. Skip the default applications.
Youd only install these on a development machine. Click Next.
4. Set piole name and location. Ensuie you specify a peifoimance tuning set-
ting othei than Development, since youie installing a seivei foi pioduction
use. Click Next.
Figure 14.49: Use a performance tuning setting other than Development.
Weve selected Standard here. Please see the WebSphere documentation
for further information about performance tuning settings.
. Choose node and host names foi youi seivei. Tese will be specic to youi
enviionment. Click Next.
30 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.50: Choose node and host names appropriate to your
environment.
. Administiative secuiity in WebSpheie is a way to iestiict who has access to
the administiative tools. loi simplicity, weve disabled it but you may want
to have it enabled in youi enviionment. Please see WebSpheies documen-
tation foi fuithei infoimation. Click Next.
. Each piole needs a secuiity ceiticate, which comes next in the wizaid. lf
you dont have ceiticates alieady, choose the option to geneiate a peisonal
ceiticate and a signing ceitcate and click Next.
8. Once the ceiticates aie geneiated, set a passwoid foi youi keystoie. Click
Next.
14.18. INSTALLING LIFERAY ON WEBSPHERE 8.0 31
Figure 14.51: Weve disabled administrative security but you may want to
enable it.
9. Next, you can customize the poits this seivei piole uses. Be suie to choose
poits that aie open on youi machine. When choosing poits, installation de-
tects existing WebSpheie installations and if it nds activity, it inciements
poits by one.
10. lf you want WebSpheie to stait automatically when the machine is booted,
you conguie it next. Tis dieis by opeiating system. When youie nished
conguiing this the way you want, click Next.
11. WebSpheie ships with lBM HTTP Seivei, which is a iebianded veision of
Apache. lf you want to fiont youi WebSpheie seivei with lBMHTTP Seivei,
32 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.52: Set a password for your keystore.
youd conguie this next. Please see WebSpheies documentation foi details
on this. When nished, click Next.
12. WebSpheie then cieates youi piole and nishes with a message telling you
the piole was cieated successfully. Youie now ieady to install Lifeiay'
Copying portal dependencies
Lifeiay ships with dependency .jais it needs to have on the global classpath.
Tese should be copied to WebSpheies global foldei piovided foi this puipose
[Install Location]/WebSphere/AppServer/lib/ext
14.18. INSTALLING LIFERAY ON WEBSPHERE 8.0 33
Figure 14.53: WebSphere gives you a nice user interface for customizing
the ports your server uses.
Once youve copied the .jais heie, stait the seivei piole youie planning to
use foi Lifeiay. Once it staits, youie ieady to conguie youi database.
Database Conguration
lf you want WebSpheie to manage the database connections, followthe instiuc-
tions below. Note this is not necessaiy if youie planning on using Lifeiays
standaid database conguiation, in that case, skip this section. Youll set youi
database infoimation in Lifeiays setup wizaid afei the install.
1. Stait WebSpheie.
34 CHAPTER 14. INSTALLATION AND SETUP
Figure 14.54: WebSphere JDBCproviders
2. Open the Administiative Console and log in.
3. Click Resources JDBC Providers.
4. Click New.
. loi name, entei the name of JDBC piovidei (e.g. MySQL JDBC Provider).
. loi lmplementation class name, entei
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSouice
. Click Next.
8. Cleai any text in classpath. You alieady copied the necessaiy .jars to a
location on the seiveis class path.
9. Click Next.
10. Click Finish.
11. Click Data Sources undei Additional Properties.
12. Click New.
13. Entei a name liferaydatabasesource.
14.18. INSTALLING LIFERAY ON WEBSPHERE 8.0 3
14. Entei JNDl jdbc/LiferayPool.
1. Eveiything else should stay at the default values. Save the data souice.
1. When nished, go back into the data souice and click Custom Properties and
then click the Show Filter Function buuon. Tis is the second fiom last of the
small icons undei the New and Delete buuons.
1. Type user into the seaich teims and click Go.
Figure 14.55: Modifying data source properties in WebSphere
18. Select the usei piopeity and give it the value of the usei name to youi database.
Click OK and save to mastei conguiation.
19. Do anothei ltei seaich foi the uil piopeity. Give it a value that points to
youi database. loi example, the MySQL URL would be
jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8 \
&useFastDateParsing=false
Click OK and save to mastei conguiation.
3 CHAPTER 14. INSTALLATION AND SETUP
20. Do anothei ltei seaich foi the passwoid piopeity. Entei the passwoid foi
the usei lD you added eailiei as the value foi this piopeity. Click OK and
save to mastei conguiation.
21. Go back to the data souice page by clicking it in the bieadciumb tiail. Click
the Test Connection buuon. lt should connect successfully.
Once youve set up youi database, you can set up youi mail session.
Mail Conguration
lf you want WebSpheie to manage youi mail sessions, use the following pio-
ceduie. lf you want to use Lifeiays built-in mail sessions, you can skip this
section.
1. Click Resources Mail Mail Providers.
2. Click the Built-ln Mail Piovidei foi youi node and seivei.
3. Click Mail Sessions and then click the New buuon.
4. Give it a name of liferaymail and a JNDl name of mail/MailSession. Click
OK and save to mastei conguiation.
. Click Security Global Security and deselect Use Java 2 security to restrict
application access to local resources if it is selected. Click Apply.
Gieat' Now youie ieady to deploy Lifeiay.
Deploy Liferay
1. Click Applications New Application New Enterprise Application.
2. Biowse to the Lifeiay .war le and click Next.
3. Leave Fast Path selected and click Next, then click Next again.
4. Make suie youi seivei is selected and click Next.
. Keep the context ioot set to / and click Next.
. Click Finish. When Lifeiay has installed, click Save to Master Conguration.
14.19. MAKING LIFERAY COEXIST WITH OTHER JAVA EE APPLICATIONS3
Start Liferay
1. lf you plan to use Lifeiays setup wizaid, skip to the next step. lf you wish
to use WebSpheies data souice and mail session, cieate a le called por-
tal-ext.properties in youi Lifeiay Home foldei. Place the following text
in the le
jdbc.default.jndi.name=jdbc/LiferayPool
mail.session.jndi.name=mail/MailSession
setup.wizard.enabled=false
2. Select the Lifeiay application and click Start.
Figure 14.56: Starting Liferay on WebSphere.
3. ln the setup wizaid, select and conguie youi database type. Click Finish
when youie done.
Lifeiay then cieates the tables it needs in the database.
Congiatulations' Youve installed Lifeiay on WebSpheie'
14.19 Making Liferay Coexist with Other Java EE Applica-
tions
Lifeiay Poital by default is conguied to sit at the ioot (i.e., /) of youi application
seivei. Dedicating youi application seivei to iunning only Lifeiay Poital is a
good piactice, allowing foi sepaiation between youi poital enviionment and
youi web application enviionment. Tis is geneially a best piactice foi poitals,
which by denition aie application development platfoims in and of themselves.
38 CHAPTER 14. INSTALLATION AND SETUP
loi that ieason, youi instance of Lifeiay is likely to be hosting many applications
and even integiating seveial of them togethei on a single page. loi this ieason,
you should design youi systemso youi poital enviionment has all the iesouices
it needs to do this. Conguiing it so it is the sole consumei of any othei .war
les that get deployed to the application seivei helps to make suie youi system
peifoims optimally.
lf, howevei, you want Lifeiay to shaie space on an application seivei with
othei applications, you can. ln this instance, you may not want to make Lifeiay
the default application in the ioot context of the seivei.
Teie aie two steps to modifying this behavioi
1. Deploy Lifeiay in a context othei than ioot (foi example /portal).
2. Modify the portal-ext.properties le to tell Lifeiay the context to which
it has been deployed.
To change the le, open it in a text editoi. Place the portal.ctx piopeity
at the top of the le
portal.ctx=/
Tis default seuing denes Lifeiay Poital as the application that sits at the
ioot context. lf you change it to something else, say /portal, foi example, you
can then deploy Lifeiay in that context and it will live theie instead of at the
ioot context.
A full discussion of the portal-ext.properties le appeais in Chaptei
20.
Note for WebLogic Users: WebLogic also iequiies that you modify the web-
logic.xml le which is included with Lifeiay. ln this le aie tags foi the con-
text ioot
<context-root>/</context-root>
Change this so it matches the path you set in youi portal-ext.properties
le. You will have to modify the weblogic.xml le inside the Lifeiay .war be-
foie you deploy it. Extiact the le fiom the .war le, modify it and then put it
back in the .war le. Ten deploy the modied Lifeiay .war le to the seivei
in the piopei context.
14.20. SUMMARY 39
14.20 Summary
Tis chaptei is a guide to eveiything about installing Lifeiay. Whethei you
choose a Lifeiay bundle oi an existing application seivei, Lifeiay Poital inte-
giates seamlessly with youi enteipiise Java enviionment. lt is suppoited on
moie application seiveis than any othei poital platfoim, allowing you to pie-
seive youi investment in youi application seivei of choice oi giving you the
fieedom to move to a dieient application seivei platfoim. Lifeiay is com-
miued to pioviding you this fieedom we have 00 test seiveis ceitifying oui
builds with ioughly 10,000 tests pei veision of Lifeiay Poital. Each of those tests
aie iun on all of oui dieient suppoited combinations of application seiveis,
databases and opeiating systems. Because of this, you can be suie we aie com-
miued to suppoiting you on youi enviionment of choice. You can feel safe
knowing you have the fieedom to use the sofwaie platfoim that is best foi
youi oiganization and that Lifeiay Poital iuns and peifoims well on it.
Cu~v1rv 1
M~N~crxrN1
You know how all these ietaileis adveitise themselves as a one stop shop foi
anything you want` Te idea is they have so much stu that chances aie what-
evei youie looking foi is theie. Lifeiays contiol panel is something like this. lf
you want to cieate useis, sites, oiganizations, conguie peimissions and plug-
ins and pieuy much anything else, youll do it with the contiol panel. Te nice
thing about the contiol panel is it makes all this veiy easy to do. Tis chaptei
takes all the concepts you leained about Lifeiay in chaptei 1 (sites, oiganiza-
tions, and moie) and makes them conciete. Heie, youll leain how to cieate and
manage eveiy aspect of Lifeiays conguiation.
Tis chaptei explains how to use the Contiol Panel to manage the following
items
Useis
Oiganizations
Usei Gioups
Roles
Passwoid Policies
40
15.1. MANAGING USERS 41
Authentication Policies
Global Usei Seuings
Lets begin oui examination of Lifeiays contiol panel by looking at how to
manage and oiganize useis in Lifeiay Poital.
15.1 Managing Users
Te Poital section of the contiol panel is used foi most administiative tasks.
Youll nd theie an inteiface foi the cieation and maintenance of
Useis, Usei Gioups and Oiganizations
Sites and Teams
Site Templates
Page Templates
Roles
Additionally, you can conguie many seivei seuings, including
Passwoid Policies
Poital Seuings
Custom lields
Monitoiing
Plugins Conguiation
15.2 The Portal Section of the Control Panel
Te Poital section of the Contiol Panel is used foi most administiative tasks.
Youll nd theie an inteiface foi the cieation and maintenance of the following
poital entities useis, oiganizations, usei gioups, sites, teams, site templates,
page templates, and ioles. Additionally, you can conguie many seuings, in-
cluding the following ones passwoid policies, poital seuings, custom elds,
monitoiing, and plugins conguiation
42 CHAPTER 15. MANAGEMENT
Since we explained how to manage sites, teams, site templates, and page
templates in chapteis 2 and 3, we wont discuss them in detail heie. ln this
chaptei, well focus on using the Contiol Panel foi usei management. Well
nish oui coveiage of the Contiol Panel in the next chaptei, discussing poital
and seivei administiation.
As a poital administiatoi, youll use the Poital section of the Contiol Panel
to cieate youi poital stiuctuie, implement secuiity, and administei youi useis.
Conguiable poital seuings include mail host names, email notications, and
authentication options, including single sign-on and LDAP integiation. Note
that only useis with the administiatoi iole, which is a poital scoped iole, have
peimission to view this section of the contiol panel. You can, of couise, giant
peimissions to one oi moie sections to custom ioles.
15.3 Adding users
Lets add a usei account foi youiself and conguie this account so it has the
same administiative access as the default administiatoi account. Go up to the
Dockbai, mouse ovei Go to and click Control Panel. Ten open the Users and
Organizations page undei the Portal categoiy. Click the Add buuon and select
User. lill out the Add Usei foim using youi name and email addiess. When you
aie nished, click Save.
Figure 15.1: The Add User Screen
Afei you submit the foim, the page ieloads with a message saying the save
was successful. An expanded foim appeais that allows you to ll out a lot moie
15.3. ADDING USERS 43
infoimation about the usei. You dont have to ll anything else out iight now.
Just note that when the usei lD was cieated, a passwoid was automatically gen-
eiated and, if Lifeiay was coiiectly installed (see chaptei 14), an email message
with the passwoid in it was sent to the usei. Tis, of couise, iequiies that Lifeiay
can piopeily communicate with youi SMTP mail seivei.
Figure 15.2: Liferays User Account Editor
lf you havent yet set up youi mail seivei, youll need to use this page to
change the default passwoid foi the usei lD to something you can iemembei.
You can do this by clicking on the Password link in the box on the iight, enteiing
the new passwoid in the two elds and clicking Save. Next, you should give
youi usei account the same administiative iights as the default administiatois
account. Tis allows you to peifoim administiative tasks with youi own lD
instead of having to use the default lD. lt also helps to make youi poital moie
secuie by deleting oi disabling the default lD.
Click the Roles link. Te contiol panels Roles page shows the ioles to which
youi lD is cuiiently assigned. You should have one iole Powei Usei. By de-
fault, all useis aie assigned the Powei Usei iole. You can give this iole ceitain
peimissions if you wish oi disable it altogethei. You can also dene the default
ioles a new usei ieceives. Well see how to do this latei.
To make youiself an Administiatoi, click the Select link. A dialog box pops
up with a list of all the ioles in the system. Select the Administiatoi iole fiomthe
44 CHAPTER 15. MANAGEMENT
list. Te dialog box disappeais and the iole is added to the list of ioles associated
with youi account. Next, click the Save buuon, which is at the bouom of the
blue bai of links on the iight. You aie now an administiatoi of the poital. Log
out of the poital and then log back in with youi own usei lD.
Well next look at some aspects of usei management.
15.4 User management
lf you click the Users link on the lef menu of the contiol panel, theie aie now
two useis in the list of useis. lf you want to change something about a paiticulai
usei, you can click the Actions buuon next to that usei.
Edit User: takes you back to the Edit Usei page wheie you can modify any-
thing about the usei.
Permissions: allows you to dene which ioles have peimissions to edit the
usei.
Manage Pages: allows you to edit the peisonal pages of a usei.
Impersonate User: opens anothei biowsei window which allows you to
biowse the site as if you weie the usei.
Deactivate: deactivates the useis account.
Note most useis cant peifoim most of the above actions. ln fact, most useis
wont even have access to this section of the contiol panel. You can peifoim all
of the above functions because you have administiative access.
Lets look next at how to manage oiganizations.
Organizations
Oiganizations aie used to iepiesent hieiaichical stiuctuies of useis such as
those of companies, businesses, non-piot oiganizations, chuiches, schools,
and clubs. Tey aie designed to allow distiibuted usei administiation. Oiga-
nizations can be used, foi example, to iepiesent a spoits league. Te league
itself could be modeled as a top-level oiganization and the vaiious spoits (soc-
cei, baseball, basketball, etc.) could be modeled as suboiganizations. Te teams
belonging to the vaiious spoits could be modeled as sub-oiganizations of the
spoits oiganizations. So, foi example, you could have an oiganization hieiai-
chy that looks like this
Atlantic Spoits League
Atlantic Soccei Association
15.4. USER MANAGEMENT 4
* Midway Soccei Club
* laiiview Soccei Club
* Oak Giove Soccei Club
Atlantic Baseball Association
* live Points Baseball Club
* Riveiside Baseball Club
* Pleasant Hill Baseball Club
Atlantic Basketball Association
* Bethel Basketball Club
* Centeiville Basketball Club
* New Hope Basketball Club
Whenevei you have a collection of useis that t into a hieiaichical stiuc-
tuie, you can use oiganizations to model those useis. ln Lifeiay, oiganization
administiatois can manage all the useis in theii oiganization and in any sub-
oiganization. Refeiiing to the hieiaichy above, foi example, an oiganization
administiatoi of the Atlantic Spoits League could manage any useis belonging
to the league itself, to any of the associations, oi to any of the associations
clubs. An oiganization administiatoi of the Atlantic Soccei Association could
manage any useis belonging to the Atlantic Soccei Association itself, oi to the
Midway Soccei Club, laiiview Soccei Club, oi Oak Giove Soccei Club. How-
evei, an administiatoi of the Atlantic Soccei Club would not be able to manage
useis belonging to the Atlantic Baseball Association oi to the Bethel Basketball
Club.
Oiganizations and suboiganization hieiaichies can be cieated to unlimited
levels. Useis can be membeis of one oi many oiganizations. Te iights of an
oiganization administiatoi apply both to his/hei oiganization and to any child
oiganizations. By default, membeis of child oiganizations aie implicit membeis
of theii paient oiganizations. Tis means, foi example, that membeis of child
oiganizations can access the piivate pages of theii paient oiganizations. Tis
behavioi can be customized in youi poitals poital-ext.piopeities conguia-
tion le.
Since oiganizations aie designed foi distiibuted usei administiation, oiga-
nization administiatois have an entiiely dieient set of piivileges than site ad-
ministiatois. Site administiatois aie iesponsible foi the pages, poitlets, and
content of theii site. Tey aie also iesponsible foi managing the membeiship of
theii site. To this end, they can set the membeiship type to Open, Restiicted, oi
Piivate. Tey can also add useis to oi iemove useis fiom theii site but cannot
4 CHAPTER 15. MANAGEMENT
manage the useis themselves. Oiganization administiatois, on the othei hand,
can edit useis belonging to theii oiganization oi any suboiganization. Tey
cannot add existing useis to theii oiganization but they can cieate new useis
within theii oiganization. Only poital administiatois can add existing useis to
an oiganization.
Many simple poital designs dont use oiganizations at all, they only use sites
(see chapteis 2 and 3 foi moie infoimation on sites). Remembei that the main
puipose of oiganizations is to allow foi distiibuted usei management. Tey
allow poital administiatois to delegate some of theii usei management iespon-
sibilities to oiganization administiatois. lf you dont anticipate needing to del-
egate usei management iesponsibilities, youi poital design need not include
oiganizations. ln oidei to decide whethei oi not youi poital design should in-
clude oiganization, think about youi poitals function. A simple photo-shaiing
web site, foi example, could be poweied by sites only. On the othei hand, oi-
ganizations aie useful foi coipoiations oi educational institutions since theii
useis can easily be placed into a hieiaichical stiuctuie. ln fact, oiganizations in
Lifeiay aie designed to model any gioup hieiaichy, fiom those of goveinment
agencies all the way down to those of small clubs. Of couise, useis can belong
both to oiganizations and to independent sites. loi example, a coipoiation oi
educational institution could cieate a social netwoiking site open to all poital
useis, even ones fiom sepaiate oiganizations.
Additionally, oiganization administiatois can assign oiganization-scoped ioles
to membeis of theii oiganization. loi example, considei an lT Secuiity gioup
in a coipoiate seuing. You could have a suboiganizaton of youi lT oiganiza-
tion that handles secuiity foi all of the applications company-wide. lf you giant
the lT Secuiity oiganization the poital administiatoi iole, all the membeis of
the oiganization would have administiative access to the entiie poital. Suppose
fuithei that a usei in this oiganization was latei hiied by the Human Resouices
depaitment. Te simple act of iemoving the usei fiom the lT Secuiity oiganiza-
tion also iemoves the useis administiative piivileges, since the piivilege came
fiom the lT Secuiity oiganizations iole. By adding the usei to the HR oigani-
zation, any ioles the HR oiganization has (such as access to a benets system in
the poital) aie tiansfeiied to the usei. ln this mannei, you can design youi poi-
tal to coiiespond with youi existing oiganization chait and useis peimissions
aie gianted accoiding to theii positions in the chait.
Of couise, this is only one way to design it. lf you have moie complex
iequiiements foi peimissions within an oiganization, you can cieate custom
oiganization-scoped ioles to assemble the peimissions you wish to giant to pai-
ticulai useis. Alteinatively, you could considei auaching a site to youi oiga-
nization and using site teams to assemble the sets of peimissions (see below).
15.4. USER MANAGEMENT 4
Well discuss ioles and peimissions in moie detail latei in this chaptei.
Does youi oiganization need to have its own site` Many oiganizations dont,
but since some do, Lifeiay allows sites to be auached to oiganizations. lf an oi-
ganization has an auached site, the oiganizations administiatois aie tieated as
the site administiatois of the auached site. Tis means that they can manage
the pages, poitlets, and content of the site as well as the useis of the oiganiza-
tion. Membeis of an oiganization with an auached site aie tieated as membeis
of the oiganizations site. Tis means that they can access the piivate pages of
the oiganizations site, along with any poitlets oi content theie. Te capability
of auaching sites to oiganizations allows poital administiatois to use oigani-
zations to facilitate distiibuted poital administiation, not just distiibuted usei
administiation. Next, lets leain how to cieate and manage oiganizations.
To add an oiganization, click the Users and Organizations link on the lef side
of the contiol panel. Ten click the Add buuon and choose Regular Organiza-
tion.
To auach a site when you cieate an oiganization, click the Organization Site
tab at the iight and check the Create Site box. lf you dont know iight now if
youi oiganization needs a web site, thats ne. You can always add one latei if
the need aiises.
Figure 15.3: Adding an organization
48 CHAPTER 15. MANAGEMENT
Name: Entei a name foi the oiganization.
Type: Choose whethei this is a iegulai oiganization oi a location. Alocation
cannot have any suboiganizations.
Parent Organization: Select an oiganization in the system to be the diiect
paient of the oiganization you aie cieating. Click the Remove buuon to iemove
the cuiiently conguied paient.

Tip: Note that youie alieady a membei of any oiganizations


you cieate. By cieating an oiganization, you become both a
membei and ieceive the Oiganization Ownei iole, which gives
you full iights to the oiganization. You can, of couise, add othei
useis to this iole to make them Oiganization Owneis.
lill out the infoimation foi youi oiganization and click Save. As befoie with
useis, the foimieappeais and you can entei moie infoimation about the oigani-
zation. Oiganizations can have multiple email addiesses, postal addiesses, web
sites and phone numbeis associated with them. Te Seivices link can be used
to indicate the opeiating houis of the oiganization, if any.
loi now, click the Back buuon. Tis takes you back to the list of oiganiza-
tions.
Click the Actions buuon next to the new oiganization you cieated. Tis
shows the actions you can take to manipulate this oiganization.
Edit: lets you specify details about the oiganization, including addiesses,
phone numbeis, email addiesses and websites.
Manage Site: lets you cieate and manage public and piivate pages foi the
oiganizations site.
Assign Organization Roles: lets you assign oiganization-scoped ioles to
useis. By default, Oiganizations aie cieated with thiee ioles Oiganization Ad-
ministiatoi, Oiganization Usei and Oiganization Ownei. You can assign one
oi moie of these ioles to useis in the oiganization. All membeis of the oigani-
zation automatically get the Oiganization Usei iole so this iole is hidden when
you click Assign Oiganization Roles.
Assign Users: lets you seaich and select useis in the poital to be assigned to
this oiganization as membeis.
Add User: adds a new usei in the poital and assigns the usei as a membei
of this oiganization.
Add Regular Organization: lets you add a child oiganization to this oiga-
nization. Tis is how you cieate hieiaichies of oiganizations with paient-child
ielationships.
15.5. USER GROUPS 49
Add Location: lets you add a child Location, which is a special type of oiga-
nization that cannot have any childien added to it.
Delete: iemoves this oiganization fiom the poital. Make suie the oiganiza-
tion has no useis in it ist.
lf you click the View buuon at the top of the Useis and Oiganizations page
and select View Hierarchy you can view both a list of useis who aie membeis of
this oiganization and a list of all the suboiganizations of this oiganization.
Useis can join oi be assigned to sites when they shaie a common inteiest.
Useis can be assigned to oiganizations when they t into a hieiaichical stiuc-
tuie. Useis gioups piovide a moie ad hoc way to gioup useis than sites and
oiganizations. Lets look at them next.
15.5 User Groups
Usei Gioups aie designed to allow poital administiatois to cieate gioups of
useis that tiaveise the oiganizations hieiaichy. Tey can be used to cieate
aibitiaiy gioupings of useis who dont necessaiily shaie an obvious hieiai-
chical auiibute. Useis can be assigned to multiple usei gioups. loi example,
considei a sofwaie company with many oces and depaitments within each
oce. Te companys oce/depaitment stiuctuie could be modeled thiough
oiganizations. ln this situation, it might make sense to cieate usei gioups foi
developeis, oce manageis, accountant, etc. Usei Gioups aie most ofen used
to achieve one of the following goals
To simplify the assignment of seveial ioles to a gioup of useis. loi ex-
ample, in a Univeisity poital, a usei gioup could be cieated to gioup all
teacheis independently of theii oiganizations to make it easiei to assign
one oi seveial ioles at once to all the teacheis.
To simplify membeiship to one oi moie sites by specifying a gioup of
useis. Using the pievious example, all teacheis could be membeis of the
sites University Employees and Students and Teachers Collaboration Site by
adding the Teachers usei gioup as a membei.
To piovide piedened public oi piivate pages to the useis who belong to
the usei gioup. loi example, the Teachers usei gioup could be cieated to
ensuie the home page on all teacheis peisonal sites has the same layout
and applications.
0 CHAPTER 15. MANAGEMENT
Cieating a usei gioup is easy. Navigate to the contiol panel, click the Users
Groups link and then click the Add buuon. Teie aie only two elds to ll out
Name and Desciiption. Click Save and you will be iediiected back to the User
Groups page of the contiol panel.
Figure 15.4: Creating a NewUser Group
Note in the guie above how each usei gioup may have a site, with public
and piivate pages. Tis is a special type of site that deteimines the base pages on
all usei gioup membeis peisonal sites. Te usei gioup site woiks in a similai
way to Site Templates, except in this case the Usei Gioup Site pages aie not
copied foi each usei but aie iathei shown dynamically along with any custom
pages the usei may have on his/hei peisonal site. loi this ieason, useis aie not
allowed to make any modications to the pages that aie inherited fiom the usei
gioup. Alteinatively the administiatois of the usei gioup can dene ceitain
aieas as customizable, just like they can foi iegulai sites. Tis allows useis to
15.5. USER GROUPS 1
decide which applications they want to place in ceitain aieas of each page, as
well as change theii conguiation.
Figure 15.5: User Group Actions
As with the othei iesouices in the poital, you can click the Actions buuon
next to a usei gioup to peifoim vaiious opeiations on that gioup.
Edit: allows you to modify the name oi desciiption of the usei gioup.
Permissions: lets you dene which ioles have peimissions to view, edit,
delete, assign membeis to the usei gioup, etc.
Site Permissions: lets you dene which ioles have peimissions to manage
the usei gioup site, to specify who can administei its pages, expoit and impoit
pages and poitlet content, manage aichived setups and conguie its applica-
tions.
Manage Site Pages: allows you to add pages to the usei gioup site, impoit
oi expoit pages, oiganize the page hieiaichy, modify the look and feel of the
pages, add a logo oi access othei options fiom the Manage Site inteiface.
Assign Members: lets you seaich foi and select useis in the poital to be
assigned to this usei gioup as well as view the useis cuiiently belonging to the
usei gioup .
Delete: iemoves the usei gioup.
lf youi usei gioup has a site, two options named Go to the Sites Public Pages
and Go to the Sites Private Pages also appeai as links in youi usei gioups
Actions menu. Clicking one of these links opens the usei gioups site in a new
2 CHAPTER 15. MANAGEMENT
biowsei window. Any changes you make to the site aie saved automatically.
You can safely close the biowsei window when youie done.
Creating and editing a User Group
A usei gioups site can be administeied fiom the contiol panel. Select User
Groups fiom the contiol panel to see a list of existing usei gioups. To edit a
usei gioup, click on its name oi desciiption. You can also click on the Actions
buuon to see the full list of actions that can be peifoimed on a usei gioup. When
editing a usei gioup, you can view its site, if it exists, by clicking the Open Pages
link undei Public Pages oi Piivate Pages (iead below foi details on usei gioup
sites).
As an example of how usei gioup sites can be used, lets cieate a usei gioup
called Bloggers along with a simple template. Well call the site template Bloggers
too. lt should contain a single Blog page with the Blogs and Recents Bloggeis
poitlets on it. liist, navigate to the Usei Gioups page of the contiol panel. Ten
click Add and entei the name Bloggers foi youi usei gioup, and optionally, a
desciiption. Click Save to cieate youi usei gioup.
Oui next step is to assign an existing usei to the Bloggers gioup.
Assigning Members to a User Group
Navigate to Users and Organizations and cieate a new usei called Joe Bloggs.
Ten navigate to the Usei Gioups page of the contiol panel and click Actions
Assign Members next to the Bloggeis gioup. Click the Available tab to see a
list of useis that can be assigned to the gioup.
liom that list, one oi moie useis can be assigned as membeis of the usei
gioup.
loi example, by default, newly cieated useis aie given Welcome pages on
the public pages poition of theii peisonal sites. Tis Welcome page contains
the Language, Seaich and Blogs poitlets. You can see the eect of the Bloggers
site template on the public pages of Joe Bloggss peisonal site in the guie above.
When Joe Bloggs was added to the Bloggers gioup, he ieceived a Blogs page with
the Blogs and Recent Bloggers poitlets.
Afei the usei gioup has been cieated and seveial useis have been added to
it, you can add all those useis at once as membeis of a site in one step fiom the
Site Memberships Ul of the site. You can also use the usei gioup when assigning
a iole to useis fiom the ioles management Ul.
Te next section desciibes a moie advanced usage of usei gioups Usei
Gioup Sites.
15.5. USER GROUPS 3
Figure 15.6: Assigning Members to a User Group
User Group Sites
Lifeiay allows useis to each have a peisonal site consisting of public and piivate
pages. Peimissions can be gianted to allow useis to customize theii peisonal
sites at will. Oiiginally, the default conguiation of those pages could only be
deteimined by the poital administiatoi thiough the portal-ext.properties
le and, optionally, by pioviding the conguiation in a LAR le. You can still
conguie it like this but it isnt veiy exible oi easy to use.
By using Usei Gioup Sites, poital administiatois can add pages to the pei-
sonal sites of all the useis who belong to the site in an easy and centialized
way. All the usei gioup sites public pages aie shown as pait of the useis pub-
lic peisonal site. All the usei gioup sites piivate pages aie shown as pait of the
useis piivate site. lf a usei belongs to seveial usei gioups, all of its pages aie
made pait of his public and piivate site. ln an educational institutions poital,
foi example, teacheis, sta and students could get dieient default pages and
applications on theii peisonal sites.
Te pages a useis peisonal site inherits fiom a Usei Gioup still belong to the
Usei Gioup and thus cannot be changed in any way by the usei. What the usei
gioup administiatois can do is dene ceitain aieas of the pages as customizable
to allow the useis to choose which applications and what conguiation should
be shown in those aieas. lf a usei has peimission to add custom pages to his/hei
4 CHAPTER 15. MANAGEMENT
peisonal site, besides those inherited fiom a usei gioup, the custom pages aie
always shown last.
Since the inheritance of pages is done dynamically, this new system intio-
duced in Lifeiay .1 can scale to hundieds of thousands of useis oi even mil-
lions of them without an exponential impact in peifoimance. Pievious veisions
of Lifeiay used a dieient technique that iequiied usei gioup pages be copied
to each useis peisonal site. loi poitals upgiading fiom pievious veisions of
Lifeiay, you can keep the old behavioi but it has been lef disabled by default.
You can enable it by adding the following line to youi poital-ext.piopeities le
user.groups.copy.layouts.to.user.personal.site=true
When this piopeity is set to tiue, once the template pages have been copied
to a useis peisonal site, the copies may be modied by the usei. Changes done
to the oiiginals in the Usei Gioup will only aect new useis added to the usei
gioup. Useis with administiative piivileges ovei theii peisonal sites can modify
the pages and theii content if the Allow Site Administrators to Modify the Pages
Associated with is Site Template box has been checked foi the template. When
a usei is iemoved fiom a usei gioup, the associated pages aie iemoved fiom
the useis peisonal site. Moieovei, if a usei is iemoved fiom a gioup and is
subsequently added back, the gioups template pages aie copied to the useis
site a second time. Note that if a usei gioups site is based on a site template and
an administiatoi modies the usei gioups site template afei useis have alieady
been added to the gioup, those changes only take eect if the Enable propagation
of changes from the site template box foi the usei gioup was checked.

Tip: Pievious to Lifeiay .1, pages fiom dieient usei gioups


could be combined on useis peisonal sites by using a nam-
ing convention. Lifeiay .1 simplies the way usei gioups
sites woik by disallowing page combination. Set the piopeity
user.groups.copy.layouts.to.user.personal.site to tiue if you depend
on that functionality.
You can cieate a usei gioups site manually oi base it on a site template. To
cieate a usei gioups site manually, use the Actions menu mentioned above and
choose Manage Site Pages. You can add a newpublic oi piivate page by selecting
the appiopiiate tab and then clicking the Add Page buuon. Once the usei gioup
has at least one public oi piivate page in place, you can go back to the Actions
menu and click on the Go to the Sites Public Pages oi Go to the Sites Private
15.6. ROLES AND PERMISSIONS
Pages link to open the usei gioups site in a new biowsei window. ln the new
window, you can add moie pages and poitlets and conguie site seuings.
You can also base a usei gioups site on a template. When editing a usei
gioup, use the Public Pages and Piivate Pages diop down lists to select a site
template. Leave the Enable propagation of changes from the site template box
checked to automatically update useis peisonal sites if the associated site tem-
plate changes. lf you uncheck this box but iecheck it latei, the template pages
aie copied to the useis sites, oveiwiiting any changes they may have made.
You can allow useis to make changes to the pages they ieceive fiom the usei
gioup by enabling the customization options on each page.
Tis exibility lets you achieve almost any desiied conguiation foi a useis
peisonal site without having to modify it diiectly. When a usei is assigned to a
usei gioup, the conguied site pages aie copied diiectly to the useis peisonal
site.
lollowing with the example above, we will cieate a site foi oui sample usei
gioup. Edit the Bloggers gioup. Choose an existing Site Template fiom the
diop down menu foi the usei gioups public pages and click Save. Afei the
page ieloads you can click to see the pages and make any changes desiied, add
additional pages, etc.
Also, tiy visiting the public site of one of the useis who belongs to the usei
gioup. You will see how all of the pages in the usei gioup appeai as pait of the
usei site, including the ones copied fiom the site template and the ones added
afeiwaids.
15.6 Roles and Permissions
Roles aie used to collect peimissions that dene a paiticulai function within the
poital, accoiding to a paiticulai scope. Roles can be gianted peimissions to vai-
ious functions within poitlet applications. A ioles is basically just a collection
of peimissions that denes a function, such as Message Boaid Administiatoi. A
iole with that name is likely to have peimissions ielevant to the specic Mes-
sage Boaid poitlets delegated to it. Useis who aie placed in this iole will inheiit
these peimissions.
Te ioles page of the contiol panel seives as a single inteiface which lets you
cieate ioles, assign peimissions to them and assign useis to the ioles. Roles can
be scoped by poital, site oi oiganization. To cieate a iole, click the Roles link
and then click the Add buuon. You can choose a Regulai, Site oi Oiganization
iole. A iegulai iole is a poital-scoped iole. Make a selection and then type a
name foi youi iole, a title and a desciiption. Te name eld is iequiied but the
CHAPTER 15. MANAGEMENT
Figure 15.7: Selecting a Template for the User Group Site
title and desciiption aie optional. lf you entei a name and a title, the title will
be displayed in the list of ioles on the Roles page of the contiol panel. lf you
do not entei a title, the name will be displayed. When you have nished, click
Save.
ln addition to iegulai ioles, site ioles, and oiganization ioles, theie aie also
teams. Teams can be cieated by site administiatois within a specic site. Te
peimissions gianted to a team aie dened and applied only within the teams
site. Te peimissions dened by iegulai, site, and oiganization ioles, by con-
tiast, aie dened at the poital level, although they aie applied to dieient scopes.
Te dieiences between the foui types of ioles can be desciibed as follows
Regular role: Peimissions aie dened at the *poital* level and aie applied at
15.6. ROLES AND PERMISSIONS
the *poital* level.
Site role: Peimissions aie dened at the *poital* level and aie applied to one
*specic site*.
Organization role: Peimissions aie dened at the *poital* level and aie ap-
plied to one *specic oiganization*.
Team: Peimissions aie dened within a *specic site* and aie assigned within
that *specic site*.
loi moie infoimation about teams, please iefei to chaptei 3.
Figure 15.8: Roles Page and Role Actions Menu
Afei you save, Lifeiay iediiects you to the list of ioles. To see what functions
you can peifoim on youi new iole, click the Actions buuon.
Edit: lets you change the name, title oi desciiption of the iole.
8 CHAPTER 15. MANAGEMENT
Permissions: allows you to dene which useis, usei gioups oi ioles have
peimissions to edit the iole.
Dene Permissions: denes what peimissions this iole giants. Tis is out-
lined in the next section.
Assign Members: lets you seaich and select useis in the poital to be assigned
to this iole. Tese useis will inheiit any peimissions that have been assigned to
this iole.
View Users: allows you to view the useis who have been assigned to this
iole.
Delete: peimanently iemoves a iole fiom the poital.
Next, lets examine how to conguie the peimissions gianted by dieient
ioles.
Dening Permissions on a Role
Roles seive as iepositoiies of peimissions to be assigned to useis who belong
to them. So, to use a iole, you need to assign membeis to it and dene the
peimissions you want to giant to membeis of the iole.
When you click the Actions buuon on poital-scoped iole and select Dene
Permissions, you will be shown a list of all the peimissions dened foi that iole.
Click the Add Permissions diop-down menu to see a list of the peimissions that
can be dened. As of Lifeiay veision .1, these peimissions fall into seven cate-
goiies Poital, Site Content, Site Application, Contiol Panel Peisonal, Contiol
Panel Site, Contiol Panel Poital and Contiol Panel Seivei. loi non-poital
scoped ioles, you need to click on the Options link on individual poitlets, then
Conguration, then Permissions to assign peimissions within the site oi oigani-
zation that owns the poitlet.
Poital peimissions covei poital-wide activities that compiise seveial cate-
goiies, such as site, oiganization, location, passwoid policy, etc. Tis allows
you to cieate a iole that, foi example, can cieate new sites within the poital.
Tis would allow you to giant useis that paiticulai peimission without making
them oveiall poital administiatois.
Site Content peimissions covei the content the installed poitlets cieate. lf
you pick one of the poitlets fiom this list, youll get options foi dening pei-
missions on its content. loi example, if you pick Message Boaids, youll see
peimissions foi cieating categoiies and thieads oi deleting and moving topics.
Site Application peimissions aect the application as a whole. So, using oui
Message Boaids example, an application peimission might dene who can add
the Message Boaids poitlet to a page.
15.6. ROLES AND PERMISSIONS 9
Figure 15.9: Dening Permissions on a Role
Te contiol panel peimissions aect how the poitlet appeais to the usei in
the contiol panel. Some contiol panel poitlets have a Conguiation buuon, so
you can dene who gets to see that, as well as who gets to see an application in
the contiol panel.
Each possible action to which peimissions can be gianted is listed. To giant
a peimission, check the box next to it. lf you want to limit the scope of the
peimission to a paiticulai site, click the Limit Scope link and then choose the
site. Once you have chosen the peimissions gianted to this iole, click Save. loi
a poital-scoped Message Boaids Administiatoi iole, you might giant content
peimissions foi eveiy action listed. Afei you click Save, you will see a list of
0 CHAPTER 15. MANAGEMENT
Figure 15.10: Message Board Content Permissions
15.6. ROLES AND PERMISSIONS 1
all peimissions cuiiently gianted to this iole. liom heie, you can add moie
peimissions oi go back by clicking a link in the bieadciumb list oi the Return to
Full Page link.
Te list of peimissions that you can dene foi a iole may seem oveiwhelm-
ing. Howevei, these peimissions ensuie that you can customize exactly which
aieas of youi poital youd like dieient collections of useis to be able to access.
Sometimes you might nd that a ceitain peimission giants moie oi less access
than what you expectedalways test the peimissions youiself'
loi example, suppose that you cieated a iole called Usei Gioup Managei.
Youd like to dene the peimissions foi the Usei Gioup Managei iole so that
useis assigned to this iole can add useis to oi iemove useis fiomany usei gioup.
To do this, you might click on Go To Control Panel and then Roles Add
Regular Role. Afei naming youi iole, youd click Actions Dene Permissions.
Ten youd click on the Add Permissions diopdown menu and select Users and
Organizations undei the Portal heading. Since youd like usei gioup manageis
to be able to view usei gioups and assign membeis to them, youd check the
Assign Members and View peimissions undei the User Group heading. Ten
youd go back to the Add Permissions diopdown menu and select User Groups
undei the Control Panel: Portal heading and check the Access in Control Panel
and View peimissions so that usei gioup manageis can manage usei gioups
fiom the Contiol Panel.
You might expect that these peimissions would be enough to allow useis
assigned to the Usei Gioup Managei iole to add oi iemove any useis to oi fiom
any usei gioup. Afei all, weve gianted usei gioup manageis peimissions to
view usei gioups and assign membeis and weve gianted them access to Usei
Gioups in the Contiol Panel. Howevei, weie foigeuing an impoitant peimis-
sion. Can you guess what it is` Tats iight we havent gianted the Usei Gioup
Managei iole peimission to view useis' Although usei gioup manageis can as-
sign membeis to usei gioups, they dont have peimission to view useis at the
poital level. Tis means that if they click Assign Members foi a usei gioup and
click on the Available tab, theyll see an empty list.
To x this, click Go To Control Panel. Click on Roles and then Actions
Dene Permissions. Ten click on the Add Permissions diopdown list and
select Users and Organizations undei the Portal heading. On this page, check
the View peimission undei the User heading. Once youve saved, useis whove
been assigned to the Usei Gioup Managei iole will be able to biowse the poitals
entiie list of useis when assigning useis to a usei gioup.
Roles aie veiy poweiful and allow poital administiatois to dene vaiious
peimissions in whatevei combinations they like. Tis gives you as much exi-
bility as possible to build the site you have designed.
2 CHAPTER 15. MANAGEMENT
Figure 15.11: Make sure to test the permissions you grant to customroles.
Figure 15.12: Users assigned to the User Group Manager role cant nd
any users to add!
15.7. MANAGING PORTAL SETTINGS 3
Special Note about the Power Users Role
Piioi to Lifeiay .0, the default conguiations of many Lifeiay poitlets allowed
powei useis, but not iegulai useis, to access them. Lifeiay .0 and subsequent
veisions giant the same default peimissions to both powei useis and iegulai
useis. Tis way, poital administiatois aie not foiced to use the powei useis
iole. Howevei, Lifeiay encouiages those who do to cieate theii own custom
peimissions foi the iole.

Note Piioi to Lifeiay veision .0, Powei Useis and Useis did
not have the same default peimissions. So if aie using Lifeiay .2
oi a pievious veision, its dangeious to iemove the Powei Useis
iole fiom the default usei associations this could iemove cei-
tain peimissions you expect to apply to all useis. lf you decide
to iemove the Powei Useis iole fiom the default usei associa-
tions anyway, you will piobably want to modify the peimissions
on ceitain poitlets to make them accessible to all useis. To do this, see the
section on Plugins Conguiation below.
Now that weve seen how to use oiganizations and usei gioups to manage
useis and howto use ioles to dene peimissions, lets examine the geneial poital
seuings you can conguie.
15.7 Managing Portal Settings
Afei you have cieated useis, usei gioups, oiganizations, ioles, sites and teams
youi poital will be ieady to host content and applications. You can conguie Lif-
eiays poital seuings to t youi enviionment and youi paiticulai poital pioject.
Many conguiations can be peifoimed thiough Lifeiays poitlet-diiven usei in-
teiface. Tis section coveis how to conguie poital seuings such as passwoid
policies, authentication seuings, mail host names, email notications, display
seuings and monitoiing.
Nowthat you have been navigating in the contiol panel, you should be pieuy
familiai with howit woiks. All the options appeai in the lefnavigation, theii in-
teifaces appeai in the middle and any sub-options appeai on the iight. We have
focused so fai on the maintenance of useis and poital secuiity. Te iemaining
links in the Portal categoiy focus on vaiious poital seuings which covei how
the poital opeiates and integiates with othei systems you may have. Lets be-
4 CHAPTER 15. MANAGEMENT
gin oui discussion of Lifeiays poital seuings by examining how to conguie
passwoid policies.
Password Policies
Passwoid policies can enhance the secuiity of youi poital. You can set iequiie-
ments on passwoid stiength, fiequency of passwoid expiiation and moie. Ad-
ditionally, you can apply dieient passwoid policies to dieient sets of poital
useis.
lf you aie viewing a page othei than the contiol panel, select Control Panel
fiom the Go to menu of the Dockbai. Next, click on the Password Policies link on
the lef side of the scieen undei the Portal heading. You will see theie is alieady
a default passwoid policy in the system. You can edit this in the same mannei
as you edit othei iesouices in the poital click Actions and then click Edit.
Te Passwoid Policy seuings foim contains the following elds. Enabling
specic seuings via the check boxes piompts seuing-specic options to appeai.
Name: iequiies you to entei a name foi the passwoid policy.
Description: lets you desciibe the passwoid policy so othei administiatois
will know what its foi.
Changeable: deteimines whethei oi not a usei can change his oi hei pass-
woid.
Change Required: deteimines whethei oi not a usei must change his oi hei
passwoid afei logging into the poital foi the ist time.
Minimum Age: lets you choose how long a passwoid must iemain in eect
befoie it can be changed.
Reset Tiet Max Age: deteimines how long a passwoid ieset link iemains
valid.
Password Syntax Cheing: allows you to set a minimum passwoid length
and to choose whethei oi not dictionaiy woids can be in passwoids. You can
also specify detailed iequiiements such as minimum numbeis of alpha numeiic
chaiacteis, lowei case leueis, uppei case leueis, numbeis oi symbols.
Password History: lets you keep a histoiy (with a dened length) of pass-
woids and pievents useis fiom changing theii passwoids to one that was pie-
viously used.
Password Expiration: lets you choose how long passwoids can iemain ac-
tive befoie they expiie. You can select the age, the waining time and a giace
limit.
Loout: allows you to set a numbei of failed log-in auempts that tiiggeis
a useis account to lock. You can choose whethei an administiatoi needs to
unlock the account oi if it becomes unlocked afei a specic duiation.
15.7. MANAGING PORTAL SETTINGS
liom the list of passwoid policies, you can peifoim seveial othei actions.
Edit: biings you to the foim above and allows you to modify the passwoid
policy.
Permissions: allows you to dene which useis, usei gioups oi ioles have
peimission to edit the passwoid policy.
Assign Members: takes you to a scieen wheie you can seaich and select
useis in the poital to be assigned to this passwoid policy. Te passwoid policy
will be enfoiced foi any useis who aie added heie.
Delete: shows up foi any passwoid policies you add beyond the default pol-
icy. You cannot delete the default policy.
Next, lets examine Lifeiays Poital Seuings.
Portal Settings
Most global poital seuings can be conguied fiom the Poital Seuings section of
the contiol panel. Te Conguiation heading contains the following links
General: lets you conguie global seuings, such as the company name, do-
main, the viitual host, a global poital logo and moie.
Authentication: allows you to conguie log in lDs, connection to LDAP and
Single Sign-On.
Users: has thiee tabs, labeled lields, Reseived Ciedentials and Default Usei
Associations. Te lields tab enables oi disables some usei elds, such as biith-
day oi teims of use. Te Reseived Ciedentials tab lets you ieseive scieen names
and email addiesses so useis cannot iegistei using them. You might use this
to pievent useis fiom iegisteiing on the poital with usei names that contain
piofanity oi that sound ocial, such as admin oi president. Te Default Usei
Associations tab lets you conguie default membeiship to ioles, usei gioups,
sites foi new useis and piovides a check box which allows you to ietioactively
apply these to existing useis.
Mail Host Names: lets you add a list of othei mail host names to be as-
sociated with youi oiganization. loi example, youi main domain might be
mycompany.com but you might use mycompany-marketing.com foi youi email
newsleueis. Any domain names associated with youi oiganization can go heie.
Email Notications: allows you to conguie Lifeiay to send email notica-
tions foi ceitain events, such as usei iegistiations, passwoid changes, etc. You
can customize those messages heie.
Lets discuss these seuings next.
CHAPTER 15. MANAGEMENT
Figure 15.13: Portal Settings Pages
General
Te Geneial link takes you to a page with thiee headings Main Conguiation,
Navigation and Additional lnfoimation. Undei the Main Conguiation heading,
you can set the name of the company, oiganization oi site which is iunning the
poital. Tis name also denes the name of youi poitals default site. lts default
name is liferay.com so you will denitely want to set this to ieect youi own
company. You can also set the mail domain, viitual host and content deliveiy
netwoik addiess heie. Undei the Navigation heading, you can set a home page
foi youi poital heie as well as default landing and logout pages. Undei the
Additional lnfoimation heading, you can specify a Legal name, lD, company
type, SlC code, tickei symbol, industiy and industiy type.
Authentication
Te Authentication page has seveial tabs Geneial, LDAP, CAS, lacebook, NTLM,
OpenlD, Open SSO and SiteMindei. You can use any of these authentication
methods to conguie how useis will authenticate to Lifeiay. Since Lifeiay sup-
15.7. MANAGING PORTAL SETTINGS
poits quite a few authentication methods, theie aie dieient seuings foi each.
Te seuings on the Geneial tab of the Authentication page aect only Lif-
eiay functionality and dont have anything to do with the integiation options
on the othei tabs. Te Geneial tab allows you to customize Lifeiays standaid
authentication behavioi. Specically, the Geneial tab allows you to select fiom
seveial global authentication seuings
Authenticate via email addiess (default), scieen name oi usei lD (a nu-
meiical lD auto-geneiated in the database not iecommended).
Enable/Disable automatic log in. lf enabled, Lifeiay allows a usei to check
a box which will cause the site to iemembei the useis log in by placing
a cookie on his oi hei biowsei. lf disabled, useis will always have to log
in manually.
Enable/Disable foigouen passwoid functionality.
Enable/Disable iequest passwoid ieset links.
Enable/Disable account cieation by stiangeis. lf you aie iunning an ln-
teinet site, you will piobably want to leave this on so visitois can cieate
accounts on youi site.
Enable/Disable account cieation by those using an email addiess in the
domain of the company iunning the site (which you just set on the Gen-
eial page of Poital Seuings). Tis is handy if you aie using Lifeiay to host
both inteinal and exteinal web sites. You can make suie all inteinal lDs
have to be cieated by administiatois but exteinal useis can iegistei foi
lDs themselves.
Enable / Disable email addiess veiication. lf you enable this, Lifeiay will
send useis a veiication email with a link back to the poital to veiify the
email addiess they enteied is a valid one they can access.
By default, all seuings except foi the last aie enabled. Usei authentication
by email addiess is an impoitant default foi the following ieasons
1. An email addiess is, by denition, unique to the usei who owns it.
2. People can geneially iemembei theii email addiesses. lf you have useis who
havent logged into the poital foi a while, it is possible they will foiget theii
scieen names, especially if they weient allowed to use theii scieen names
of choice (because they weie alieady taken).
8 CHAPTER 15. MANAGEMENT
3. lf a usei changes his oi hei email addiess, it is moie likely the usei will foiget
to update his oi hei email addiess in his oi hei piole, if the email addiess
is not used to authenticate. lf the useis email addiess is not updated, all
notications sent by the poital will fail to ieach the usei. So it is impoitant
to keep the email addiess at the foiefiont of a useis mind when he oi she
logs in to help the usei keep it up to date.
Well examine how to set up LDAP authentication next.
15.8 Integrating Liferay users into your enterprise
LDAP
You can use the LDAP tab of the Authentication page to connect Lifeiay to an
LDAP diiectoiy. Teie aie two places foi you to conguie the LDAP seuings
heie in the contiol panel oi in the portal-ext.properties le (which is cov-
eied in chaptei 20). We iecommend you use the contiol panel since youi cong-
uiation seuings will be stoied in the database. Note that if you use both, the set-
tings in the database will be meiged with the seuings in portal-ext.properties.
lf theies a conict oi oveilapping data, the LDAP seiveis set in the contiol panel
take piecedence ovei the seiveis set in portal-ext.properties. Conguiing
the LDAP seuings fiom the contiol panel is easiei and does not iequiie a iestait
of Lifeiay. Te only compelling ieason to use the portal-ext.properties
le is if you have many Lifeiay nodes which will be conguied to iun against
the same LDAP diiectoiy. ln that case, foi youi initial deployment, it may be
easiei to copy the portal-ext.properties le to all of the nodes so the ist
time they stait up, the seuings aie coiiect. Regaidless of which method you
use, the available seuings aie the same.
You conguie the global values fiom the LDAP tab of the Authentication
page.
Enabled: Check this box to enable LDAP Authentication.
Required: Check this box if LDAP authentication is iequiied. Lifeiay will
then not allow a usei to log in unless he oi she can successfully bind to the
LDAP diiectoiy ist. Uncheck this box if you want to allow useis with Lifeiay
accounts but no LDA accounts to log in to the poital.
LDAP Servers: Lifeiay suppoits connections to multiple LDAP seiveis. You
can you the Add buuon beneath this heading to add LDAP seiveis. We explain
how to conguie new LDAP seiveis below.
Import/Export: You can impoit and expoit usei data fiom LDAP diiectoiies
using the following options
15.8. INTEGRATING LIFERAY USERS INTO YOUR ENTERPRISE 9
Import Enabled: Check this box to cause Lifeiay to do a mass impoit
fiom youi LDAP diiectoiies. lf you want Lifeiay to only synchionize
useis when they log in, leave this box unchecked. Denitely leave this
unchecked if you aie woiking in a clusteied enviionment. Otheiwise, all
of youi nodes would tiy to do a mass impoit when each of them staits
up.
Import on Startup Enabled: Check this box to have Lifeiay iun the impoit
when it staits up. Note Tis box only appeais if you check the Import
Enabled box above.
Export Enabled: Check this box to enable Lifeiay to expoit usei accounts
fiom the database to LDAP. Lifeiay uses a listenei to tiack any changes
made to the User object and will push these changes out to the LDAP
seivei whenevei the User object is updated. Note that by default on ev-
eiy login, elds such as LastLoginDate aie updated. When expoit is
enabled, this has the eect of causing a usei expoit eveiy time the usei
logs in. You can disable this by seuing the following piopeity in youi
portal-ext.properties le
useis.update.last.loginfalse
Use LDAP Password Policy: Lifeiay uses its own passwoid policy by default.
Tis can be conguied on the Passwoid Policies page of the contiol panel. Check
the Use LDAP Password Policy box if you want to use the passwoid policies de-
ned by youi LDAP diiectoiy. Once this is enabled, the Passwoid Policies tab
will display a message stating you aie not using a local passwoid policy. You
will now have to use youi LDAP diiectoiys mechanism foi seuing passwoid
policies. Lifeiay does this by paising the messages in the LDAP contiols ie-
tuined by youi LDAP seivei. By default, the messages in the LDAP contiols
that Lifeiay is looking foi aie the messages ietuined by the ledoia Diiectoiy
Seivei. lf you aie using a dieient LDAP seivei, you will need to customize the
messages in Lifeiays portal-ext.properties le, as theie is not yet a GUl
foi seuing this. See below foi instiuctions desciibing how to do this.
Once youve nished conguiing LDAP, click the Save buuon. Next, lets
look at how to add LDAP seiveis.
Adding LDAP Servers
Te Add buuon beneath the LDAP seiveis heading allows you to add LDAP
seiveis. lf you have moie than one, you can aiiange the seiveis by oidei of
0 CHAPTER 15. MANAGEMENT
piefeience using the up/down aiiows. When you add an LDAP Seivei, you will
need to piovide seveial pieces of data so Lifeiay can bind to that LDAP seivei
and seaich it foi usei iecoids. Regaidless of how many LDAP seiveis you add,
each seivei has the same conguiation options.
Server Name: Entei a name foi youi LDAP seivei.
Default Values: Seveial leading diiectoiy seiveis aie listed heie. lf you aie
using one of these, select it and click the Reset Values buuon. Te iest of the
foim will be populated with the piopei default values foi that diiectoiy.
Connection: Tese seuings covei the basic connection to LDAP.
Base Provider URL: Tis tells the poital wheie the LDAP seivei is located.
Make suie the machine on which Lifeiay is installed can communicate
with the LDAP seivei. lf theie is a iewall between the two systems,
check to make suie the appiopiiate poits aie opened.
Base DN: Tis is the Base Distinguished Name foi youi LDAP diiectoiy.
lt is usually modeled afei youi oiganization. loi a commeicial oigani-
zation, it may look similai to this dc=companynamehere,dc=com.
Principal: By default, the administiatoi lD is populated heie. lf you have
iemoved the default LDAP administiatoi, you will need to use the fully
qualied name of the administiative ciedential you use instead. You need
an administiative ciedential because Lifeiay will be using this lD to syn-
chionize usei accounts to and fiom LDAP .
Credentials: Tis is the passwoid foi the administiative usei.
Tis is all you need to make a iegulai connection to an LDAP diiectoiy. Te
iest of the conguiation is optional. Geneially, the default auiibute mappings
piovide enough data to synchionize back to the Lifeiay database when a usei
auempts to log in. To test the connection to youi LDAP seivei, click the Test
LDAP Connection buuon.
lf you aie iunning youi LDAP diiectoiy in SSL mode to pievent ciedential
infoimation fiom passing thiough the netwoik unenciypted, you will have to
peifoim extia steps to shaie the enciyption key and ceiticate between the two
systems.
loi example, assuming youi LDAP diiectoiy happens to be Miciosof Active
Diiectoiy on Windows Seivei 2003, you would take the following steps to shaie
the ceiticate
Click Stait Administiative Tools Ceiticate Authoiity. Highlight the
machine that is the ceiticate authoiity, iight click on it, and click Properties.
15.8. INTEGRATING LIFERAY USERS INTO YOUR ENTERPRISE 1
liom the Geneial menu, click View Certicate. Select the Details view, and click
Copy To File. Use the iesulting wizaid to save the ceiticate as a le. As with
the CAS install (see the below section entitled Single Sign-On), you will need
to impoit the ceiticate into the cacerts keystore. Te impoit is handled by a
command like the following
keytool -import -trustcacerts -keystore /some/path/jdk1.5.0_11/jre/ \
lib/security/cacerts -storepass changeit -noprompt -alias MyRootCA \
-file /some/path/MyRootCA.cer
Te keytool utility ships as pait of the Java SDK.
Once this is done, go back to the LDAP page in the contiol panel. Modify the
LDAP URL in the Base DN eld to the secuie veision by changing the piotocol
to https and the poit to 636 like the following
ldaps://myLdapServerHostname:636
Save the changes. Youi Lifeiay Poital will now use LDAP in secuie mode foi
authentication.
Users: Tis section contains seuings foi nding useis in youi LDAP diiec-
toiy.
Authentication Search Filter: Te seaich ltei box can be used to detei-
mine the seaich ciiteiia foi usei logins. By default, Lifeiay uses useis
email addiesses foi theii login names. lf you have changed this seuing,
you will need to modify the seaich ltei heie, which has been conguied
to use the email addiess auiibute fiom LDAP as a seaich ciiteiion. loi
example, if you changed Lifeiays authentication method to use scieen
names instead of the email addiesses, you would modify the seaich ltei
so it can match the enteied log in name
(cn=@screen\_name@)
Import Search Filter: Depending on the LDAP seivei, theie aie dieient
ways to identify the usei. Geneially, the default seuing
1
is ne but if you
want to seaich foi only a subset of useis oi useis that have dieient object
classes, you can change this.
1
objectClass=inetOrgPerson
2 CHAPTER 15. MANAGEMENT
User Mapping: Te next seiies of elds allows you to dene mappings
fiomLDAP auiibutes to Lifeiay elds. Tough youi LDAP usei auiibutes
may be dieient fiom LDAP seivei to LDAP seivei, theie aie ve elds
Lifeiay iequiies to be mapped foi the usei to be iecognized. You must de-
ne a mapping to the coiiesponding auiibutes in LDAP foi the following
Lifeiay elds
Screen Name
Password
Email Address
Full Name
First Name
Middle Name
Last Name
Job Title
Group
Te contiol panel piovides default mappings foi commonly used LDAP at-
tiibutes. You can also add youi own mappings if you wish.
Test LDAP Users: Once you have youi auiibute mappings set up (see
above), click the Test LDAP Users buuon and Lifeiay will auempt to pull
LDAP useis and match them with theii mappings as a pieview.
Groups: Tis section contains seuings foi mapping LDAP gioups to Lifeiay.
Import Search Filter: Tis is the ltei foi nding LDAP gioups you want
to map to Lifeiay. Entei the LDAP gioup auiibutes you want ietiieved
foi this mapping. Te following auiibutes can be mapped
Gioup Name
Desciiption
Usei
Test LDAP Groups: Click the Test LDAP Groups to display a list of the
gioups ietuined by youi seaich ltei.
Export: Tis section contains seuings foi expoiting usei data fiom LDAP.
15.8. INTEGRATING LIFERAY USERS INTO YOUR ENTERPRISE 3
Figure 15.14: Testing LDAP Users
Users DN: Entei the location in youi LDAP tiee wheie the useis will be
stoied. When Lifeiay does an expoit, it will expoit the useis to this loca-
tion.
User Default Object Classes: When a usei is expoited, the usei is cieated
with the listed default object classes. To nd out what youi default object
classes aie, use an LDAP biowsei tool such as JXploiei to locate a usei
and view the Object Class auiibutes stoied in LDAP foi that usei.
Groups DN: Entei the location in youi LDAP tiee wheie the gioups will
be stoied. When Lifeiay does an expoit, it will expoit the gioups to this
location.
Group Default Object Classes: When a gioup is expoited, the gioup is cie-
ated with the listed default object classes. To nd out what youi default
object classes aie, use an LDAP biowsei tool such as Jxplorer to locate a
gioup and view the Object Class auiibutes stoied in LDAP foi that gioup.
Once youve set all youi options and tested youi connection, click Save.
liom heie, you can add anothei LDAP seivei oi set just a few moie options
that apply to all of youi LDAP seivei connections.
4 CHAPTER 15. MANAGEMENT
Figure 15.15: Mapping LDAP Groups
LDAP Options Not Available in the GUI
Although most of the LDAP conguiation can be done fiom the contiol panel,
theie aie seveial conguiation paiameteis that aie only available by editing
portal-ext.properties. Tese options will be available in the GUl in futuie
veisions of Lifeiay Poital but foi now they can only be conguied by editing
the piopeities le.
lf you need to change any of these options, copy the LDAP section fiom the
portal.properties le into youi portal-ext.properties le. Note that
since you have alieady conguied LDAP fiom the GUl, any seuings fiom the
piopeities le that match seuings alieady conguied in the GUl will be ignoied.
Te GUl, which stoies the seuings in the database, always takes piecedence ovei
the piopeities le.
ldap.auth.method=bind
#ldap.auth.method=password-compare
Set eithei bind oi passwoid-compaie foi the LDAP authentication method.
Bind is piefeiied by most vendois so you dont have to woiiy about enciyp-
tion stiategies. Passwoid compaie does exactly what it sounds like it ieads
the useis passwoid out of LDAP, deciypts it and compaies it with the useis
passwoid in Lifeiay, syncing the two.
ldap.auth.password.encryption.algorithm=
ldap.auth.password.encryption.algorithm.types=MD5,SHA
15.8. INTEGRATING LIFERAY USERS INTO YOUR ENTERPRISE
Set the passwoid enciyption to used to compaie passwoids if the piopeity
ldap.auth.method is set to password-compare.
ldap.import.method=[user,group]
lf you set this to user, Lifeiay will impoit all useis fiomthe specied poition
of the LDAP tiee. lf you set this to group, Lifeiay will seaich all the gioups and
impoit the useis in each gioup. lf you have useis who do not belong to any
gioups, they will not be impoited.
ldap.error.password.history=history
ldap.error.password.not.changeable=not allowed to change
ldap.error.password.syntax=syntax ldap.error.password.trivial=trivial
ldap.error.user.lockout=retry limit
ldap.error.password.age=age ldap.error.password.expired=expired
Tese piopeities aie a list of phiases fiomeiioi messages which can possibly
be ietuined by the LDAP seivei. When a usei binds to LDAP, the seivei can
ietuin controls with its iesponse of success oi failuie. Tese contiols contain a
message desciibing the eiioi oi the infoimation that is coming back with the
iesponse. Tough the contiols aie the same acioss LDAP seiveis, the messages
can be dieient. Te piopeities desciibed heie contain snippets of woids fiom
those messages and will woik with Red Hats ledoia Diiectoiy Seivei. lf you aie
not using that seivei, the woid snippets may not woik with youi LDAP seivei.
lf they dont, you can ieplace the values of these piopeities with phiases fiom
youi seiveis eiioi messages. Tis will enable Lifeiay to iecognize them. Next,
lets look at the Single Sign-On solutions Lifeiay suppoits.
SSO
Single Sign-On solutions allow you to piovide a single login ciedential foi mul-
tiple systems. Tis allows you to have people authenticate to the Single Sign-On
pioduct and they will be automatically logged in to Lifeiay and to othei pioducts
as well.
Lifeiay suppoits seveial single sign-on solutions. Of couise, if youi pioduct
is not yet suppoited, you may choose to implement suppoit foi it youiself by
use of the extension enviionment. Alteinatively, youi oiganization can choose
to sponsoi suppoit foi it. Please contact sales@liferay.com foi moie infoi-
mation about this.
CHAPTER 15. MANAGEMENT
Authentication: Central Authentication Service (CAS)
CAS is an authentication system oiiginally cieated at Yale Univeisity. lt is a
widely-used open souice single sign-on solution and was the ist SSO pioduct
to be suppoited by Lifeiay.
Please follow the documentation foi CAS to install it on youi application
seivei of choice.
Youi ist step will be to copy the CAS client .jai le to Lifeiays libiaiy
foldei. On Tomcat, this is in [Tomcat Home]/webapps/ROOT/WEB-INF/lib.
Once youve done this, the CAS client will be available to Lifeiay the next time
you stait it.
Te CAS Seivei application iequiies a piopeily conguied Secuie Socket
Layei ceiticate on youi seivei to woik. lf you wish to geneiate one youiself,
you will need to use the keytool utility that comes with the JDK. Youi ist step
is to geneiate the key. Next, you expoit the key into a le. linally, you impoit
the key into youi local Java key stoie. loi public, lnteinet-based pioduction
enviionments, you will need to eithei puichase a signed key fiom a iecognized
ceiticate authoiity (such as Tawte oi Veiisign) oi have youi key signed by a
iecognized ceiticate authoiity. loi lntianets, you should have youi lT depait-
ment pie-conguie useis biowseis to accept the ceiticate so they dont get
waining messages about the ceiticate.
To geneiate a key, use the following command
keytool -genkey -alias tomcat -keypass changeit -keyalg RSA
lnstead of the passwoid in the example (changeit), use a passwoid you will
iemembei. lf you aie not using Tomcat, you may want to use a dieient alias
as well. loi liist and Last names, entei localhost oi the host name of youi
seivei. lt cannot be an lP addiess.
To expoit the key to a le, use the following command
keytool -export -alias tomcat -keypass changeit -file server.cert
linally, to impoit the key into youi Java key stoie, use the following com-
mand
keytool -import -alias tomcat -file %FILE_NAME% -keypass changeit -keystore \
\$JAVA\_HOME/jre/lib/security/cacerts
lf you aie on a Windows system, ieplace $JAVA_HOME above with %JAVA_HOME%.
Of couise, all of this needs to be done on the system on which CAS will be iun-
ning.
15.8. INTEGRATING LIFERAY USERS INTO YOUR ENTERPRISE
Once youi CAS seivei is up and iunning, you can conguie Lifeiay to use it.
Tis is a simple mauei of navigating to the Seings Authentication CAS
tab in the contiol panel. Enable CAS authentication and then modify the URL
piopeities to point to youi CAS seivei.
Enabled: Check this box to enable CAS single sign-on.
Import fromLDAP: Ausei may be authenticated fiomCAS and not yet exist
in the poital. Select this to automatically impoit useis fiom LDAP if they do not
exist in the poital.
Te iest of the seuings aie vaiious URLs, with defaults included. Change lo-
calhost in the default values to point to youi CAS seivei. When you aie nished,
click Save. Afei this, when useis click the Sign In link, they will be diiected to
the CAS seivei to sign in to Lifeiay.
Authentication: Facebook
Lifeiay Poital also enables useis to log in using theii lacebook accounts. To
enable this featuie, you simply need to select the Enable box and entei the Ap-
plication lD and Application Seciet which should have been piovided to you by
lacebook. lacebook SSO woiks by taking the piimaiy lacebook email addiess
and seaiching foi the same email addiess in Lifeiays User_ table. lf a match is
found, the usei is automatically signed on (piovided the usei clicked allow fiom
the lacebook dialog). lf theie isnt a match, the usei is piompted in Lifeiay to
add a usei fiom lacebook. Once selected, a new usei is cieated by ietiieving
foui elds fiom lacebook (ist name, last name, email addiess and gendei).
Authentication: NTLM
NTLM is a Miciosof piotocol that can be used foi authentication thiough Mi-
ciosof lnteinet Exploiei. Tough Miciosof has adopted Keibeios in modein
veisions of Windows seivei, NTLM is still used when authenticating to a woik-
gioup. Lifeiay Poital now suppoits NTLM v2 authentication. NTLM v2 is moie
secuie and has a stiongei authentication piocess than NTLMv1.
Enabled: Check this box to enable NTLM authentication.
Domain Controller: Entei the lP addiess of youi domain contiollei. Tis is
the seivei that contains the usei accounts you want to use with Lifeiay.
Domain: Entei the domain / woikgioup name.
Service Account: You need to cieate a seivice account foi NTLM. Tis ac-
count will be a computei account, not a usei account.
Service Password: Entei the passwoid foi the seivice account.
8 CHAPTER 15. MANAGEMENT
Authentication: OpenID
OpenlD is a new single sign-on standaid which is implemented by multiple
vendois. Te idea is multiple vendois can implement the standaid and then
useis can iegistei foi an lD with the vendoi they tiust. Te ciedential issued
by that vendoi can be used by all the web sites that suppoit OpenlD. Some high
piole OpenlD vendois aie
AOL hup//openid.aol.com/scieenname
LiveDooi hup//piole.livedooi.com/useiname
LiveJouinal hup//useiname.livejouinal.com
Please see the OpenlD site hup//www.openid.net foi a moie complete list.
A main benet of OpenlD foi the usei is he oi she no longei has to iegistei
foi a new account on eveiy site in which he oi she wants to paiticipate. Useis
can iegistei on one site (the OpenlD piovideis site) and then use those cie-
dentials to authenticate to many web sites which suppoit OpenlD. Many web
site owneis ofen stiuggle to build communities because end useis aie ieluc-
tant to iegistei foi so many dieient accounts. Suppoiting OpenlD makes it
easiei foi site owneis to build theii communities because the baiiieis to paitic-
ipating (i.e., the eoit it takes to iegistei foi and keep tiack of many accounts)
aie iemoved. All of the account infoimation is kept with the OpenlD piovidei,
making it much easiei to manage this infoimation and keep it up to date.
Lifeiay Poital can act as an OpenlD consumei, allowing useis to automati-
cally iegistei and sign in with theii OpenlD accounts. lnteinally, the pioduct
uses OpenlD4Java hup//code.google.com/p/openid4java/ to implement the fea-
tuie.
OpenlD is enabled by default in Lifeiay but can be disabled heie.
Atlassian Crowd
Atlassian Ciowd is a web-based Single Sign-On pioduct similai to CAS. Ciowd
can be used to manage authentication to many dieient web applications and
diiectoiy seiveis.
Because Atlassian Ciowd implements an OpenlD pioducei, Lifeiay woiks
and has been tested with it. Simply use the OpenlD authentication featuie in
Lifeiay to log in using Ciowd.
15.8. INTEGRATING LIFERAY USERS INTO YOUR ENTERPRISE 9
Authentication: OpenSSO
OpenSSO is an open souice single sign-on solution that comes fiom the code
base of Suns SystemAccess Managei pioduct. Lifeiay integiates with OpenSSO,
allowing you to use OpenSSO to integiate Lifeiay into an infiastiuctuie that
contains a multitude of dieient authentication schemes against dieient iepos-
itoiies of identities.
You can set up OpenSSO on the same seivei as Lifeiay oi a dieient box.
lollowthe instiuctions at the OpenSSOsite hup//opensso.dev.java.net to install
OpenSSO. Once you have it installed, cieate the Lifeiay administiative usei in
it. Useis aie mapped back and foith by scieen names. By default, the Lifeiay
administiative usei has a scieen name of test, so in OpenSSO, you would iegistei
the usei with the lD of test and an email addiess of test@liferay.com. Once you
have the usei set up, log in to Open SSO using this usei.
ln the same biowsei window, go to the URL foi youi seivei iunning Lifeiay
and log in as the same usei, using the email addiess test@liferay.com. Go to
the contiol panel and click Seings Authentication OpenSSO. Modify the
thiee URL elds (Login URL, Logout URL and Seivice URL) so they point to
youi OpenSSO seivei (i.e., only modify the host name poition of the URLs),
click the Enabled check box and then click Save. Lifeiay will then iediiect useis
to OpenSSO when they click the Sign In link.
Authentication: SiteMinder
SiteMindei is a single sign-on implementation fiom Computei Associates. Lif-
eiay .2 intioduced built-in integiation with SiteMindei. SiteMindei uses a cus-
tom HTTP headei to implement its single sign-on solution.
To enable SiteMindei authentication in Lifeiay, check the Enabled box on
the SiteMinder tab. lf you aie also using LDAP with Lifeiay, you can check
the Import from LDAP box. lf this box is checked, useis authenticated fiom
SiteMindei who do not exist in the poital will be impoited fiom LDAP.
Te last eld denes the headei SiteMindei is using to keep tiack of the usei.
Te default value is alieady populated. lf you have customized the eld foi youi
installation, entei the custom value heie.
When you aie nished, click Save. Next, lets examine how to conguie
poital-wide usei seuings.
80 CHAPTER 15. MANAGEMENT
Users
Te Useis page of Poital Seuings has thiee tabs lields, Reseived Ciedentials
and Default Usei Associations.
Te lields tab allows you to enable/disable the following elds
Enable/disable iequiiing the Teims of Use
Enable/disable usei scieen names autogeneiation
Enable/disable iequiiing the last names
Enable/disable the biithday eld
Enable/disable the gendei eld
Te next tab is Reseived Ciedentials. You can entei scieen names and email
addiesses heie that you dont want otheis to use. Lifeiay will then pievent useis
fiom iegisteiing with these scieen names and email addiesses. You might use
this featuie to pievent useis fiom cieating lDs that look like administiative lDs
oi that have ieseived woids in theii names.
Te Default Usei Associations tab has thiee elds allowing you to list (one
pei line) sites, ioles and usei gioups you want new useis to become membeis
of automatically. By default, Lifeiay assigns new useis to both the Useis iole
and the Powei Useis iole.
lf you have dened othei usei gioups, sites oi ioles you want newly cieated
useis to be membeis of by default, entei them heie. loi example, you may have
dened site templates in ceitain usei gioups to pie-populate end useis piivate
pages. lf theie is a paiticulai conguiation you want eveiyone to have, you may
want to entei those usei gioups heie.
15.9 Summary
ln this chaptei, we began to examine Lifeiays contiol panel. Site membeiships
and teams aient the only way foi poital administiatois to gioup and manage
useis oiganizations can be used to aiiange useis into hieiaichical stiuctuies
and usei gioups aie a exible way to collect gioups of useis that tianscend
oiganizational hieiaichies. You can cieate ioles to dene peimissions and scope
them foi the entiie poital oi foi a paiticulai site oi oiganization. Usei gioups
can be assigned to ioles, in this case, each membei of the usei gioup is assigned
to the iole.
15.9. SUMMARY 81
We also looked at how to conguie passwoid policies foi useis. Next, we
looked at the dieient authentication options piovided by Lifeiay. You can con-
guie Lifeiay so that useis can authenticate via LDAP, CAS, lacebook, NTLM,
OpenlD, OpenSSO, oi SiteMindei. linally, we examined some geneial cong-
uiation options foi the poital useis. Well continue oui coveiage of Lifeiays
Contiol Panel in the next chaptei.
Cu~v1rv 1
UsiNc 1ur CoN1voi P~Nri
ln this chaptei, we continue oui coveiage of Lifeiays contiol panel that we
began in chaptei 1. Well covei the following topics
Poital seuings including mail host names, email notications, identica-
tion, and display seuings
Custom elds
Monitoiing
Plugins conguiation
Seivei administiation, including iesouices, log levels, piopeities, captcha
data migiation, le uploads, mail, exteinal seivices, sciipts, and shutdown
seuings
Poital instances
Lets begin with mail host names.
82
83
Mail Host Names
Mail Host Names appeais afei Authentication and Useis on the Poital Seuings
page of the contiol panel. You can entei othei mail host names (one pei line)
besides the one you conguied on the Geneial tab. Tis lets the poital know
which mail host names aie owned by youi oiganization.
Email Notications
Teie aie ve tabs undei the Email Notications page of Poital Seuings. Te
Sendei tab allows you to set the poitals administiative name and email addiess.
By default, these aie Joe Bloggs and test@liferay.com. You can change
them to whatevei you want. Tis name and email addiess will appeai in the
liom eld in all email messages sent by the poital.
Figure 16.1: Automated Emails: Account Created Notication
Te othei foui tabs aie Account Cieated Notication, Email Veiication
Notication, Passwoid Changed Notication and Passwoid Reset Notication.
84 CHAPTER 16. USING THE CONTROL PANEL
Tese tabs allowyou to customize the email messages that aie sent to useis each
time any of those foui events occui.
Figure 16.2: Denition of Terms for Automated Emails
A list of tokens, entitled Denition of Teims, is piovided so you can inseit
ceitain values (such as the poital URL oi the usei lD) when you aie seuing up
the custom email messages.
Identication
Te identication section has seveial links foi addiesses, phone numbeis and
othei infoimation you can conguie in youi poital. Tis allows you to set up
contact infoimation foi the oiganization that owns the poital. Developeis can
queiy foi this infoimation in theii applications.
Miscellaneous: Display Settings
Tis section allows you to set the default poital language and the time zone.
You can also set up a poital-wide logo which appeais in the top lef coineis of
poital pages.
Lifeiays default theme is conguied to display the poital logo. loi custom
themes, you can choose whethei oi not to display the logo. Be caieful to choose
an image le that ts the space. lf you pick something too big, it might oveilap
with the navigation. Next, lets look at how to customize dieient types of
poital assets using custom elds.
16.1 CustomFields
Custom elds appeai beneath Poital Seuings in the Poital section of the contiol
panel. Custom elds aie a way to add auiibutes to many types of assets in the
poital. loi example, if youie using Lifeiay Poital to cieate a site foi iating
16.1. CUSTOM FIELDS 8
Figure 16.3: Server Conguration Miscellaneous Display Settings
8 CHAPTER 16. USING THE CONTROL PANEL
books, you might assign the Usei object a custom eld called lavoiite Books. lf
youie using the wiki foi book ieviews, you might add elds foi Book Title and
Book Authoi.
To add a custom eld, click on the Custom Fields link in the contiol panel.
Ten choose a iesouice, click on the Edit link next to it and select Add Custom
Field.
Figure 16.4: CustomFields Resource List
liom heie you will need to add the custom eld key. Te key appeais as
the label foi the eld on the foim. loi some poital assets (like the Usei), custom
elds aie a sepaiate section of the foim. loi otheis, as can be seen above, custom
elds aie integiated with the default elds on the foim. Additionally, develop-
eis can access custom elds piogiamatically thiough the <liferay-ui:cus-
tom-attribute /> tag.
You can cieate elds of many dieient types text elds (indexed oi seciet),
integeis, selection of multiple values and moie. Once youve cieated a eld, you
cannot change its type.
16.2. MONITORING 8
Figure 16.5: CustomFields Integrated with the Rest of the Fields on the
Wiki Form
16.2 Monitoring
Te next link on the lef side of the contiol panel is foi monitoiing. You can use
the Monitoiing page to view all of the live sessions in the poital. loi peifoi-
mance ieasons, this seuing is usually tuined o in pioduction.
16.3 Plugins Conguration
Te Plugins Conguiation page contains tabs foi thiee types of plugins poitlets,
themes and layouts. You can use these tabs to view which ioles can add plugins
to pages oi you can make the plugins active oi inactive.
Note that this is foi basic conguiation if you want to view the existing
peimission conguiation foi a given poitlet and/oi modify that conguiation
foi existing ioles, this is wheie you can do that. lf you need to add peimissions
to new ioles foi a given poitlet, use the Roles section of the contiol panel and
the Actions Dene Permissions buuon. Next, lets look at how to apply seivei
conguiations.
88 CHAPTER 16. USING THE CONTROL PANEL
16.4 Server Administration
Te Seivei Administiation page of the contiol panel lets you peifoim vaiious
tasks ielated to the poital seivei itself, as opposed to the iesouices in the poital.
Clicking the link makes this cleai youie immediately piesented with a giaph
showing the iesouices available in the JVM.
Resources
Te ist tab is called Resources . Tis tab contains the afoiementioned giaph
plus seveial seivei wide actions that an administiatoi can execute. Tese aie
Garbage collection: You can send in a iequest to the JVM to begin the
gaibage collection task.
Clearing VM caes: You can send in a iequest to the JVM to cleai a single
VM cache.
Clearing caes across the cluster: You can send in a iequest to the JVM to
cleai content cached acioss the entiie clustei.
Clearing database caes: You can send in a iequest to the JVM to cleai the
database cache.
Reindex all searindexes: You can send in a iequest to iegeneiate all seaich
indexes. lf you aie not using a Soli seaich seivei this will impact poital peifoi-
mance so tiy to do this at non-peak times.
Reset Document Library preview and thumbnail les: You can send in a
iequest to ieset the pieview and thumbnail les foi each item in youi poitals
Documents and Media libiaiies.
Generate read Dump: lf you aie peifoimance testing, you can geneiate
a thiead dump which can be examined latei to deteimine if theie aie any dead-
locks and wheie they might be.
Verify database tables of all plugins: Checks all tables against theii indexes
foi accuiacy of data ietiieval.
Clean up Permissions: Tis piocess iemoves the assignment of some pei-
missions on the Guest, Usei and Powei Usei ioles to simplify the management
of Usei Customizable Pages. Notably, Add To Page peimissions is iemoved
fiom the Guest and Usei ioles foi all poitlets. Likewise the same peimission is
ieduced in scope foi Powei Useis fiom poital wide to scoped to Usei Peisonal
Site.
16.4. SERVER ADMINISTRATION 89
Log Levels
Te Log Levels tab of the Seivei Administiation page allows you to dynamically
modify the log levels foi any class hieiaichy in the poital. lf you have custom
code you have deployed which isnt in the list, you can use the Add Category
tab to add it. lf you change the log level neai the top of the class hieiaichy
(such as at com.liferay), all the classes undei that hieiaichy will have theii
log levels changed. lf you aie testing something specic, it is much beuei to be
as specic as you can when you change log levels. Modifying them too high in
the hieiaichy geneiates a lot moie log messages than you need.
Properties
Lifeiay and the JVM contain many seuings which aie dened as piopeities.
Teie aie two subtabs of the piopeities tab of the Seivei Administiation page
one showing system piopeities and one showing poital piopeities.
Te system piopeities tab shows an exhaustive list of system piopeities foi
the JVM, as well as many Lifeiay system piopeities. Tis infoimation can be
used foi debugging puiposes oi to check the conguiation of the cuiiently iun-
ning poital.
Te poital piopeities tab tab shows an exhaustive list of the poital piopeities.
Tese piopeities can be customized, you can peiuse the full list of customizable
piopeities in chaptei 20. lf you need to check the cuiient value of a paiticulai
piopeity, it can be viewed fiom this scieen without having to shut down the
poital oi open any piopeities les.
Captcha
By default, Lifeiay ships with its own simple captcha seivice which is designed
to thwait bots fiom iegisteiing foi accounts on sites poweied by Lifeiay. lf you
want to instead use Googles ieCaptcha seivice, you can enable this seuing fiom
the Captcha tab of the Seivei Administiation page.
Simply check the Enable ReCaptcha box and entei youi public and piivate
keys into the piovided elds, then click Save. Lifeiay Poital will then use ie-
Captcha instead of simple captcha.
Data Migration
lf you aie upgiading fiom a pievious ielease of Lifeiay Poital oi if you need to
migiate youi data fiomone systemto anothei, the Data Migiation tab helps you
to do that without youi developeis having to wiite custom sciipts.
90 CHAPTER 16. USING THE CONTROL PANEL
Te ist section lets you copy youi entiie Lifeiay database fiom the cuiient
database undei which it is iunning to the database you specify in this set of
elds. Youll need to entei the diivei class name (and the diivei will need to be
on Lifeiays classpath), the JDBCURL of the database to which youll be copying
youi data and the ciedentials of a usei with access to that database. Once you
have all of this infoimation enteied, click Execute to copy the data.
Te next section helps you migiate youi documents. lf you want to move
o of the Jackiabbit JSR-10 iepositoiy to the le system, oi to the Jackiabbit
iepositoiy fiom the le system, oi to any of the othei iepositoiies suppoited
by the documents and media libiaiy, you can do so veiy easily. Make suie you
have alieady set up youi portal-ext.properties le so the hook is piopeily
conguied befoie iunning this migiation. Select the Document Libiaiy hook
that iepiesents wheie you want youi documents migiated and click Execute.
Youi documents will be migiated to the newiepositoiy. You can then shut down
Lifeiay, make the new iepositoiy the default in the portal-ext.properties
le and then iestait.
Similaily, you can migiate images fiom the lmage Galleiy in the same man-
nei.
File Uploads
Since Lifeiay allows useis to upload les in vaiious places, you may want to lock
down the type of les and the size of les useis aie allowed to upload. Te lile
Uploads tab of the Seivei Conguiation tab lets you set the oveiall maximum
le size and then oveiiide that size foi specic applications within Lifeiay. You
can limit the allowed le extensions geneially oi by application. You have a lot
of exibility as to how you want les to be managed within youi poital.
Mail
Rathei than using the portal-ext.properties le as we did in the installa-
tion chaptei, you can conguie a mail seivei fiom the Mail tab of the Seivei
Conguiation tab. lf the poital is to ieceive mail (see oui coveiage of the Mes-
sage Boaids poitlet in chaptei ), you can connect a POP mail seivei. lf the
poital is to send mail, which it needs to do to send notications to useis, you
can connect to an SMTP seivei heie as well and this is highly iecommended.
Note that if you add youi mail seivei seuings heie, they will oveiiide any-
thing in youi portal-ext.properties le.
16.4. SERVER ADMINISTRATION 91
External Services
Lifeiay Poital enables useis to upload and shaie content via the Documents and
Media libiaiy, a customizable and peimissionable online iepositoiy. Useis can
upload les of any type to the Documents and Media libiaiy. Lifeiay ships with
PDlBox and uses it to geneiate automatic pieviews foi ceitain types of docu-
ments, by default. You can also install thiee additional tools that oei highei
quality pieviews and document conveision functionality OpenOce oi Libie-
Oce, lmageMagick and Xugglei. With Lifeiay conguied to use these tools,
you can geneiate automatic pieviews foi many types of les incuding text les,
oce suite les, PDls, images, audio les and videos. Useis will also be able to
use the conveision functionality to download documents in a vaiiety of foimats.
Please see chaptei 4 on Documents and Media foi moie infoimation.
LibieOce is available heie LibieOce, lmageMagick is available heie lm-
ageMagick and Xugglei is available heie Xugglei. Make suie to choose the
coiiect veisions of these applications foi youi opeiating system. You can build
Xugglei 3.4.1012, which woiks with Lifeiay .1, fiom souice oi you can install
it fiom the binaiies
Souice
Linux (32-bit)
Linux (4-bit)
Mac OS X
Windows
Once youve installed these tools, you can use the Exteinal Seivices tab of
the contiol panel to conguie Lifeiay to use them.
OpenOfce/LibreOfce conguration
OpenOce and LibieOce aie open souice oce suites which aie usually iun
in giaphical mode to cieate documents but they can also be iun in seivei mode.
When iun in seivei mode, OpenOce and LibieOce can be used to conveit
documents to and fiom all of the le types it suppoits. Once conguied, Lifeiay
makes use of this featuie to automatically conveit content on the y. You can
install OpenOce oi LibieOce on the same machine upon which Lifeiay is
iunning oi you can connect to a sepaiate host.
lf youve installed OpenOce oi LibieOce on the same machine thats
iunning Lifeiay, you can stait it in seivei mode with the following command
92 CHAPTER 16. USING THE CONTROL PANEL
soffice --headless --accept="socket,host=127.0.0.1,port=8100;urp;"
--nofirststartwizard
Once OpenOce oi LibieOce has been installed and is iunning in seivei
mode, you can conguie Lifeiay to use it eithei in youi portal-ext.proper-
ties le oi fiom the contiol panel. To enable OpenOce/LibieOce in youi
portal-ext.properties le, add the following line
openoffice.server.enabled=true
lf OpenOce oi LibieOce is iunning on anothei seivei oi on a non-default
poit, you must also specify these values. Te default values aie as follows
openoffice.server.host=127.0.0.1
openoffice.server.port=8100
By default, when Lifeiay uses OpenOce oi LibieOce to peifoim convei-
sions, it uses a cache. Te ist time a document is conveited, a copy is saved
in the Lifeiay temp foldei /liferay/document_conversion/. When Lifeiay
ieceives a conveision iequest, it checks this foldei to see if the conveited doc-
ument alieady exists. lf the conveited document is found, Lifeiay ietuins it to
the usei. Otheiwise, it peifoims a fiesh conveision and saves a copy in the
temp foldei. lf the cache is tuined o, Lifeiay will always iegeneiate the le ie-
gaidless of whethei a pieviously existing conveision alieady exists in the temp
foldei. You can tuin the cache o by seuing the following piopeity
openoffice.cache.enabled=false
To conguie Lifeiay to use OpenOce/LibieOce fiom the contiol panel,
navigate to the Server Administration External Services page and check the
Enabled box foi OpenOce. lf OpenOce/LibieOce is iunning on a non-
default poit, you must also specify the poit numbei. By default, OpenOce
iuns on poit 8100, which is the default poit in the contiol panel. lf you have
something else iunning on this poit, nd an open poit and specify it both in
the command to stait OpenOce/LibieOce in seivei mode and on the contiol
panels Exteinal Seivices conguiation page. When you aie nished, click Save.
Now Lifeiay can peifoim many types of document conveisions.
16.4. SERVER ADMINISTRATION 93
ImageMagick conguration
Once youve installed the coiiect veision of ImageMagick foi youi opeiating
system, which should include the installation of Ghostsciipt, you need to cong-
uie Lifeiay to use lmageMagick. You can do this eithei in youi portal-ext.properties
le oi fiomthe contiol panel. To enable lmageMagick in youi portal-ext.properties
le, add the following lines and make suie the seaich path points to the diiec-
toiies foi the lmageMagick and Ghostsciipt executables. You may also need to
conguie the path foi fonts used by Ghostsciipt when in Mac oi Unix enviion-
ments.
imagemagick.enabled=true
imagemagick.global.search.path[apple]=/opt/local/bin:/opt/local/share \
/ghostscript/fonts:/opt/local/share/fonts/urw-fonts
imagemagick.global.search.path[unix]=/usr/local/bin:/usr/local/share/ghostscript/fonts: \
/usr/local/share/fonts/urw-fonts
imagemagick.global.search.path[windows]=C:\\Program Files\\ImageMagick
To enable lmageMagick fiomthe contiol panel, navigate to the Server Admin-
istration External Services page, check the Enabled checkbox foi lmageMag-
ick and veiify the paths to the lmageMagick and Ghostsciipt executables aie
coiiect.
Note that some oldei veisions of lmageMagick aie unable to piopeily iun
with Lifeiay. lf this is the case, update to the latest veision (lmageMagick ..9-
2012-09-2 Q1 oi latei). To check foi the latest lmageMagick veisions, visit
theii web site.
1
See Lifeiays issues ticketing system
2
foi infoimation on eoits
to identify incompatible application veisions with Lifeiay.
Xuggler conguration
Once youve installed the coiiect veision of Xuggler foi youi opeiating system,
you need to conguie youi enviionment vaiiables. Depending on wheie you
installed Xugglei, a conguiation similai to the following should woik on Unix-
like systems
export XUGGLE_HOME=/usr/local/xuggler
export LD_LIBRARY_PATH=$XUGGLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$XUGGLE_HOME/bin:$PATH
Once youi enviionment vaiiables aie set up coiiectly, you can conguie Lif-
eiay to use Xugglei eithei in youi portal-properties le oi fiom the contiol
1
hup//www.imagemagick.oig/sciipt/binaiy-ieleases.php
2
hup//issues.lifeiay.com/biowse/LPS-30291
94 CHAPTER 16. USING THE CONTROL PANEL
panel. lf youd like to use youi poital-ext.piopeities le, just add the following
line
xuggler.enabled=true
To conguie Lifeiay to use Xugglei in the contiol panel, navigate to the
Server Administration External Services page and check Enabled. Tats it'
Youve successfully conguied the Documents and Media libiaiy to use Xugglei
foi audio and video les.
Script
Lifeiay includes a sciipting console which lets administiatois execute migia-
tion oi management code instantly. Seveial sciipting languages aie suppoited,
including JavaSciipt, Gioovy, Python, Ruby and Beanshell. loi fuithei infoi-
mation about Lifeiays APls, see the JavaDoc oi Liferay in Action.
Shutdown
lf you evei need to shut down youi Lifeiay Poital seivei while useis aie logged
in, you can use the Shutdown tab to infoim youi logged-in useis of the impend-
ing shutdown. You can dene the numbei of minutes until the shutdown and a
custom message that will be displayed.
Useis will see youi message at the top of theii poital pages foi the duiation
of time you specied. When the time expiies, all poital pages will display a mes-
sage saying the poital has been shut down. At this point, the seivei will need
to be iestaited to iestoie access. Next, lets examine how to manage multiple
poital instances.
16.5 Portal Instances
Lifeiay Poital allows you to iun moie than one poital instance on a single seivei.
Te Poital lnstances page of the contiol panel lets you manage these instances.
Data foi each poital instance aie kept sepaiate fiomeveiy othei poital instance.
All poital data, howevei, is kept in the same database.
Each poital instance iequiies its own domain name. Lifeiay will diiect useis
to the piopei poital instance based on this domain name. So befoie you cong-
uie an instance, conguie its domain name in youi netwoik ist. When youie
ieady to add an instance, click the Add buuon heie.
Youll be piompted foi foui elds and a check box
16.6. PLUGINS INSTALLATION 9
Web ID: A geneial convention is to use the domain name foi this. lts a
usei-geneiated lD foi the instance.
Virtual Host: Put the domain name you conguied in youi netwoik heie.
When users aie diiected to youi Lifeiay seivei via this domain name, Lifeiay
will then be able to send them to the piopei poital instance.
Mail Domain: Entei the domain name foi the mail host foi this instance.
Lifeiay will use this to send email notications fiom the poital.
Max Users: Entei the maximum numbeis of usei accounts you would like
youi poital instance to suppoit.
Active: Use this check box to choose whethei to cieate an active oi an inac-
tive poital instance.
When you aie nished lling out the foim, click Save. Now navigate to the
poital using youi newdomain name. You will see you aie biought to what looks
like a clean install of Lifeiay. Tis is youi new poital instance which can now
be conguied any way you like.
16.6 Plugins Installation
Te Plugins Installation page of the contiol panel shows all of the plugins cui-
iently installed. Tese aie divided into tabs foi poitlets, themes, layout tem-
plates, hook plugins and web plugins. lf you want to install a new plugin, click
the Install More Portlets buuon. You will then be biought to the Plugin lnstallei,
wheie you can biowse Lifeiays iepositoiy of poitlets oi install youi own plu-
gins. We coveied the plugins installei and explained how to install plugins
manually in chaptei 13.
16.7 Summary
ln this chaptei, we nished oui oveiview of Lifeiays contiol panel that we
began in chaptei 1. We saw how to conguie mail host names, email noti-
cations, identication, and poital display seuings. We showed how you add
custom elds to vaiious poital entities such as useis, pages, documents, wiki
aiticles, message boaid posts, and moie.
Next, we sawhowto viewand conguie oveiall seivei seuings. We sawhow
to viewthe memoiy cuiiently being used by the seivei, as well as howto initiate
gaibage collection, a thiead dump, seaich engine ie-indexing and the cleaiing
of vaiious caches. We leained how to debug paits of the poital by changing log
levels and by viewing the vaiious piopeities dened in the poital.
9 CHAPTER 16. USING THE CONTROL PANEL
linally, we leained how to piopeily notify useis that the poital is about to
shut down and how to set up exeinal seivices like OpenOce integiation. We
looked at how to cieate multiple poital instances on a single installation of Life-
iay and we showed how to view cuiiently installed plugins.
We hope this infoimation helps you become an eective Lifeiay Poital Ad-
ministiatoi.
Cu~v1rv 1
Auv~Ncru Pov1~i Ovrv~1ioN
ln this chaptei we discuss seveial advanced featuies of Lifeiay Poital, includ-
ing audit tiails and poital maintainence, backup, and logging. Audit tiails allow
poital administiatois to tiack the activities of poital useisthis can be veiy use-
ful foi tioubleshooting oi guiing out whos iesposible foi ceitain actions that
have taken place on youi poital. lts geneially not much moie complicated to
maintain a iunning Lifeiay instance than it is to maintain the application seivei
upon which its iunning. Howevei, Lifeiay piovides tools foi logging, patching,
and upgiading Lifeiay that you should know how to use. lts also impoitant to
follow secuie backup pioceduies to piotect youi Lifeiay instances souice code,
database, and piopeities les.
Well discuss the following topics in this section
Audit tiails
Lifeiay Monitoiing using Google Analytics
Backing Up a Lifeiay lnstallation
Changing Logging Levels
Patching Lifeiay
9
98 CHAPTER 17. ADVANCED PORTAL OPERATION
Upgiading Lifeiay
Lets get staited with audit tiails.
17.1 Audit Trails
EE Only Feature
Youve just nished lunch and aie ieady to get back to woik. You have a
site in Lifeiay you use to manage youi pioject, and befoie you lef, you weie
about to cieate a foldei in youi Documents and Media libiaiy foi shaiing some
iequiiements documentation. Siuing down at youi desk, you navigate to the
iepositoiy and auempt to cieate the foldei.
You do not have permission to perform this action, Lifeiay helpfully tells you.
What? you bluit accidentally in suipiise. Tis is my pioject'
Ah, you too` asks a co-woikei helpfully fiom ovei the cube wall. l lost
access to a wiki l was updating just a few minutes ago. l was about to entei a
suppoit ticket foi it.
loiget the ticket. Lets go see the poital admin now, you say.
And o you go, two oois down, to the fai end of the building wheie, as you
appioach, you can alieady heai stiess in the poital admins voice as he tiies to
ieassuie someone on the phone.
Yes, Mi. Jones. Yes, lll x it. (Jones? e president of the company? goes
thiough youi mind.) lll get on it iight away, Mi. Jones. lt was just a mistake,
lll x it. Tank you, Mi. Jones, and he hangs up the phone.
Pioblems` you ask the poital admin, whose name is Haiiy. He does look
iathei haiiied.
Yeah, Tom, he says. Somebody changed a bunch of peimissions in the
poitalit wasnt me. lm assuming you and Dick aie heie because of the same
pioblem`
Yup, you say. l lost access to a document iepositoiy foldei.
And l lost access to a wiki, Dick says helpfully.
lt was piobably due to some site membeiship change. Lets take a look at
the audit poitlet in the contiol panel and see what happened.
17.1. AUDIT TRAILS 99
When in the couise of human events it becomes necessaiy to see what useis
aie doing on youi poital, youll nd Lifeiay makes this easy. lf youie a Lif-
eiay Enteipiise Edition customei, you have access to two pluginsa hook and a
poitletthat, in combination with some seuings in portal-ext.properties,
enable you to see all the activity that occuis in youi poital. Using this, you can
quickly nd out what changes weie made and by whom. lf youve delegated
peimission gianting to any gioup of people, this is an essential featuie youie
likely to use.
Well come back to Tom, Dick and Haiiys stoiy latei in the chaptei. loi
now, lets look at how to install Lifeiays audit plugins so you can do the same
thing Haiiys about to do.
Installing and conguring the audit plugins
Lifeiays audit functionality is composed of two paits a back-end piece that
hooks into Lifeiay events and a fiont-end piece that gives you an inteiface to
see whats happening. Both of these aie available as EE-only plugins in the
Customei Poital oi Lifeiay Maiketplace, and youll need to install both to get
audit functionality woiking (plugins installation is coveied in chaptei 13).
Once installed, theie aie two piopeities in youi portal-ext.properties
le which you can use to tweak the seuings.
com.liferay.portal.servlet.lters.audit.AuditFilter: By default, this is set to
false, because the audit plugins aient installed by default. When you set it to
true, the audit hook is able to captuie moie infoimation about events, such as
the client host and the clients lP addiess.
audit.message.com.liferay.portal.model.Layout.VIEW: ln the code, pages
aie layouts. Seuing this to true, theiefoie, iecoids audit events foi page views.
lts tuined o by default because this may be too ne-giained foi most installa-
tions.
Once youve decided if youie going to use one oi both of the two seuings
above, place them in youi portal-ext.properties le and iestait youi Lif-
eiay seivei. Once it comes up, audit events aie captuied by Lifeiay, and youll
be able to use them to see whats happening in youi poital.
Using audit events
Now that youie captuiing audit events, its easy to use them to view activities
in youi poital. Navigate to the contiol panel and youll nd a new entiy in the
Portal section labeled Audit Reports (see guie 1.1).
00 CHAPTER 17. ADVANCED PORTAL OPERATION
Figure 17.1: Once the Audit Reports plugins are installed, an entry
appears in the control panel.
Clicking the entiy shows you a list of the events Lifeiay has alieady cap-
tuied (see guie 1.2), along with an inteiface foi seaiching foi events. You can
biowse the list if you want, but its likely youll need to use the seaich to nd
what youie looking foi.
liguie 1.2 shows Stephen Piofessoi logged in and did some things on the
site. To see the detail of any of these events, all you need to do is click one to
see moie infoimation. Youll then see something like guie 1.3.
As you can see, depending on how many useis you have in youi poital, this
list can get populated veiy quickly. loi this ieason, its a good idea to keep the
audit.message.com.liferay.portal.model.Layout.VIEW piopeity set to
false. Tis way, you dont cluuei up youi audit events with multiple page view
events, which will denitely be the most ofen tiiggeied event in youi poital.
Now that you know how to biowse and view audit events, lets look at
seaiching foi specic events.
Viewing audit reports
linding what you want in a big list of events is, to use the expiession, like seaich-
ing foi a needle in a haystack. Tis is why the audit poitlet gives you a iobust
seaiching mechanism. By default, it looks pieuy simple theies only a single
eld foi seaiching. Clicking the advanced link, howevei, ieveals a seaich dialog
bioken out by vaiious elds you can use in youi seaich.
17.1. AUDIT TRAILS 01
Figure 17.2: Liferay captures and stores events as soon as the audit
plugins are installed.
Lets look at the options we have foi seaich.
Mat: You can match all elds youve specied oi any single eld.
User ID: Specify the usei lD youd like to seaich foi. Tis would be the usei
who peifoimed some action in the poital youd like to audit.
User Name: Specify the usei name youd like to seaich foi. Tis is ofen
easiei than seaiching foi a usei lD, especially if you dont have access to the
Lifeiay database to nd the usei lD.
Resource ID: Specify the lD of the iesouice that was modied oi viewed in
this audit iecoid.
Resource Name: Specify the name of the iesouice that was modied oi
viewed in this audit iecoid. loi example, you could seaich foi Usei iesouices
to see if someone modied a useis account.
Resource Action: Specify an action that was peifoimed on the iesouice.
Tis could be any one of the following add, assign, delete, impersonate,
login, login_failure, logout, unassign, oi update.
Session ID: Specify the session lD to seaich foi. Youd use this if you weie
coiielating a session lD fiom youi web seivei logs with activity in Lifeiay.
02 CHAPTER 17. ADVANCED PORTAL OPERATION
Figure 17.3: Clicking an event in the list shows the details of that event.
This event shows it mustve been Stephen Professors rst time logging
into the site, because hes accepting the terms of use.
Client IP: Specify the lP addiess of the client that peifoimed the activity you
wish to audit.
Client Host: Specify the host name of the client that peifoimed the activity
you wish to audit.
Server Name: Specify the seivei name upon which the activity occuiied. lf
youie using a clustei, each membei of the clustei can be individually queiied.
Server Port: Specify the seivei poit upon which the activity occuiied. Youd
need this if you iun a veitical clustei of multiple VMs on the same machine.
Start Date: Specify the low end of the date iange you wish to seaich.
End Date: Specify the high end of the date iange you wish to seaich.
Using this foim, if you wanted to check to see if someone in the poital unas-
signed a usei fiom a paiticulai iole, you might seaich foi a iesouice name of
user and a iesouice action of unassign. Te iesults of such a seaich might look
something like guie 1.4.
Once you have the iesults of youi seaich, you can click on any of the iecoids
ietuined to see the detail page foi that iecoid. liguie 1. shows, in this paitic-
ulai case, the default administiative usei iemoved Stephen Piofessoi fiom the
17.1. AUDIT TRAILS 03
Figure 17.4: Searching audit events is easy with the search formprovided
by the audit portlet. You can quickly drill down to nd the types of events
youre looking for.
iole of Powei Usei.
As you can see, Lifeiays audit poitlets give you a lot of powei to see whats
happening in youi poital. You can use this infoimation to tioubleshoot piob-
lems, deteimine owneiship of paiticulai actions, oi, as Haiiy is about to do, nd
out who made peimission changes they weient supposed to make.
Conclusion of the Story
Okay, says Haiiy, lets ie up Lifeiays audit system and see if we can guie
out what happened.
You and Dick stand behind Haiiys chaii and watch as he enteis a queiy into
a foimon the audit poitlet. Clicking search, the scieen lls up with audit events.
Wow, thats a lot of unassign events. Haiiy says. And look who the culpiit
is, he adds saicastically.
Whos Melvin Dooitiong` Dick asks.
Tats my new intein, Haiiy says. lm gonna kill him. Haiiy pushes out
his chaii and walks down the iow of cubes to the end, wheie a kid no moie than
20 yeais old with disheveled haii sits, eaibuds in his eais.
Hey Melvin, Haiiy says as Melvin tuins aiound to face him. Didnt l ask
you to move that set of useis fiom site membeiship to oiganization membei-
04 CHAPTER 17. ADVANCED PORTAL OPERATION
Figure 17.5: If youve delegated portal administration to multiple users,
you can use the audit plugins to determine who made what change. And,
of course, youll never leave the default administrative user enabled in a
production system, right?
ship`
Yeah, Melvin says, l did that alieady.
Howd you do it`
lt was going to take a while to do it manually, so l wiote a sciipt and exe-
cuted it in the sciipting host, Melvin ieplies, mauei-of-factly.
You did, did you` Well, guess what` Youi sciipt iemoved everybody fiom
all sites.
What?
Yeah, and now youie going to stait adding them back, one by one, manu-
ally, staiting with Mi. Jones.
Tom and Dick back away slowly fiom Melvins cube as Haiiy and Melvin
continue to have theiilets call it a discussion. One thing is cleai theyie hav-
ing a beuei day than Melvin is.
Now that weve seen how you can use audit tiails, lets look at some tools
and best piactices foi maintaining youi Lifeiay installation.
17.2. LIFERAY MONITORING USING GOOGLE ANALYTICS 0
17.2 Liferay monitoring using Google Analytics
Lifeiay includes built-in suppoit foi Google Analytics, allowing administiatois
to make use of Googles tool set foi analyzing site tiac data. When you sign
up foi Google Analytics, a snippet of code is piovided which needs to be added
to youi web pages to allow Googles system to iegistei the page hit. lt can be a
tedious piocess to add this code to eveiy page on a site, especially if its a laige
site and theie is a lot of usei-geneiated content.
Tis pioblemcan be solved in Lifeiay by puuing Googles code into a custom
theme wiiuen specically foi the web site on which the poital is iunning. Doing
this, howevei, iequiies a theme developei to make specic changes to the theme
and it pievents useis fiom using the many themes that aie fieely available foi
Lifeiay out of the box.
Figure 17.6: Setting up Google
Analytics for your site is very easy:
sign up for the IDand then enter it
into this eld.
Because of this, suppoit foi Google
Analytics has been built into Lifeiay,
and can be tuined on thiough a sim-
ple usei inteiface. Tis allows Lif-
eiay administiatois to make use of
Google Analytics on a community by
community basis and tuin it on and
o when needed.
To enable Google Analytics sup-
poit, go to Site Seings in the con-
tiol panel, and then select Analytics
on the iight. Youll see a veiy simple
foim, pictuied below.
Put youi Google Analytics lD
(which should have been piovided to you when you signed up foi the seivice)
in the eld and click Save. All the pages in the community you selected will
now have the Google Analytics code in them and will be tiacked.
Tis is a faiily simple pioceduie, and it gives you the ability to take advan-
tage of some gieat tools to help you visualize whos coming to youi site and
fiom wheie. Next, we discuss some topics geimane to maintaining youi Lifeiay
installation as its used. Lets stait with backup.
17.3 Backing up a Liferay installation
Once you have an installation of Lifeiay Poital iunning, youll want to have
piopei backup pioceduies in place in case of a catastiophic haidwaie failuie
0 CHAPTER 17. ADVANCED PORTAL OPERATION
of some kind. Lifeiay isnt veiy dieient fiom any othei application that may
be iunning on youi application seivei. Neveitheless, theie aie some specic
components you should include in youi backup plan.
Backing up source code
lf you have extended Lifeiay oi have wiiuen any plugins, they should be stoied
in a souice code iepositoiy such as Git, Subveision, oi CVS, unless youie Linus
Toivalds, and then taiballs aie okay too (thats a joke). Youi souice code iepos-
itoiy should be backed up on a iegulai basis to pieseive youi ongoing woik.
Tis piobably goes without saying in youi oiganization, as nobody wants to
lose souice code thats taken months to pioduce, but we thought we should
mention it anyway.
lf youie extending Lifeiay with an Ext plugin, youll want to make suie you
also stoie the veision of the Lifeiay souice on which youi extension enviion-
ment is based. Tis allows youi developeis convenient access to all the tools
they need to build youi extension and deploy it to a seivei.
Lets look at the items that need to be backed up in youi Lifeiay installation.
Backing up Liferays le system
Lifeiays conguiation le, portal-ext.properties, gets stoied in the Lif-
eray Home foldei, which is geneially one foldei up fiom wheie youi application
seivei is installed (see chaptei 14 foi specic details foi youi application seivei).
At a minimum, this le should be backed up, but it is geneially best to back up
youi whole application seivei.
lf youve followed the non-plugin pioceduie (see chaptei 19) to modify youi
Ehcache conguiation, youll have cache conguiation les in the deploy loca-
tion of Lifeiay. Youll need to back up this location. lf youie using the plugin
pioceduie (i.e., the iecommended pioceduie), youi cache conguiation seuings
aie stoied in youi souice code iepositoiy, which is backed up sepaiately.
Lifeiay stoies conguiation les, seaich indexes, and cache infoimation in
a foldei called data in Lifeiay Home. lf youie using the lile System stoie oi
the Advanced lile System stoie, the media iepositoiy is stoied heie (by default)
too. You should always back up the contents of youi Lifeiay Home foldei.
lf youve modied the location wheie the Document Libiaiy stoies les, you
should also back up this location.
Tat about coveis the le system locations Lifeiay uses. Next, lets discuss
how to back up Lifeiays database.
17.4. LIFERAYS LOGGING SYSTEM 0
Backing up Liferays database
Lifeiays database is the cential iepositoiy foi all of the Poitals infoimation and
is the most impoitant component that needs to be backed up. You can do this
by backing up the database live (if youi database allows this) oi by expoiting
the database and then backing up the expoited le. loi example, MySQL ships
with a mysqldump utility which allows you to expoit the entiie database and
data into a laige SQL le. Tis le can then be backed up. ln case of a database
failuie, this le can be used to iecieate the state of the database at the time the
dump was cieated.
lf youie using Lifeiays Documents and Media Libiaiy with the Jackiabbit
JSR-10 iepositoiy to stoie documents in a database, the Jackiabbit database
should be backed up also. lf youve placed youi seaich index into a database
(not iecommended, see chaptei 19 foi infoimation on using Clustei Link oi
Soli), that database should be backed up as well.
Seaich indexes can be backed up as well, if you wish to avoid ieindexing
youi entiie poital afei you do youi iestoie. Tis is easiest to do if you have
a sepaiate Soli enviionment upon which youi index is stoied. lf youie in a
clusteied conguiation and youie ieplicating indexes, youll need to back up
each index ieplica.
Restoiing youi application seivei, youi Lifeiay Home foldei, the locations
of any le system-based media iepositoiies, and youi database fiom a backup
system should give you a functioning poital. Restoiing seaich indexes should
avoid the need to ieindex when you biing youi site back up afei a catastiophic
failuie. Good, consistent backup pioceduies aie key to successfully iecoveiing
fiom a haidwaie failuie.
But what about maintenance while youi seivei is iunning` Lifeiay lets you
view a lot of what is going on thiough its logging system.
17.4 Liferays Logging System
Lifeiay uses Log4j extensively to implement logging foi neaily eveiy class in the
poital. lf you need to debug something specic while the systemis iunning, you
can use the contiol panel to set logging levels by class dynamically.
To view the log levels, go to the contiol panel, click Server Administration in
the Seivei section, and then click the Log Levels tab.
A paginated list of logging categoiies appeais. Tese categoiies coiiespond
to Lifeiay classes that have log messages in them. By default, all categoiies aie
set to display messages only if theie is an eiioi that occuis in the class. Tis is
08 CHAPTER 17. ADVANCED PORTAL OPERATION
why you see ERROR displayed in all of the diop-down list boxes on the iight
side of the poitlet.
Each categoiy is lteied by its place in the class hieiaichy. loi example,
if you wanted to see logging foi a specic class that is iegisteied in Lifeiay,
you would biowse to that specic class and change its log level to something
that is moie desciiptive, such as DEBUG. Once you click the Save buuon at the
bouom of the list, youll stait seeing DEBUG messages fiom that class in youi
application seiveis log le.
lf youie not suie which class you want to see log messages foi, you can
nd a place highei up in the hieiaichy and select the package name instead of
an individual class name. lf you do this, messages foi eveiy class lowei in the
hieiaichy will be displayed in youi application seiveis log le.
Figure 17.7: Log levels can be dynamically changed at runtime, whenever
you need to debug an issue.
Be caieful when you do this. lf you set the log level to DEBUG somewheie
neai the top of the hieiaichy (such as com.liferay, foi example), you may
wind up with a lot of messages in youi log le. Tis could make it dicult
to nd the one you weie looking foi, and causes the seivei to do moie woik
wiiting messages to the log.
lf you want to set the log level foi one of youi own classes in a deployed
plugin, you can iegistei that class with Lifeiay to can contiol the log levels
moie easily, so long as youi class uses Log4J to do its logging.
17.5. PATCHING LIFERAY 09
You will ist need to implement Log4J logging in youi class, with a statement
such as the following (taken fiom Lifeiays JCRStore class)
private static Log _log = LogFactory.getLog(JCRStore.class);
You would then use this _log vaiiable to cieate log messages in youi code
foi the vaiious logging levels
_log.error("Reindexing " + node.getName(), e1);
To enable youi logging messages to appeai in youi seiveis log le via the
contiol panel, click the Add Category tab on the same Log Levels page.
Figure 17.8: Adding your own logging classes is as simple as specifying it in
this eld.
Youll see you can add a logging categoiy. Put in the fully qualied name of
youi class oi of the package that contains the classes whose log messages you
want to view, choose a log level, then click the Save buuon. You will now stait
to see log messages fiom youi own class oi classes in the seiveis log le.
Logs aie gieat foi guiing out issues in pioduction. But what if Lifeiay
contacts you via its suppoit channel with a bug x oi a secuiity enhancement`
Read on to leain how to patch Lifeiay.
17.5 Patching Liferay
While we stiive foi peifection with eveiy ielease of Lifeiay Poital, the ieality of
the human condition dictates that ieleases of the pioduct may not be as peifect
as oiiginally intended. But weve planned foi that. lncluded with eveiy Lifeiay
10 CHAPTER 17. ADVANCED PORTAL OPERATION
EE Only Feature
bundle is a patching tool that can handle the installation of two types of patches
hot xes and x packs.
A hot x is piovided to a customei when a customei contacts Lifeiay about
an issue, and Lifeiays suppoit teamwoiking with the customeideteimines
that the pioblem is indeed an issue with the pioduct that needs to be xed.
Suppoit xes the bug and piovides a hot x to the customei immediately. Tis
is a shoit-teim x that solves the issue foi the customei as quickly as possible.
On a iegulai schedule, these hot xes aie bundled togethei into x packs.
lix packs aie piovided to all of Lifeiays customeis and aie component-based.
Tis means any issues with the content management system will be bundled
togethei sepaiately fiom issues with anothei component, such as the message
boaids. Tis lets you deteimine which patches aie ciitical and which aie not,
based on youi usage. Of couise, if Lifeiay issues a secuiity advisoiy, thats
something youie always going to want to patch.
Now that you know what patching is all about, lets check out the tool.
Installing the patching tool
lf youie using a Lifeiay bundle, congiatulations' Te patching tool is alieady
installed. Youi job isnt done yet, howevei, because Lifeiay might have updated
the patching tool. Always check the Customei Poital to see if the patching tool
has been updated ist. But even if you foiget to check, the patching tool will tell
you if it needs to be updated when you iun it. Alot of planning and foiethought
has gone into the patching system to make it iun as smoothly as possible.
You follow the same pioceduie whethei youie installing oi upgiading the
patching tool. Once youve obtained it fiom the customei poital, unzip it to
the Lifeiay Home foldei. Tis is the foldei wheie youve placed youi por-
tal-ext.properties le and wheie by default the data foldei iesides. Tis
is geneially one foldei up fiom wheie youi application seivei is installed, but
some application seiveis aie dieient. lf you dont know wheie Lifeiay Home
is on youi system, check chaptei 14 to see wheie this foldei is foi youi specic
application seivei.
17.5. PATCHING LIFERAY 11
lf youie upgiading the patching tool, all you need to do is unzip the new
veision on top of the old veision. Note that if youie doing this on LUM (Linux,
Unix, Mac) machines, youll need to make the patching-tool.sh sciipt exe-
cutable.
Afei the patching tool is installed, you need to let it auto-discovei youi
Lifeiay installation. Ten it will deteimine what youi ielease level is and what
youi application seivei enviionment is. Tis is a simple command to iun on
LUM
./patching-tool.sh auto-discovery
oi on Windows
patching-tool auto-discovery
liom heie on, foi bievity well use the LUM veision of the command. Why`
Because Lifeiay is open souice, theies no open souice vaiiant of Windows (Re-
actOS is still in alpha, so it doesnt count), and theiefoie my (RS) unscientic
impiession is that moie people will iun Lifeiay on open souice technology than
not. lf lm wiong, lm wiong, but theie aie still many othei examples of docu-
mentation that defaults to Windows, so we still get to be dieient.
lf youve installed the patching tool in a non-standaid location, youll have to
give this command anothei paiametei to point it to youi Lifeiay installation. loi
example, if youve installed a Lifeiay/Tomcat bundle in /opt/Liferay, youd
issue this command
./patching-tool.sh auto-discovery /opt/Liferay/tomcat-7.0.21
ln all, this is pieuy simple. Now lets see how to use the patching tool to get
youi patches installed.
Installing patches
Te absolute ist thing you must do when installing one oi moie patches is to
shut down youi seivei. On Windows opeiating systems, les that aie in use aie
locked by the OS, and wont be patched. On LUM systems, you can geneially
ieplace les that aie iunning, but of couise that still leaves the old ones loaded in
memoiy. So youi best bet is to shut down the application seivei thats iunning
Lifeiay befoie you install a patch.
Lifeiay distiibutes patches as .zip les, whethei they aie hot xes oi x
packs. When you ieceive one, eithei via a LESA ticket (hot x) oi thiough
downloading a x pack fiom the customei poital, youll need to place it in the
12 CHAPTER 17. ADVANCED PORTAL OPERATION
patches foldei, which is inside the patching tools home foldei. Once youve
done that, its a simple mauei to install it. liist, execute
./patching-tool.sh info
Tis shows you a list of patches youve alieady installed, along with a list of
patches that can be installed, fiom whats in the patches foldei. To install the
available patches, issue the following command
./patching-tool.sh install
Youi patches aie now installed. You can veiify this by using the ./pat-
ching-tool.sh info command, which now shows youi patch in the list of
installed patches. Lets look now at how youd manage youi patches.
Handling hot xes and patches
As stated above, hot xes aie shoit teim xes piovided as quickly as possible
and x packs aie laigei bundles of hot xes piovided to all customeis at iegulai
inteivals. lf you alieady have a hot x installed, and the x pack which contains
that hot x is ieleased, you can iest assuied the patching tool will manage this
foi you. lix packs always supeicede hot xes, so when you install youi x
pack, the hot x that it alieady contains is uninstalled, and the x pack veision
is installed in its place.
Sometimes theie can be a x to a x pack. Tis is also handled automatically.
lf a new veision of a x pack is ieleased, you can use the patching tool to install
it. Te patching tool uninstalls the old x pack and installs the new veision in
its place.
Fix pack dependencies
Some x packs iequiie othei x packs to be installed ist. lf you auempt to
install a x pack that depends on anothei x pack, the patching tool will notify
you of this so you can go to the customei poital and obtain the x pack depen-
dency. Once all the necessaiy x packs aie available in the patches foldei, the
patching tool will install them.
Te patching tool can also iemove patches.
17.5. PATCHING LIFERAY 13
Removing or reverting patches
Have you noticed that the patching tool only seems to have an install com-
mand` Tis is because patches aie managed not by the command, but by what
appeais in the patches foldei. You manage the patches you have installed by
adding oi iemoving patches fiom this foldei. lf you cuiiently have a patch in-
stalled and you dont want it installed, iemove it fiom the patches foldei. Ten
iun the ./patching-tool.sh install command, and the patch is iemoved.
lf you want to iemove all patches youve installed, use the
./patching-tool.sh revert
command. Tis iemoves all patches fiom youi installation.
What weve desciibed so fai is the simplest way to use the patching tool, but
you can also use the patching tool in the most complex, multi-VM, clusteied
enviionments. Tis is done by using pioles.
Using proles with the patching tool
When you ian the auto-discoveiy task afei installing the patching tool, it cie-
ated a default piole that points to the application seivei it discoveied. Tis is
the easiest way to use the patching tool, and is gieat foi smallei, single seivei
installations. But we iealize many Lifeiay installations aie sized accoidingly to
seive millions of pages pei day, and the patching tool has been designed foi
this as well. So if youie iunning a small, medium, oi laige clustei of Lifeiay
machines, you can use the patching tool to manage all of them using pioles.
Te auto-discoveiy task cieates a piopeities le called default.properties.
Tis le contains the detected conguiation foi youi application seivei. But
youie not limited to only one seivei which the tool can detect. You can have it
auto-discovei othei iuntimes, oi you can manually cieate new pioles youiself.
To have the patching tool auto-discovei othei iuntimes, youll need to use a
few moie command line paiameteis
./patching-tool.sh [name of profile] auto-discovery [path/to/runtime]
Tis will iun the same discoveiy piocess, but on a path you choose, and the
piole infoimation will go into a [your profile name].properties le.
Alteinatively, you can manually cieate youi pioles. Using a text editoi,
cieate a [profile name].properties le in the same foldei as the patching
tool sciipt. You can place the following piopeities in the le
14 CHAPTER 17. ADVANCED PORTAL OPERATION
pating.mode: Tis can be binary (the default) oi source, if youie patch-
ing the souice tiee youie woiking with. Lifeiay patches contain both binaiy
and souice patches. lf youi development team is extending Lifeiay, youll want
to piovide the patches you install to youi development team so they can patch
theii souice tiee.
jdk.version: Patches aie compiled foi both JDK and JDK . Specify the one
(eithei jdk5 oi jdk6) youi application seivei is iunning against.
pates.folder: Specify the location wheie youll copy youi patches. By
default, this is ./patches.
war.path: No, no ones angiy. Tis is a piopeity foi which you specify the
location of the Lifeiay installation inside youi application seivei. Alteinatively,
you can specify a .wai le heie, and youll be able to patch a Lifeiay .wai foi
installation to youi application seivei.
global.lib.path: Specify the location wheie .jai les on the global classpath
aie stoied. lf youie not suie, seaich foi youi portal-service.jar le, its
on the global classpath. Tis piopeity is only valid if youi patching.mode is
binary.
source.path: Specify the location of youi Lifeiay souice tiee. Tis piopeity
is only valid if youi patching.mode is source.
You can have as many pioles as you want, and use the same patching tool
to patch all of them. Tis helps to keep all youi installations in sync.
Now that you know how to patch an existing installation of Lifeiay, lets
tuin to how youd upgiade Lifeiay fiom an oldei ielease to the cuiient ielease.
17.6 Upgrading Liferay
Lifeiay upgiades aie faiily stiaightfoiwaid. A consistent set of steps is all you
need to follow to upgiade a standaid Lifeiay installation. Tings do get moie
complicated if youi oiganization has used Ext plugins to customize Lifeiay. lts
possible that APl changes in the newveision will bieak youi existing code. Tis,
howevei, is usually pieuy easy foi youi developeis to x. Poitlet plugins which
use Lifeiay APls should be ieviewed and theii seivices iebuilt against the new
ielease. Teme plugins may iequiie some modications to take advantage of
new featuies, and if theyie using Lifeiay APls, they should be ieviewed. Much
eoit has been made to make upgiades as painless as possible, howevei, this
is not a guaiantee eveiything will woik without modication. Ext plugins aie
the most complicating factoi in an upgiade, so it is impoitant to test as much
as possible.
17.6. UPGRADING LIFERAY 1
As a geneial iule, you can upgiade fiom one majoi ielease to the next majoi
ielease. loi example, you can upgiade diiectly fiom Lifeiay .2.x to .0.x, but
not fiom.2.x to .1.x. lf you need to upgiade ovei seveial majoi ieleases, youll
need to iun the upgiade pioceduie foi each majoi ielease until you ieach the
ielease you want. Tis doesnt mean you need to iun the pioceduie foi eveiy
point ielease oi seivice pack, you only need to iun the pioceduie foi the majoi
ieleases. A good piactice is to use the latest veision of each majoi ielease to
upgiade youi system.
Now that weve gouen the geneial philosophy of upgiading out of the way,
lets outline the pioceduie youll undeigo foi upgiading a Lifeiay .0 installation
to a .1 installation. lf youie iunning a pievious veision of Lifeiay and need to
upgiade to .0 ist, please see the instiuctions in the pievious veision of this
document.
Preparing to Upgrade Liferay Portal 6.0 to Liferay Portal 6.1
Teie aie a few things you should piepaie befoie you actually peifoim the up-
giade. Specically, you need to make suie youve migiated to peimission algo-
iithm , ieviewed youi image galleiy usage, ieviewed new Lifeiay .1 defaults,
and cataloged all the plugins you have installed. Afei youve peifoimed these
thiee tasks, youie ieady to upgiade. Lets look at them one by one.
Migrate to Algorithm6
lf youi Lifeiay installation has existed foi a while, you may be on a dieient
peimission algoiithm than the one thats available in Lifeiay Poital .1. Peimis-
sion algoiithms 1- weie depiecated in Lifeiay Poital .0, and theyve now been
iemoved in .1, which means you must migiate before you upgiade.
lf youie on Lifeiay .2 oi below, you need to upgiade to the latest available
ielease of Lifeiay .0 ist. Please follow the instiuctions in the Liferay Portal
Administrators Guide to do this. We will assume foi the iest of this section that
you have .0 iunning, and that its conguied to use an oldei algoiithm than
algoiithm .
Te ist thing you need to do, if this is not done alieady, is to upgiade
youi installation to algoiithm . lf youve alieady done that, gieat' You can
skip the iest of this paiagiaph. lf not, shut down youi seivei, edit youi por-
tal-ext.properties le, and modify/add the following piopeity so that it
ieads like this
permissions.user.check.algorithm=5
1 CHAPTER 17. ADVANCED PORTAL OPERATION
Restait youi seivei. As Lifeiay staits, it upgiades youi peimissions algo-
iithm to algoiithm . Review youi system to make suie that youi peimissions
conguiation is woiking piopeily (it should be).
Next, log in as an Administiatoi and navigate to the Contiol Panel. Go to
Server Administration and select Data Migration fiom the menu along the top
of the scieen. A section entitled Legacy Permissions Migration appeais at the
bouom of the page.
Figure 17.9: Update your permissions algorithmby clicking the Execute
button.
Algoiithms and do not suppoit adding peimissions at the usei level. lf
you have peimissions set foi individual useis, the conveitei can simulate this foi
you. To do this, it auto-geneiates ioles foi each individual peimission, and then
assigns those ioles to the useis who have individualized peimissions. lf you
have a lot of these, youll likely want to go thiough and clean them up afei the
conveision piocess. To geneiate these ioles, check the Generate Custom Roles
box. lf you do not geneiate the ioles, all custom peimissions set foi individual
useis aie discaided.
Click Execute to conveit all existing useis and ioles to algoiithm. When the
piocess completes, shut down youi seivei. Edit youi portal-ext.properties
le and modify the algoiithmpiopeity to showthat youie nowusing algoiithm

permissions.user.check.algorithm=6
Restait youi seivei. Congiatulations' Youve successfully migiated youi
installation to use the latest, highest peifoiming peimissions algoiithm. Next,
youll need to explicitly set youi lmage Galleiy stoiage option.
Migrate Your Image Gallery Images
Lifeiay .1 intioduces a majoi change to how Lifeiay handles les. No longei
do we have a sepaiate Document Libiaiy and lmage Galleiy, instead, these have
been combined into Documents and Media. lf you weie using Lifeiays lmage
17.6. UPGRADING LIFERAY 1
Galleiy to stoie images, these can be migiated ovei duiing an upgiade, but youll
have to take some extia steps ist.
ln Lifeiay .0, you had thiee ways you could stoie images in the lmage
Galleiy. You could use the DatabaseHook and stoie them as BLOBs in the
database, you could use the DLHook to stoie them in the Document Libiaiy, oi
you could use the FileSystemHook to stoie them in a foldei on youi seiveis
le system. Befoie you upgiade, youll need to set whichevei piopeity you
weie using in youi .0 portal-ext.properties le, because by default, none
of them aie enabled in .1. Seuing one of the piopeities tiiggeis the migiation
duiing the upgiade piocess. Below aie the thiee piopeities, youll need to set
only one of them (the one you weie using).
image.hook.impl=com.liferay.portal.image.DatabaseHook
image.hook.impl=com.liferay.portal.image.DLHook
image.hook.impl=com.liferay.portal.image.FileSystemHook
By default, Lifeiay .0 used the FileSystemHook. lf you nevei customized
this piopeity foi youi installation, youd use the FileSystemHook piopeity
above. lf you customized the piopeity, you should know which one you used,
and it is likely alieady in youi portal-ext.properties le.
Te thiid thing you need to do to piepaie foi youi upgiade is to ieview the
new piopeity defaults.
Reviewthe New6.1 Properties Defaults
Te next thing youll need to look at aie the defaults that have changed fiom .0
to .1. Tese aie pieseived in portal-legacy-6.0.properties in the souice.
Te .0 values aie
users.last.name.required=true
layout.types=portlet,panel,embedded,article,url,link_to_layout
editor.wysiwyg.portal-web.docroot.html.portlet.message_boards.edit_message.bb_code.jsp= \
bbcode
setup.wizard.enabled=false discussion.subscribe.by.default=false
message.boards.subscribe.by.default=false
Te .1 values have changed to
users.last.name.required=false
layout.types=portlet,panel,embedded,url,link_to_layout
editor.wysiwyg.portal-web.docroot.html.portlet.message_boards.edit_message.bb_code.jsp= \
ckeditor_bbcode
setup.wizard.enabled=true discussion.subscribe.by.default=true
message.boards.subscribe.by.default=true
18 CHAPTER 17. ADVANCED PORTAL OPERATION
lf you dont like the defaults, you can change them back in one shot by
adding a system piopeity to youi JVMs staitup. Tis dieis by application
seiveis. ln Tomcat, youd modify setenv.sh/setenv.bat and append the
option -Dexternal-properties=portal-legacy-6.0.properties to the
enviionment vaiiable JAVAOPTS. Te sciipts setenv.sh oi setenv.bat aie
not deliveied with default Tomcat, but do exist in the bundles. lf theyie theie,
Tomcat uses them in the staitup piocess, so its a nice way to sepaiate youi
own seuings fiom Tomcats default shell sciipts. Alteinatively, of couise, you
can oveiiide some oi all of them in youi portal-ext.properties along with
youi othei oveiiides.
lf youie not using Tomcat, check youi application seiveis documentation
to see how to modify iuntime piopeities. Youi nal task is to catalog all the
plugins you have installed, so you can install the newveisions in youi upgiaded
system.
Catalog all the plugins you have installed
linally, you need to take note of any plugins you have installed. Lifeiays plu-
gins aie usually veision-specic, so youll need to obtain new veisions of them
foi the new ielease of Lifeiay. lf you have custom plugins cieated by youi de-
velopment team, theyll need to build, test, and optionally modify them to woik
with the new ielease of Lifeiay. Dont auempt an upgiade without collecting
all the plugins youll need ist.
Once youve upgiaded youi peimissions algoiithm, ieviewed youi piopei-
ties, and collected all the plugins youll need, youie ieady to followthe upgiade
pioceduie. Remembei to back up youi system befoie you begin.
Teie aie two dieient pioceduies to upgiade Lifeiay. Te ist one, up-
giading a Lifeiay bundle, is the most common. Te second pioceduie is foi
upgiading a Lifeiay installation on an application seivei. Well go ovei both.
ln both cases, Lifeiay auto-detects whethei the database iequiies an upgiade
the ist time the new veision is staited. When Lifeiay does this, it upgiades
the database to the foimat iequiied by the new veision. To peifoim this task,
Lifeiay must be accessing the database with an lD that can cieate, diop and
modify tables. Make suie you have gianted these peimissions to the lD befoie
you auempt to upgiade Lifeiay. And, of couise, well iun the iisk of oveily
iepeating ouiselves back up youi database.
Lets look at upgiading a bundle, which is the easiest upgiade path.
17.6. UPGRADING LIFERAY 19
Upgrading a bundle
lf youie iunning a Lifeiay bundle, the best way to do the upgiade is to follow
the steps below. Te new Lifeiay is installed in a newei veision of youi bun-
dle iuntime. loi example, the Lifeiay/Tomcat bundle foi .0 used Tomcat by
default, the .1 bundle uses Tomcat . Tough theie is a Tomcat bundle of
Lifeiay .1, that bundle also uses a newei ielease of Tomcat than the one fiom
.0. Tis is the case foi all iuntimes Lifeiay suppoits. We geneially iecommend
you use the latest veision of youi iuntime bundle, as it will be suppoited the
longest.
1. Obtain the new bundle. Unzip the bundle to an appiopiiate location on youi
system.
2. Copy youi portal-ext.properties le and youi data foldei to the new
bundle.
3. Review youi portal-ext.properties le as desciibed above. Make suie
youie using peimissions algoiithm . lf you weie using the lmage Galleiy,
make the necessaiy modications so youi les aie migiated to Documents
and Media. Review the new defaults and decide whethei you want to use
them. Review any othei modications youve made.
4. Stait youi application seivei. Watch the console as Lifeiay staits it upgiades
the database automatically.
. When the upgiade completes, install any plugins you weie using in youi old
veision of Lifeiay. Make suie you use the veisions of those plugins that aie
designed foi Lifeiay .1. lf you have youi own plugins, youi development
team will need to migiate the code in these ahead of time and piovide .wai
les foi you.
. Biowse aiound in youi new installation and veiify eveiything is woiking.
Have youi QA team test eveiything. lf all looks good, you can delete the
old application seivei with the old ielease of Lifeiay in it fiom the bundle
diiectoiy. You have a backup of it anyway, iight`
As you can see, upgiading a bundle is geneially pieuy simple. But not ev-
eiybody can use bundles sometimes, specic application seiveis oi application
seivei veisions aie mandated by the enviionment youie in oi by management.
loi this ieason, Lifeiay also ships as an installable .wai le that can be used on
any suppoited application seivei.
20 CHAPTER 17. ADVANCED PORTAL OPERATION
Upgrading using a .war le
Running a manual upgiade is almost as easy as upgiading a bundle
1. Veiify youi application seivei is suppoited by Lifeiay. You can do this by
viewing the appiopiiate document on the Customei Poital (EE), in chaptei
14 (because theie aie installation instiuctions foi it), oi on lifeiay.com(CE). lf
youi application seivei isnt suppoited by Lifeiay .1, do not continue! Youll
need to upgiade oi switch to a suppoited application seivei ist.
2. Obtain the Lifeiay Poital .wai le and the dependency .jais aichive.
3. Copy youi customized portal-ext.properties le to a safe place and ie-
view it as desciibed above, making all the appiopiiate changes.
4. Undeploy the old veision of Lifeiay and shut down youi application seivei.
. Copy the new veisions of Lifeiays dependency .jais to a location on youi
seiveis class path, oveiwiiting the ones you alieady have foi the old veision
of Lifeiay. Tis location is documented foi youi application seivei in chaptei
14.
. Deploy the new Lifeiay .wai le to youi application seivei. lollow the de-
ployment instiuctions in chaptei 14.
. Stait (oi, if youi app seivei has a console fiom which youve installed the
.wai, iestait) youi application seivei. Watch the console as Lifeiay staits it
should upgiade the database automatically. Veiify youi poital is opeiating
noimally, and then install any plugins you weie using in youi old veision
of Lifeiay. Make suie you use the veisions of theose plugins designed foi
Lifeiay .1. lf you have youi own plugins, youi development team will need
to migiate the code in these ahead of time and piovide .wai les to you.
8. Biowse aiound in youi new installation and veiify eveiything is woiking.
Have youi QA team test eveiything. lf all looks good, youie nished.
Tats all theie is to it. Most eveiything is handled by Lifeiays upgiade
pioceduie. Note as stated above, if you have to upgiade ovei seveial Lifeiay
veisions, you will need to iepeat these steps foi each majoi ielease.
17.7. SUMMARY 21
17.7 Summary
Lifeiay Poital is an easy enviionment to maintain. Backup pioceduies aie sim-
ple and stiaightfoiwaid. Administiatois have all the options they need to view
and diagnose a iunning Lifeiay Poital seivei thiough its tunable logs.
Patching Lifeiay is easy to do with Lifeiays patching tool. lt handles foi
you all the management of available patches, and makes it easy to install and
uninstall them.
Upgiading Lifeiay is also a snap, because Lifeiay does most of the woik au-
tomatically. With easy migiation tools and automated database upgiade sciipts,
youll have youi new veision of Lifeiay Poital up and iunning in no time.
Cu~v1rv 18
UsiNc Scviv1iNc iov Auv~Ncru
lirxiniii1v
Lifeiay piovides a iobust sciipt engine that can be used to inteipiet sciipts in
Beanshell, Javasciipt, Gioovy, Python and Ruby. Te sciipt engine came out of
Lifeiays involvement with the Romulus pioject (hup//www.ict-iomulus.eu). lt
was oiiginally developed to suppoit non Java-based poitlets, but has now been
extended to handle a lot moie. loi example, when Lifeiays woikow fiame-
woik was intioduced, the sciipt engine was leveiaged to suppoit the execution
of sciipts fiom within a woikow module. A sciipt console is now included in
the Seivei Administiation poitlet in the contiol panel. lt allows system admin-
istiatois an easy way to execute sciipts to peifoim iepetitive usei maintenance
opeiations, bulk manipulations using the Lifeiay APl to ensuie consistency, oi
even system level opeiations.
Tis chaptei helps you to undeistand Lifeiays sciipt engine and coveis the
following topics
Accessing Lifeiays seivice layei fiom a sciipt
Running sciipts fiom the sciipt console
Using the sciipt engine with woikow
22
18.1. ACCESSING LIFERAY SERVICES 23
Leveiaging custom Java tools in the sciipt engine
Te most common thing youll want to do is access Lifeiays seivices. lf you
have any familiaiity with Lifeiays developei tools and APl, this will be a snap
foi you.
18.1 Accessing Liferay Services
ln many cases, youll want to inteiact with one of Lifeiays many seivices. Tis
is possible fiomall of the sciipting languages suppoited, but the syntax is a liule
dieient foi each language.
To illustiate the coiiect syntax foi inteiacting with Lifeiay seivices, lets
look at a simple example that uses the UserLocalService to ietiieve a list of
useis and then piints theii names to the log le. Well initially implement the
example in Java pseudo-code.
import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalServiceUtil;
import java.util.List;
.
.
.
int userCount = UserLocalServiceUtil.getUsersCount();
List<User> users = UserLocalServiceUtil.getUsers(0, userCount);
\index{User}
for (User user:users) {
System.out.println("User Name: " + user.getFullName());
}
.
.
.
Lets see ist how this would woik in Beanshell, which is veiy similai to
Java.
Beanshell
Beanshell is a Java sciipting language thats designed to iun Java code with liule
oi no changes. ln this example, we only have one small change to make because
Beanshell doesnt suppoit the use of Java Geneiics.
24 CHAPTER 18. USING SCRIPTING FOR ADVANCED FLEXIBILITY
import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalServiceUtil;
import java.util.List;
int userCount = UserLocalServiceUtil.getUsersCount();
List users = UserLocalServiceUtil.getUsers(0, userCount);
\index{User}
for (User user:users) {
System.out.println("User Name: " + user.getFullName());
}
Next, well show the same thing in Gioovy, anothei sciipting language de-
signed to be similai to Java.
Groovy
Gioovy is also based on Java and is peihaps a liule easiei than Beanshell be-
cause liteially any code wiiuen in Java also iuns in Gioovy. Tis means we can
execute the exact same code fiom oui Java example without any changes.
import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalServiceUtil;
import java.util.List;
int userCount = UserLocalServiceUtil.getUsersCount();
List<User> users = UserLocalServiceUtil.getUsers(0, userCount);
\index{User}
for (User user:users) {
System.out.println("User Name: " + user.getFullName());
}
Of couise, we could make this somewhat Giooviei by simplyng the pio-
giam as follows
import com.liferay.portal.service.UserLocalServiceUtil
userCount = UserLocalServiceUtil.getUsersCount()
users = UserLocalServiceUtil.getUsers(0, userCount)
for ( user in users){
System.out.println("User Name: " + user.getFullName())
}
Te sciipt engine suppoits moie than just Java-like languages. Despite the
name, you should be awaie that Javasciipt beais liule iesemblance to Java, but
you can still use it in Lifeiays sciipt engine.
18.1. ACCESSING LIFERAY SERVICES 2
Javascript
Lifeiay uses the Rhino Javasciipt Engine to piovide Javasciipt suppoit in the
sciipt engine. Te following code piovides a Javasciipt veision of oui oiiginal
Java piogiam.
userCount = Packages.com.liferay.portal.service.UserLocalServiceUtil.getUsersCount();
users = new Packages.java.util.ArrayList;
users = Packages.com.liferay.portal.service.UserLocalServiceUtil.getUsers(0, userCount);
user = Packages.com.liferay.portal.service.UserLocalServiceUtil.createUser(0);
for (i=0;i<users.size();i++) {
Packages.java.lang.System.out.println(users.get(i).getFullName());
}
You can see the Javasciipt example is compact. Ruby is even moie compact.
Ruby
Ruby is suppoited thiogh the use of JRuby and oui pievious example could be
implemented in Ruby as follows
userCount = com.liferay.portal.service.UserLocalServiceUtil.getUsersCount();
users = com.liferay.portal.service.UserLocalServiceUtil.getUsers(0, userCount);
users.each{ |user| print user.getFullName() + "\n"}
Python useis aient lef out eithei.
Python
Lastly, Lifeiay piovides Python suppoit based on Jython and the pievious ex-
ample could be implemented with the following code.
from com.liferay.portal.service import UserLocalServiceUtil
from com.liferay.portal.model import User
userCount = UserLocalServiceUtil().getUsersCount()
users = UserLocalServiceUtil().getUsers(0,userCount)
\index{User}
for user in users:
print user.getFullName()
As you can see, Lifeiays seivices can be accessed fiom any of these lan-
guages. Lets look at some piactical examples of how youd use this.
2 CHAPTER 18. USING SCRIPTING FOR ADVANCED FLEXIBILITY
18.2 Running scripts fromthe control panel
To see a veiy simple example of the sciipt console in action, log into the poital
as an administiatoi and navigate to the contiol panel Seivei Administiation
Sciipt. Change the sciipt type to Gioovy and modify the cuiient code to
look like the following
number = com.liferay.portal.service.UserLocalServiceUtil.getUsersCount();
out.println(number);
Click the execute buuon and check the console oi the log foi youi output.
Lets implement a moie iealistic example. Well ietiieve some usei infoi-
mation fiom the database, make some changes and then update the database
with oui changes. Oui company has updated the teims of use and iequiies that
eveiyone be piesented with the updated teims of use on the next log in. When
useis agiee to the teims of use, a boolean auiibute called agreedToTermsOf-
Use is set in theii usei iecoids. As long as the boolean is true, Lifeiay will not
piesent the usei with the teims of use. Howevei, if we set this ag to false foi
eveiyone, all useis will have to agiee to it again to use the site.
Well again use Gioovy, so ensuie the sciipt type is set to Gioovy and execute
the following code to check the status of the agreedToTermsOfUse auiibute
import com.liferay.portal.service.UserLocalServiceUtil
userCount = UserLocalServiceUtil.getUsersCount()
users = UserLocalServiceUtil.getUsers(0, userCount)
\index{User}
for (user in users) {
println("User Name: " + user.getFullName() + " -- " + user.getAgreedToTermsOfUse())
}
Now well actually update each usei in the system to set his oi hei agreed-
ToTermsOfUse auiibute to false. Well be suie to skip the default usei as the
default usei is not iequiied to agiee to the Teims of Use. Well also skip the
admin usei thats cuiiently logged in and iunning the sciipt. lf youie logged in
as somoene othei than testlifeiay.com, be suie to update the following sciipt
befoie iunning it.
import com.liferay.portal.service.UserLocalServiceUtil
userCount = UserLocalServiceUtil.getUsersCount()
users = UserLocalServiceUtil.getUsers(0, userCount)
\index{User}
for (user in users){
18.3. LEVERAGING THE SCRIPT ENGINE IN WORKFLOW 2
if(!user.isDefaultUser() &&
!user.getEmailAddress().equalsIgnoreCase("test@liferay.com")) {
user.setAgreedToTermsOfUse(false)
UserLocalServiceUtil.updateUser(user)
\index{User}
}
}
To veiify the sciipt has updated the iecoids, iun the ist sciipt again and you
should see all useis (except the default usei and youi lD) have been updated.
Tats all thats needed to iun sciipts and to access the Lifeiay seivice layei.
Teie aie, howevei, some things to keep in mind when woiking with the sciipt
console
Teie is no undo
Teie is no pieview
When using Local Seivices, no peimissions checking is enfoiced
Sciipts aie executed synchionously, so be caieful with sciipts that might
take a long time to execute.
loi these ieasons, you want to use the sciipt console with caie, and test iun
youi sciipts on non-pioduction systems befoie you iun them on pioduction.
Of couise, the sciipt engine has uses beyond the sciipt console. One of the
main uses of it is in designing woikows.
18.3 Leveraging the Script Engine in Workow
Lifeiays Kaleo woikow engine piovides a iobust system foi ieviewing and
appioving content in an enteipiise enviionment. Just with the standaid featuie
set, it is a poweiful and iobust woikow solution. Adding sciipting featuies
biings it to the next level.
Te default woikow denition included with Kaleo gives you a quick look
into how the featuie woiks. Te nal step in the woikow iuns a sciipt that
makes content available foi use. As you can see in the snippet below, it uses
Javasciipt to access the Java class associated with the woikow to set the status
of the content to approved.
28 CHAPTER 18. USING SCRIPTING FOR ADVANCED FLEXIBILITY
<script>
<![CDATA[
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus
(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("approved"),
workflowContext);]]>
</script>
<script-language>javascript</script-language>
At viitually any point in a woikow, you can use Lifeiays sciipting engine
to access woikow APls oi othei APls outside of woikow. Teie aie a lot
of dieient ways you could use this, but some piactical ones might be geuing
a list of useis with a specic woikow-ielated iole, sending an email to the
designated content appiovei with a list of people to contact if he is unable to
ieview the content, oi cieating an aleit to be displayed in the Aleits poitlet foi
any usei assigned to appiove content.
Of couise, befoie you tiy any of this, you might want to know what the
appiopiiate syntax is foi inseiting a sciipt into the woikow. ln an XML woik-
ow denition, a sciipt can be used in any XML type that can contain an tag
- those types being <state>, <task>, <fork> and <join>. lnside of one of
those types, foimat youi sciipt like so
<actions>
<action>
<script>
<![CDATA[*the contents of your script*]]>
</script>
<script-language>*your scripting language of choice*</script-language>
</action>
...
</actions>
Heies an example of a woikow sciipt cieated in Gioovy. Tis one is de-
signed to be used with a Condition statement in Kaleo. lt accesses Lifeiays
Asset liamewoik to deteimine the categoiy of an asset in the woikow so the
coiiect appioval piocess can be automatically deteimined.
<script>
<![CDATA[
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.portal.kernel.workflow.WorkflowHandler;
import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil;
import com.liferay.portlet.asset.model.AssetCategory;
import com.liferay.portlet.asset.model.AssetEntry;
import com.liferay.portlet.asset.model.AssetRenderer;
import com.liferay.portlet.asset.model.AssetRendererFactory;
import com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil;
import java.util.List;
18.4. CUSTOM JAVA TOOLS IN THE SCRIPT ENGINE 29
String className = (String)workflowContext.get(
WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME);
WorkflowHandler workflowHandler =
WorkflowHandlerRegistryUtil.getWorkflowHandler(className);
AssetRendererFactory assetRendererFactory =
workflowHandler.getAssetRendererFactory();
long classPK =
GetterUtil.getLong((String)workflowContext.get
(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
AssetRenderer assetRenderer =
workflowHandler.getAssetRenderer(classPK);
AssetEntry assetEntry = assetRendererFactory.getAssetEntry(
assetRendererFactory.getClassName(), assetRenderer.getClassPK());
List<AssetCategory> assetCategories = assetEntry.getCategories();
returnValue = "Content Review";
for (AssetCategory assetCategory : assetCategories) {
String categoryName = assetCategory.getName();
if (categoryName.equals("legal")) {
returnValue = "Legal Review";
return;
}
}
]]>
</script>
<script-language>groovy</script-language>
Within a woikow, the next task oi state is chosen based on the what the
method ietuins.
Te combination of Lifeiays sciipting and woikow engines is inciedibly
poweiful, but as it piovides useis with the ability to execute code, it can also be
veiy dangeious. When conguiing youi peimissions, be awaie of the poten-
tial consequences of pooily, oi maliciously, wiiuen sciipts inside of a woikow
denition. loi moie infoimation on cieating denitions with Kaleo Woikow
see Chapter 6: Workow with Kaleo.
18.4 CustomJava Tools in the Script Engine
Teie aie seveial challenges when woiking with the Sciipt Engine, including
debugging and logging. One appioach to oveicome these challenges is to de-
30 CHAPTER 18. USING SCRIPTING FOR ADVANCED FLEXIBILITY
velop custom Java utilities that can be called fiom youi sciipts. Tese utilities
can wiite to a custom log le oi the Lifeiay log le. You can also place bieak-
points in youi utility code and step thiough it using youi favoiite debuggei.
Lifeiays use of Spiing and PortletBeanLocatorUtil makes calling these
Java utilities fiom youi sciipt easy, iegaidless of the sciipting language youie
using.
Lets begin by cieating a Lifeiay Hook pioject. lf youie using Lifeiay lDE
oi Lifeiay Developei Studio, select File New Liferay Project. Name the
pioject script-utils and accept the display name geneiated by the wizaid. Be
suie to select Hook foi the Plugin Type and then select Finish.
Youie using a Lifeiay Hook Plugin to deploy youi utility, but youie not
using any of the typical hook featuies. You just need a way to make youi code
available to the poital and the Hook Plugin is the least obtiusive way to do
this. Tis means you dont need to add anything to the liferay-hook.xml
le. lnstead, youll begin by adding youi utility code.
Youll be following the Dependency lnjection design pauein so begin by cie-
ating the inteiface. Right click on the docroot/WEB-INF/src foldei and select
New Interface. Youll cieate youi inteiface in the com.liferay.sample
package. Name it ScriptUtil.
Next, add two methods to the inteiface.
package com.liferay.samples;
public interface ScriptUtil {
public String operationOne();
public String operationTwo(String name);
}
Next, cieate the implementation class. Right click on the docroot/WEB-
INF/src foldei and select New Class. Cieate the inteiface in the com.life-
ray.sample package and name it ScriptUtilImpl. Be suie to select com.-
liferay.sample.ScriptUtil as the lnteiface.
Next, add implementations foi the two methods.
package com.liferay.samples;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
public class ScriptUtilImpl implements ScriptUtil {
18.4. CUSTOM JAVA TOOLS IN THE SCRIPT ENGINE 31
Figure 18.1: Creating a newutilities project is easy if you use Liferay IDE
or Liferay Developer Studio.
@Override
public String operationOne() {
return "Hello out there!";
}
@Override
public String operationTwo(String name) {
_log.debug("Inside of Operation Two");
return "Hello " + name + "!";
}
32 CHAPTER 18. USING SCRIPTING FOR ADVANCED FLEXIBILITY
Figure 18.2: Create a newJava Interface which youll later implement.
private static Log _log = LogFactoryUtil.getLog(ScriptUtilImpl.class);
}
Lifeiay makes extensive use of the Spiing liamewoik and youll be using it
heie to inject youi implementation class into the application. Spiing needs a
bean denition which youll declaie in an XML le named applicationCon-
text.xml. Cieate this le in the docroot/WEB-INF/ diiectoiy and add the
following code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="com.liferay.sample.ScriptUtil" class="com.liferay.sample.ScriptUtilImpl" />
</beans>
Upon deployment, youll need the poital to cieate a BeanLocator foi youi
plugin. Te BeanLocator ieads the bean denitions you piovided.
18.4. CUSTOM JAVA TOOLS IN THE SCRIPT ENGINE 33
Figure 18.3: Create a newJava Class that implements the interface you
created earlier.
lf youie adding youi utility to a Seivice Buildei enabled plugin, then youll
alieady have a BeanLocator and you can skip this step. Since this Hook plugin
is not alieady using Seivice Buildei, youll need to dene a context loadei lis-
tenei in oui Hook to piovide a BeanLocator. Open the docroot/WEB-INF/-
web.xml le and ieplace its contents with the following code
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
34 CHAPTER 18. USING SCRIPTING FOR ADVANCED FLEXIBILITY
<listener-class>
com.liferay.portal.kernel.spring.context.PortletContextLoaderListener
</listener-class>
</listener>
</web-app>
Save all of the changes youve made and deploy the hook. Once the hook has
been deployed successfully, the ScriptUtil can be used in youi sciipt engine
code.
To see the ScriptUtil code in action, navigate back to the control panel
Server Administration Script. Change the sciipt type to Gioovy and entei the
following sciipt
myUtil =
com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate("script-utils-hook",
"com.liferay.samples.ScriptUtil")
println(myUtil.operationOne())
println(myUtil.operationTwo("Joe Bloggs"))
You should see the iesults of youi sciipt displayed iight undei the sciipt.
18.5 Summary
ln this chaptei we saw how Lifeiays sciipt engine opens up many exciting
posibilities foi woiking with Lifeiay iegaidless of youi language of choice. We
leained how you can leveiage Lifeiays Seivices Oiiented Aichitectuie (SOA)
fiom any of the populai sciipting languages Lifeiay suppoits. We then saw
how those sciipts could be used to simplify administiative tasks by leveiaging
the Administiatoi Sciipt Console. Next, we discoveied how you could enhance
woikow by using the powei of sciipts. Lastly, we saw how you could ovei-
come some of the limitations of iunning sciipts in Lifeiay by cieating custom
Java utilities that could be executed fiom within youi sciipts.
As you can see, Lifeiays sciipt engine opens up many exciting posibilities
foi woiking with Lifeiay iegaidless of youi language of choice.
Cu~v1rv 19
CoNiicUviNc Liirv~v iov Hicu
Av~ii~niii1v
Lifeiay Poital is a iobust, enteipiise-ieady poital solution. As such, it is fully
ieady to suppoit mission-ciitical, enteipiise applications in an enviionment
conguied foi multiple iedundancies and 24/ uptimes. Te pioduct, howevei,
like othei pioducts of its kind, doesnt come conguied this way out of the box,
so theie aie some steps that need to be taken to tune it foi youi needs.
Tis chaptei coveis these topics in detail. Lifeiay iuns on so many dieient
Java EE application seiveis that we cant covei all the dieiences between them.
loi this ieason, well discuss Lifeiay conguiations only. loi example, well
look at how to conguie Lifeiay to woik in a clusteied enviionment, but not
how to cieate the clustei in youi application seivei. Te documentation foi
youi paiticulai application seivei is always a much beuei place to leain those
kinds of things.
Tis chaptei explains how to conguie Lifeiay foi a numbei of advanced
scenaiios, such as
Clusteiing
Distiibuted Caching
3
3 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
Deploying Customized veisions of Lifeiay
Peifoimance Testing and Tuning
Duiing this discussion, well mention a numbei of othei open souice piod-
ucts upon which Lifeiay ielies foi much of this functionality. Tese pioducts all
have theii own documentation which should be consulted foi a fullei view of
what these pioducts can do. loi example, Lifeiay uses Ehcache foi its caching
mechanism. Well covei how to conguie Ehcache to enable caches in Lifeiay,
but will iefei you to that pioducts documentation foi fuithei infoimation about
that pioduct.
Sometimes Lifeiay suppoits multiple pioducts which peifoimthe same func-
tion. Teie aie, foi example, seveial single sign-on implementations you can use
with Lifeiay. Well leave it up to you to select which pioduct best ts the needs
of youi pioject without iecommending one pioduct ovei anothei.
With all of that said, lets get staited conguiing Lifeiay foi the enteipiise.
19.1 Liferay Clustering
Lifeiay Poital is designed to seive eveiything fiom the smallest to the laigest
web sites. Out of the box, its conguied optimally foi a single seivei enviion-
ment. lf one seivei isnt sucient to seive the high tiac needs of youi site,
Lifeiay scales to the size you need.
Lifeiay woiks well in clusteis of multiple machines (hoiizontal clustei) oi in
clusteis of multiple VMs on a single machine (veitical clustei), oi any mixtuie
of the two. Once you have Lifeiay installed in moie than one application seivei
node, theie aie seveial optimizations that need to be made. At a minimum,
Lifeiay should be conguied in the following way foi a clusteied enviionment
All nodes should be pointing to the same Lifeiay database oi database
clustei.
Documents and Media iepositoiies should be accessible to all nodes of
the clustei.
Seaich should be conguied foi ieplication oi should use a sepaiate seaich
seivei.
Te cache should be ieplicating acioss all nodes of the clustei.
Hot deploy foldeis should be conguied foi each node if youie not using
seivei faims.
19.1. LIFERAY CLUSTERING 3
Figure 19.1: Liferay is designed to scale to as large an installation as you
need.
lf you havent conguied youi application seivei to use faims foi deploy-
ment, the hot deploy foldei should be a sepaiate foldei foi all the nodes, and
plugins will have to be deployed to all of the nodes individually. Tis can be
done via a sciipt. lf you do have faims conguied, you can deploy noimally
to any nodes deploy foldei, and youi faim conguiation should take caie of
syncing the deployment to all nodes.
Many of these conguiation changes can be made by adding oi modify-
ing piopeities in youi portal-ext.properties le. Remembei that this le
oveiiides the defaults in the portal.properties le. Te oiiginal veision of
this le can be found in the Lifeiay souice code oi can be extiacted fiom the
portal-impl.jar le in youi Lifeiay installation. lt is a best piactice to copy
38 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
the ielevant section you want to modify fiom portal.properties into youi
portal-ext.properties le, and then modify the values theie.

Note: Tis chaptei documents a Lifeiay-specic clustei con-


guiation, without geuing into specic implementations of thiid
paity sofwaie, such as Java EE application seiveis, HTTP
seiveis, and load balanceis. Please consult youi documentation
foi those components of youi clustei foi specic details of those
components. Befoie conguiing Lifeiay in a clustei conguia-
tion, make suie youi OS is not dening the hostname of youi box
to the local netwoik at 12.0.0.1.
Well take each of the points above one by one to piesent a cleai pictuie of
how to clustei Lifeiay.
All nodes should be pointing to the same Liferay database
Tis is pieuy self-explanatoiy. Each node should be conguied with a data
souice that points to one Lifeiay database (oi a database clustei) that all the
nodes will shaie. Tis ensuies all the nodes opeiate fiom the same basic data
set. Tis means, of couise, Lifeiay cannot (and should not) use the embedded
HSQL database that is shipped with the bundles (but you alieady knew that,
iight`). And, of couise, it goes without saying the database seivei is a sepaiate
physical box fiom the seivei which is iunning Lifeiay.
Beyond a database clustei, theie aie two moie advanced options you can use
to optimize youi database conguiation a iead-wiitei database conguiation,
and shaiding.
Read-Writer database conguration
Lifeiay allows you to use two dieient data souices foi ieading and wiiting.
Tis enables you to split youi database infiastiuctuie into two sets one that
is optimized foi ieading and one that is optimized foi wiiting. Since all majoi
databases suppoit ieplication in one foim oi anothei, you can then use youi
database vendois ieplication mechanism to keep the databases in sync in a
much fastei mannei than if you had a single data souice which handled eveiy-
thing.
Enabling a iead-wiitei database is simple. ln youi portal-ext.properties
le, conguie two dieient data souices foi Lifeiay to use, one foi ieading, and
one foi wiiting
19.1. LIFERAY CLUSTERING 39
jdbc.read.driverClassName=com.mysql.jdbc.Driver
jdbc.read.url=jdbc:mysql://dbread.com/lportal?useUnicode=true&characterEncoding=UTF-8 \
&useFastDateParsing=false
jdbc.read.username=**your user name**
jdbc.read.password=**your password**
jdbc.write.driverClassName=com.mysql.jdbc.Driver
jdbc.write.url=jdbc:mysql://dbwrite.com/lportal?useUnicode=true&characterEncoding=UTF-8 \
&useFastDateParsing=false
jdbc.write.username=**your user name**
jdbc.write.password=**your password**
Of couise, specify the usei name and passwoid to youi database in the above
conguiation.
Afei this, enable the iead-wiitei database conguiation by uncommenting
the Spiing conguiation le which enables it in youi spring.configs piop-
eity (line to uncomment is in bold)
spring.configs=\
META-INF/base-spring.xml,\
META-INF/hibernate-spring.xml,\
META-INF/infrastructure-spring.xml,\
META-INF/management-spring.xml,\
META-INF/util-spring.xml,\
META-INF/editor-spring.xml,\
META-INF/jcr-spring.xml,\
META-INF/messaging-spring.xml,\
META-INF/scheduler-spring.xml,\
META-INF/search-spring.xml,\
META-INF/counter-spring.xml,\
META-INF/document-library-spring.xml,\
META-INF/lock-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/portal-spring.xml,\
META-INF/portlet-container-spring.xml,\
META-INF/wsrp-spring.xml,\
META-INF/mirage-spring.xml,\
**META-INF/dynamic-data-source-spring.xml,\**
#META-INF/shard-data-source-spring.xml,\
META-INF/ext-spring.xml
Te next time you iestait Lifeiay, it will now use the two data souices you
have dened. Be suie you have coiiectly set up youi two databases foi ieplica-
tion befoie staiting Lifeiay.
Next, well look at database shaiding.
Database Sharding
Lifeiay staiting with veision .2.3 suppoits database shaiding foi dieient poi-
tal instances. Shaiding is a teim used to desciibe an extiemely high scalabil-
ity conguiation foi systems with massive amounts of useis. ln diagiams, a
40 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
database is noimally pictuied as a cylindei. lnstead, pictuie it as a glass boule
full of data. Now take that boule and smash it onto a conciete sidewalk. Teie
will be shaids of glass eveiywheie. lf that boule weie a database, each shaid
now is a database, with a subset of the data in each shaid.
Tis allows you to split up youi database by vaiious types of data that might
be in it. loi example, some implementations of shaiding a database split up
the useis those with last names beginning with A to D go in one database, E
to l go in anothei, etc. When useis log in, they aie diiected to the instance of
the application that is connected to the database that coiiesponds to theii last
names. ln this mannei, piocessing is split up evenly, and the amount of data the
application needs to soit thiough is ieduced.
By default, Lifeiay allows you to suppoit shaiding thiough dieient poital
instances, using the round robin shard selector. Tis is a class which seives as the
default algoiithm foi shaiding in Lifeiay. Using this algoiithm, Lifeiay selects
fiom seveial dieient poital instances and evenly distiibutes the data acioss
them. Alteinatively, you can use the manual shaid selectoi. ln this case, youd
need to use the Ul piovided in the contiol panel to conguie youi shaids.
Of couise, if you wish to have youi developeis implement youi own shaiding
algoiithm, you can do that. Tis is a gieat use of the Ext plugin. You can select
which algoiithm is active via the portal-ext.properties le
shard.selector=com.liferay.portal.dao.shard.RoundRobinShardSelector
#shard.selector=com.liferay.portal.dao.shard.ManualShardSelector
#shard.selector=[your implementation here]
Enabling shaiding is easy. Youll need to make suie you aie using Lifeiays
data souice implementation instead of youi application seiveis. Set youi vaii-
ous database shaids in youi portal-ext.properties le this way
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8 \
&useFastDateParsing=false
jdbc.default.username=
jdbc.default.password=
jdbc.one.driverClassName=com.mysql.jdbc.Driver
jdbc.one.url=jdbc:mysql://localhost/lportal1?useUnicode=true&characterEncoding=UTF-8
&useFastDateParsing=false
jdbc.one.username=
jdbc.one.password=
jdbc.two.driverClassName=com.mysql.jdbc.Driver
jdbc.two.url=jdbc:mysql://localhost/lportal2?useUnicode=true&characterEncoding=UTF-8 \
&useFastDateParsing=false
jdbc.two.username=
jdbc.two.password=
shard.available.names=default,one,two
19.1. LIFERAY CLUSTERING 41
Once you do this, you can set up youi DNS so seveial domain names point
to youi Lifeiay installation (e.g., abc1.com, abc2.com, abc3.com). Next, go to
the contiol panel and click Portal Instances in the Seivei categoiy. Cieate two
to thiee instances bound to the DNS names you have conguied.
lf youie using the RoundRobinShardSelector class, Lifeiay automatically
enteis data into each instance one by one. lf youie using the ManualShard-
Selector class, youll have to specify a shaid foi each instance using the Ul.
Figure 19.2: When creating a shard using the manual shard selector,
specify the shard you want to use for that instance.
Te last thing you need to do is modify the spring.configs section of youi
portal-ext.properties le to enable the shaiding conguiation, which by
default is commented out. To do this, youi spring.configs should look like
this (modied section is in bold)
spring.configs=\
META-INF/base-spring.xml,\
\
META-INF/hibernate-spring.xml,\
META-INF/infrastructure-spring.xml,\
META-INF/management-spring.xml,\
\
META-INF/util-spring.xml,\
\
META-INF/jpa-spring.xml,\
42 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
\
META-INF/executor-spring.xml,\
\
META-INF/audit-spring.xml,\
META-INF/cluster-spring.xml,\
META-INF/editor-spring.xml,\
META-INF/jcr-spring.xml,\
META-INF/ldap-spring.xml,\
META-INF/messaging-core-spring.xml,\
META-INF/messaging-misc-spring.xml,\
META-INF/mobile-device-spring.xml,\
META-INF/notifications-spring.xml,\
META-INF/poller-spring.xml,\
META-INF/rules-spring.xml,\
META-INF/scheduler-spring.xml,\
META-INF/scripting-spring.xml,\
META-INF/search-spring.xml,\
META-INF/workflow-spring.xml,\
\
META-INF/counter-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/portal-spring.xml,\
META-INF/portlet-container-spring.xml,\
META-INF/staging-spring.xml,\
META-INF/virtual-layouts-spring.xml,\
\
#META-INF/dynamic-data-source-spring.xml,\
*META-INF/shard-data-source-spring.xml,\*
#META-INF/memcached-spring.xml,\
#META-INF/monitoring-spring.xml,\
\
classpath*:META-INF/ext-spring.xml
Tats all theie is to it. Youi system is now set up foi shaiding. Now that
youve got youi database set up and optimized foi a laige installation, lets tuin
to clusteiing the Documents and Media Libiaiy.
Documents and Media Library clustering
Lifeiay .1 intioduces a new Documents and Media Libiaiy which is capable
of mounting seveial iepositoiies at a time and piesenting a unied inteiface
to the usei. By default, useis can make use of the Lifeiay iepositoiy, which
is alieady mounted. Tis iepositoiy is built into Lifeiay Poital and can use as
its back-end one of seveial dieient stoie implementations. ln addition to this,
many dieient kinds of thiid paity iepositoiies can be mounted. lf you have a
sepaiate iepositoiy youve mounted, all nodes of the clustei will point to this
iepositoiy. Youi avenue foi impioving peifoimance at that point is to clustei
youi thiid paity iepositoiy, using the documentation foi the iepositoiy you
19.1. LIFERAY CLUSTERING 43
have chosen. lf you dont have a thiid paity iepositoiy, theie aie ways you can
conguie the Lifeiay iepositoiy to peifoim well in a clusteied conguiation.
Te main thing to keep in mind is you need to make suie eveiy node of the
clustei has the same access to the le stoie as eveiy othei node. loi this ieason,
youll need to take a look at youi stoie conguiation.
Teie aie seveial options available foi conguiing howLifeiays Documents
and Media libiaiy stoies les. Each option is a store which can be conguied
thiough the portal-ext.properties le by seuing the dl.store.impl=
piopeity. Lets considei the iamications of the vaiious stoie options.
Using the File Systemstore
Tis is the default stoie. lts a simple le stoiage implementation that uses a local
foldei to stoie les. You can use the le systemfoi youi clusteied conguiation,
but youd have to make suie the foldei to which you point the stoie can handle
things like concuiient iequests and le locking. loi this ieason, you need to
use a Stoiage Aiea Netwoik oi a clusteied le system.
Te le system stoie was the ist stoie cieated foi Lifeiay and is heavily
bound to the Lifeiay database. By default, documents aie stoied in a docu-
ment_library subfoldei of the data foldei in a Lifeiay bundle. Of couise, you
can change this path to anything you want by using the dl.store.file.sys-
tem.root.dir= piopeity.
Figure 19.3: Liferays
le systemstore
creates a folder
structure based on
primary keys in
Liferays database.
Tis stoie cieates a foldei stiuctuie based on pii-
maiy keys in the Lifeiay database. lf, foi example,
you upload a piesentation with the le name work-
flow.odp into a foldei called stu, the le system
stoie cieates a foldei stiuctuie which looks like g-
uie 19.3.
Te ist foldei is the company lD to which the
site belongs. Te second foldei is the gioup lD of the
site wheie the document iesides. Te thiid is the lD
of the document itself, and nally the le name of the
document is ienamed to a veision numbei foi stoiing
multiple veisions of the document.
As you can see, this binds youi documents veiy
closely to Lifeiay, and may not be exactly what you
want. But if youve been using the default seuings foi
a while and need to migiate youi documents, Lifeiay
piovides a migiation utility in the contiol panel in
44 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
Server Administration Data Migration. Using this utility, you can move youi
documents veiy easily fiom one stoie implementation to anothei.
Speaking of othei stoie implementations, lets look at some otheis Lifeiay
piovides.
Using the Advanced File Systemstore
Lifeiays advanced le system stoie is similai to the default le system stoie.
Like that stoie, it saves les to the local le systemwhich, of couise, could be
a iemote le system mount. lt uses a slightly dieient foldei stiuctuie to stoie
les, which is pictuied below.
Figure 19.4: The
advanced le system
store creates a more
nested folder
structure than the le
systemstore.
So what makes the advanced le system stoie ad-
vanced` Seveial opeiating systems have limitations
on the numbei of les which can be stoied in a pai-
ticulai foldei. Te advanced le system stoie ovei-
comes this limitation by piogiammatically cieating
a stiuctuie that can expand to millions of les, by al-
phabetically nesting the les in foldeis. Tis not only
allows foi moie les to be stoied, but also impioves
peifoimance as theie aie less les stoied pei foldei.
Te same iules apply to the advanced le system
stoie as apply to the default le system stoie. To
clustei this, youll need to point the stoie to a net-
woik mounted le system that all the nodes can ac-
cess, and that netwoiked le systemneeds to suppoit
concuiient iequests and le locking. Otheiwise, you
may expeiience data coiiuption issues if two useis
auempt fiom two dieient nodes to wiite to the same le at the same time.
You may decide the advanced le system stoie foi whatevei ieason doesnt
seive youi needs. lf this is the case, you can of couise mount othei le systems
into the documents and media libiaiy. ln addition to this, you can also iedene
the Lifeiay stoie to use one of thiee othei suppoited piotocols. Well look at
these next.
Using the CMIS store
Tough you can mount as many dieient CMlS (Content Management lnteiop-
eiability Seivices) iepositoiies as you like in the documents and media libiaiy,
you may wish also to iedene the Lifeiay iepositoiy to point to a CMlS ieposi-
toiy as well. Why` Because, as you know, useis aie useis, and its possible they
19.1. LIFERAY CLUSTERING 4
may nd a way to cieate a foldei oi upload content to the Lifeiay iepositoiy.
lt would be nice if that Lifeiay iepositoiy was connected to a clusteied CMlS
iepositoiy by the administiatoi without having to mount it thiough the Ul. Te
CMlS stoie allows you to do just that.
lf you wish to use the CMlS stoie, all you need to do is set the following foui
diiectives in youi portal-ext.properties le
dl.store.cmis.credentials.username=yourusername
dl.store.cmis.credentials.password=yourpassword
dl.store.cmis.repository.url=http://localhost:8080/url/to/your/cmis/repository
dl.store.cmis.system.root.dir=Liferay Home
Nowthe Lifeiay iepositoiy is connected to CMlS via the CMlS stoie. As long
as all nodes aie pointing to youi CMlS iepositoiy, eveiything in youi Lifeiay
clustei should be ne, as the CMlS piotocol pievents multiple simultaneous le
access fiom causing data coiiuption.
liom heie, well move on to the JCR stoie.
Using the JCR store
Lifeiay Poital suppoits as a stoie the Java Content Repositoiy standaid. Un-
dei the hood, Lifeiay uses Jackiabbit-which is a pioject fiom Apache-as its
JSR-10 compliant document iepositoiy. By default, Jackiabbit is conguied to
stoie the documents on the local le system upon which Lifeiay is installed,
in the [Liferay Home]/liferay/jackrabbit foldei. lnside this foldei is
Jackiabbits conguiation le, called repository.xml.
Using the default seuings, the JCR stoie is not veiy dieient fiom the le
system stoies, except you can use any JCR client to access the les. You can,
howevei, modify Jackiabbits conguiation so it stoies les in a database that
can be accessed by all nodes, and so that it opeiates as a clustei within Lifeiays
clustei.
To move the default iepositoiy location to a shaied foldei, you do not need
to edit Jackiabbits conguiation le. lnstead, nd the section in portal.pro-
perties labeled JCR and copy/paste that section into youi portal-ext.pro-
perties le. One of the piopeities, by default, is the following
jcr.jackrabbit.repository.root=${liferay.home}/data/jackrabbit
Change this piopeity to point to a shaied foldei that all the nodes can see. A
new Jackiabbit conguiation le is then geneiated in that location, and youll
have to edit that le to modify Jackiabbits conguiation.
4 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
Note that because of le locking issues, this isnt the best way to shaie
Jackiabbit iesouices, unless youie using a netwoiked le system that can han-
dle concuiiency and le locking. lf you have two people logged in at the same
time uploading content, you could encountei data coiiuption using this method,
and because of this, we dont iecommend it foi a pioduction system. lnstead, if
you want to use the Java Content Repositoiy in a clustei, you should iediiect
Jackiabbit into youi database of choice. You can use the Lifeiay database oi an-
othei database foi this puipose. Tis iequiies editing Jackiabbits conguiation
le.
Te default Jackiabbit conguiation le has sections commented out foi
moving the Jackiabbit conguiation into the database. Tis has been done to
make it as easy as possible to enable this conguiation. To move the Jackiabbit
conguiation into the database, simply comment out the sections ielating to
the le system and comment in the sections ielating to the database. Tese by
default aie conguied foi a MySQL database. lf you aie using anothei database,
you will likely need to modify the conguiation, as theie aie changes to the con-
guiation le that aie necessaiy foi specic databases. loi example, the default
conguiation uses Jackiabbits DbFileSystem class to mimic a le system in
the database. While this woiks well in MySQL, it doesnt woik foi all databases.
loi example, if youie using an Oiacle database, youll need to modify this to
use OracleFileSystem.
Modify the JDBC database URLs so they point to youi database. Tis, of
couise, must be done on all nodes of the clustei. Dont foiget to cieate the
database ist, and giant the usei lD you aie specifying in the conguiation le
access to cieate, modify, and diop tables. Afei this, be suie to uncomment the
<Cluster/> section at the bouom of the le. loi fuithei infoimation, its best
to check out the Jackiabbit documentation. Please see the Jackiabbit documen-
tation at http://jackrabbit.apache.org foi fuithei infoimation.
Once youve conguied Jackiabbit to stoie its iepositoiy in a database, the
next time you biing up Lifeiay, the necessaiy database tables aie cieated auto-
matically. Jackiabbit, howevei, does not cieate indexes on these tables, and so
ovei time this can be a peifoimance penalty. To x this, youll need to manually
go into youi database and index the piimaiy key columns foi all the Jackiabbit
tables.
Note that this conguiation doesnt peifoim as well as the advanced le
system stoie, because youie stoiing documents in a database instead of in the
le system. But it does have the benet of clusteiing well. Next, well look at
Amazons S3 stoie.
19.1. LIFERAY CLUSTERING 4
Using Amazon Simple Storage Service Amazons simple stoiage seivice (S3)
is a cloud-based stoiage solution which you can use with Lifeiay. All you need
is an account, and you can stoie youi documents to the cloud fiom all nodes,
seamlessly.
Tis is easy to set up. When you sign up foi the seivice, Amazon assigns you
some unique keys which link you to youi account. ln Amazons inteiface, you
can cieate buckets of data optimized by iegion. Once youve cieated these to
youi specications, all you need to do is declaie themin portal-ext.proper-
ties
dl.store.s3.access.key=
dl.store.s3.secret.key=
dl.store.s3.bucket.name=
Once you have these conguied, set youi stoie implementation to the S3-
Store
dl.store.impl=com.liferay.portlet.documentlibrary.store.S3Store
Consult the Amazon Simple Stoiage documentation foi additional details on
using Amazons seivice.
We have one moie stoie to go ovei the Documentum stoie.
EE Only Feature
Using the Documentum store lf you have a Lifeiay Poital EE license, you
have access to the Documentum hook which adds suppoit foi Documentum to
Lifeiays Documents and Media libiaiy. lnstall this hook by using the Lifeiay
Maiketplace.
Tis hook doesnt add an option to make the Lifeiay iepositoiy into a Docu-
mentum iepositoiy, as the othei stoie implementations do. lnstead, it gives you
the ability to mount Documentum iepositoiies via the Documents and Media
libiaiy Ul.
Teies not ieally a lot to this, its inciedibly easy. Click Add Repository,
and in the foim that appeais, choose Documentum as the iepositoiy type. Afei
that, give it a name and specify the Documentum iepositoiy and cabinet, and
48 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
Lifeiay mounts the iepositoiy foi you. Tats ieally all theie is to it. lf all youi
nodes aie pointing to a Documentum iepositoiy, you can clustei Documentum
to achieve highei peifoimance.
Now that weve coveied the available ways you can conguie documents
and media foi clusteiing, we can move on to conguiing seaich.
Clustering search
You can conguie seaich foi clusteiing in one of two ways use pluggable en-
teipiise seaich (iecommended), oi conguie Lucene so indexes ieplicate acioss
the individual le systems of the nodes in the clustei. Well look at both ways
to do this.
Using Pluggable Enterprise Search
As an alteinative to using Lucene, Lifeiay suppoits pluggable seaich engines.
Te ist implementation of this uses the open souice seaich engine Solr, but
in the futuie theie will be many such plugins foi youi seaich engine of choice.
Tis allows you to use a completely sepaiate pioduct foi seaich, and this piod-
uct can be installed on anothei application seivei oi clustei of seiveis. Youi
seaich engine then opeiates completely independently of youi Lifeiay Poital
nodes in a clusteied enviionment, acting as a seaich seivice foi all the nodes
simultaneously.
Tis makes it much easiei to deal with seaich indexes. You no longei have to
maintain indexes on eveiy node in youi clustei, and you get to ooad indexing
activity to a sepaiate seivei, so youi nodes can concentiate theii CPU powei on
seiving pages. Each Lifeiay node sends iequests to the seaich engine to update
the seaich index when needed, and these updates aie then queued and handled
automatically by the seaich engine, independently. lts kind of like having an
aimy of iobots ieady and willing to do youi bidding.
liist, youll need to conguie youi Soli seivei, and then you need to install
Lifeiays Soli plugin to iediiect seaiches ovei to it.
Conguring the Solr Sear Server Since Soli is a standalone seaich engine,
youll need to download it and install it ist accoiding to the instiuctions on
the Soli web site (http://lucene.apache.org/solr). Of couise, its best to
use a seivei that is sepaiate fiom youi Lifeiay installation, as youi Soli seivei
becomes iesponsible foi all indexing and seaiching foi youi entiie clustei. You
denitely dont want both Soli and Lifeiay on the same box. Soli is distiibuted
19.1. LIFERAY CLUSTERING 49
as a .war le with seveial .jar les which need to be available on youi ap-
plication seiveis classpath. Once you have Soli up and iunning, integiating it
with Lifeiay is easy, but it iequiies a iestait of youi application seivei.
Te ist thing you need to dene on the Soli box is the location of youi
seaich index. Assuming youie iunning a Linux seivei and youve mounted a
le system foi the index at /solr, cieate an enviionment vaiiable that points
to this foldei. Tis enviionment vaiiable needs to be called $SOLR_HOME. So foi
oui example, we would dene
$SOLR_HOME=/solr
Tis enviionment vaiiable can be dened anywheie you need in youi opei-
ating systems stait up sequence, in the enviionment foi the usei who is logged
in, oi in the stait up sciipt foi youi application seivei. lf youie using Tomcat to
host Soli, modify setenv.sh oi setenv.bat and add the enviionment vaiiable
theie.
Once youve cieated the enviionment vaiiable, you then can use it in youi
application seiveis stait up conguiation as a paiametei to youi JVM. Tis is
conguied dieiently pei application seivei, but again, if youie using Tomcat,
edit catalina.sh oi catalina.bat and append the following to the $JAVA-
_OPTS vaiiable
-Dsolr.solr.home=$SOLR_HOME
Tis takes caie of telling Soli wheie to stoie its seaich index. Go ahead
and install Soli to this box accoiding to the instiuctions on the Soli web site
(http://lucene.apache.org/solr). Once its installed, shut it down, as
theie is some moie conguiation to do.
Installing the Solr Liferay Plugin Next, you have a choice. lf you have in-
stalled Soli on the same system upon which Lifeiay is iunning (not iecom-
mended), you can simply go to the Lifeiay Maiketplace and install the solr-web
plugin. Tis, howevei, defeats much of the puipose of using Soli, because the
goal is to ooad seaich indexing to anothei box to fiee up piocessing foi youi
installation of Lifeiay. loi this ieason, you ieally shouldnt iun Lifeiay and youi
seaich engine on the same box. Unfoitunately, the conguiation in the plugin
is set exactly that way, piesumably to allow you to expeiiment with dieient
seaich conguiations. To iun them sepaiatelyas you would in a pioduction
enviionment, youll have to make a change to a conguiation le in the plu-
gin befoie you install it so you can tell Lifeiay wheie to send indexing iequests.
0 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
ln this case, go to the Lifeiay Maiketplace and download the plugin to youi
system.
Open oi extiact the plugin. lnside the plugin, youll nd a le called sol-
r-spring.xml in the WEB-INF/classes/META-INF foldei. Open this le in a
text editoi and you will see the entiy which denes wheie the Soli seivei can
be found by Lifeiay
<bean class="com.liferay.portal.spring.context.PortletBeanFactoryPostProcessor" />
<!-- Solr search engine -->
\index{Solr}
<bean id="com.liferay.portal.search.solr.server.BasicAuthSolrServer"
class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">
<constructor-arg type="java.lang.String" value="http://localhost:8080/solr" />
</bean>
Modify this value so it points to the seivei wheie Soli is iunning. Ten save
the le and put it back into the plugin aichive in the same place it was befoie.
Next, extiact the le schema.xml fiom the plugin. lt should be in the doc-
root/WEB-INF/conf foldei. Tis le tells Soli how to index the data coming
fiom Lifeiay, and can be customized foi youi installation. Copy this le to
$SOLR_HOME/conf on youi Soli box (you may have to cieate the conf diiec-
toiy).
Befoie you stait Soli, you should piovide Soli with a list of synonyms and
stop words. Synonyms aie woids that should be equivalent in seaich. loi ex-
ample, if a usei seaiches foi important information, you may want to show ie-
sults foi required information oi critical information. You can dene these in
synonyms.txt. Stop woids aie dened in stopwords.txt and aie woids that
should not be indexed aiticles, pionouns, and othei woids that have liule value
in a seaich. Place these les in youi $SOLR_HOME/conf foldei. Examples foi
both of these les aie found in the Soli aichive in the solr-4.1.0/examp-
le/solr/collection1/conf foldei. Additional Soli conguiation options,
most impoitantly solrconfig.xml and elevate.xml, aie in the $SOLR_HOME-
/conf foldei. Now you can stait Soli. Afei Soli has staited, hot deploy the
solr-web plugin to all youi nodes. See the next section foi instiuctions on hot
deploying to a clustei.
Once the plugin is hot deployed, youi Lifeiay seiveis seaich is automatically
upgiaded to use Soli. lts likely, howevei, that initial seaiches will come up with
nothing this is because you need to ieindex eveiything using Soli.
Go to the contiol panel. ln the Server section, click Server Administration.
Click the Execute buuon next to Reindex all search indexes at the bouom of the
page. Lifeiay will begin sending indexing iequests to Soli foi execution. Once
19.1. LIFERAY CLUSTERING 1
Soli has indexed all youi data, youll have a seaich seivei iunning indepen-
dently of all youi Lifeiay nodes.
lnstalling the plugin to youi nodes has the eect of oveiiiding any calls to
Lucene foi seaiching. All Lifeiays seaich boxes will now use Soli as the seaich
index. Tis is ideal foi a clusteied enviionment, as it allows all youi nodes to
shaie one seaich seivei and one seaich index, and this seaich seivei opeiates
independently of all youi nodes. lf, howevei, you dont have the seivei haid-
waie upon which to install a sepaiate seaich seivei, you can sync the seaich
indexes between all youi nodes, as is desciibed next.
Clustering Lucene indexes on all nodes
Lucene, the seaich indexei which Lifeiay uses, can be conguied to sync in-
dexes acioss each clustei node. Tis is the easiest conguiation to implement,
though of couise, its not as clean a conguiation as using pluggable entei-
piise seaich. Sometimes, howevei, you just dont have anothei seivei to use
foi seaich indexing, so you need a way to keep all youi nodes in sync. Lifeiay
piovides a method called Clustei Link which can send indexing iequests to all
nodes in the clustei to keep them in sync. Tis conguiation doesnt iequiie
any additional haidwaie, and it peifoims veiy well. lt may inciease netwoik
tiac when an individual seivei ieboots, since a full ieindex will be needed.
But this should iaiely happen, making it a good tiadeo if you dont have the
extia haidwaie to implement a Soli seaich seivei.
You can enable Clustei Link by seuing the following piopeity in youi por-
tal-ext.properties le
cluster.link.enabled=true
To clustei youi seaich indexes, you also need to set the following piopeity
lucene.replicate.write=true
lf you have cluster.link.enabled=true but lucene.replicate.write-
=false, youll enable cache ieplication but not index ieplication.
Of couise, cluster.link.enabled=true and lucene.replicate.write-
=true need to be set on all youi nodes. Tats all you need to do to sync youi
indexes. Pieuy easy, iight` Of couise, if you have existing indexes, youll want
to do a ieindex as desciibed in the pievious section once you have Clustei Link
enabled on all youi nodes.
Next, well show how to shaie indexes in a database. Tis is actually not a
iecommended conguiation, as its slow (databases aie always slowei than le
2 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
systems), but foi completeness, well go ahead and tell you howto do it anyway.
But youve been foiewained its fai beuei to use one of the othei methods of
clusteiing youi seaich index.
Sharing a search index (not recommended unless you have a le locking-aware
SAN)
lf you wish to have a shaied index (and we ieally hope you dont), youll need
to eithei shaie the index on the le system oi in the database. Tis iequiies
changing youi Lucene conguiation.
Te Lucene conguiation can be changed by modifying values in youi por-
tal-ext.properties le. Open youi portal.properties le and seaich foi
the text Lucene. Copy that section and then paste it into youi portal-ext.pro-
perties le.
lf you wish to stoie the Lucene seaich index on a le system that is shaied
by all of the Lifeiay nodes (not iecommended youve been wained), you can
modify the location of the seaich index by changing the lucene.dir piopeity.
By default, this piopeity points to the lucene foldei inside the Lifeiay home
foldei
lucene.dir=${liferay.home}/data/lucene/
Change this to the foldei of youi choice. Youll need to iestait Lifeiay foi
the changes to take eect. You can point all of the nodes to this foldei and they
will use the same index.
Like Jackiabbit, howevei, this is not the best way to shaie the seaich index,
as it could iesult in le coiiuption if dieient nodes tiy ieindexing at the same
time. We do not iecommend this foi a pioduction system. Abeuei way (though
still not gieat) is to shaie the index via a database, wheie the database can en-
foice data integiity on the index. Tis is veiy easy to do, it is a simple change to
youi portal-ext.properties le. Of couise, we also dont iecommend this
foi a pioduction system, as accessing the index fiom a database will be slowei
than fiom a le system. lf, howevei, you have no othei option and want to do
this anyway, keep ieading.
Teie is a single piopeity called lucene.store.type. By default this is set
to go to the le system. You can change this so that the index is stoied in the
database by making it the following
lucene.store.type=jdbc
19.1. LIFERAY CLUSTERING 3
Te next time Lifeiay is staited, newtables aie cieated in the Lifeiay database,
and the index is stoied theie. lf all the Lifeiay nodes point to the same database
tables, they will be able to shaie the index. Again, peifoimance on this is not
veiy good. Youi DBAs may be able to tweak the database indexes a bit to im-
piove peifoimance. loi beuei peifoimance, you should considei using a sepa-
iate seaich seivei oi syncing the indexes on the nodes le systems.

Note: MySQL useis need to modify theii JDBC connection


stiing foi this to woik. Add the following paiametei to youi
connection stiing
emulateLocators=true
Alteinatively, you can leave the conguiation alone, and each node will have
its own index. Tis ensuies against collisions when multiple nodes update the
index. Howevei, the indices will quickly get out of sync since they dont iepli-
cate. loi this ieason, this is not a iecommended conguiation eithei. Again, foi
a beuei conguiation, ieplicate the indexes with Clustei Link oi use a sepaiate
seaich seivei (see the section on Soli above).
Distributed Caching
Lifeiay uses Ehcae, which has iobust distiibuted caching suppoit. Tis means
that the cache can be distiibuted acioss multiple Lifeiay nodes iunning concui-
iently. Enabling this cache can inciease peifoimance diamatically. loi exam-
ple, say that two useis aie biowsing the message boaids. Te ist usei clicks a
thiead to iead it. Lifeiay must look up that thiead fiom the database and foimat
it foi display in the biowsei. With a distiibuted Ehcache iunning, this thiead
is stoied in a cache foi quick ietiieval, and that cache is then ieplicated to the
othei nodes in the clustei. Say then that the second usei who is being seived
by anothei node in the clustei wants to iead the same foium thiead and clicks
on it. Tis time, the data is ietiieved moie quickly. Because the thiead is in the
cache, no tiip to the database is necessaiy.
Tis is much moie poweiful than having a cache iunning sepaiately on each
node. Te powei of distributed caching allows foi common poital destinations
to be cached foi multiple useis. Te ist usei can post a message to the thiead
he oi she was ieading, and the cache is updated acioss all the nodes, making the
new post available immediately fiom the local cache. Without that, the second
4 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
usei would need to wait until the cache was invalidated on the node he oi she
connected to befoie he oi she could see the updated foium post.
Teie aie two ways to enable distiibuted caching. lf you use the default
seuings, its veiy easy. lf you need to tweak the cache foi youi site, theie aie a
few moie steps, but its still pieuy easy.
Enabling distributed caching
You must have Clustei Link enabled in oidei to activate distiibuted caching.
Since you alieady did this, you have only one moie piopeity to add to youi
portal-ext.properties le
ehcache.cluster.link.replication=true
What this does is enable some RMl (Remote Method lnvocation) cache lis-
teneis that aie designed to ieplicate the cache acioss a clustei.
Once you enable distiibuted caching, of couise, you should do some due
diligence and test youi systemundei a load that best simulates the kind of tiac
youi system needs to handle. lf youll be seiving up a lot of message boaid
messages, youi sciipt should ieect that. lf web content is the coie of youi site,
youi sciipt should ieect that too.
As a iesult of a load test, you may nd that the default distiibuted cache
seuings aient optimized foi youi site. ln this case, youll need to tweak the
seuings youiself. You can modify the Lifeiay installation diiectly oi you can
use a plugin to do it. Eithei way, the seuings you change aie the same. Lets see
how to do this with a plugin ist.
Modifying the cache settings with a plugin
A benet of woiking with plugins is that you can quickly install a plugin on
each node of youi clustei without taking down the clustei. Well covei this
ist. lf youie not a developei, dont woiiyeven though youll cieate a plugin,
you wont have to wiite any code.
Since weie assuming youie an administiatoi and not a developei, well take
the easiest ioute, and use Lifeiays giaphical development tools, iathei than the
command line Plugins SDK by itself. lf youie a Lifeiay EE customei, down-
load Lifeiay Developei Studio fiom the Customei Poital. Set it up with all the
defaults fiom the ist stait wizaid, and youie good to go (skip the next paia-
giaph).
19.1. LIFERAY CLUSTERING
lf youie not a Lifeiay EE customei, download Eclipse and install Lifeiay
lDE fiom the Eclipse Maiketplace. Download the Plugins SDK foi youi edi-
tion of Lifeiay fiom eithei the Customei Poital (EE) oi the Downloads page on
lifeiay.com. Connect Lifeiay lDE to youi Plugins SDK using the instiuctions
found in the Liferay Developers Guide.
Next, cieate a hook plugin by selecting File New Liferay Project. Select
Hook as the pioject type and give youi pioject a name. Click Finish and youi
pioject is cieated.
ln youi pioject, cieate a text le called portlet.properties in the doc-
root/WEB-INF/src foldei. Tis le can oveiiide piopeities in youi poital just
like portal-ext.properties. lnto this le place the following thiee piopei-
ties
net.sf.ehcache.configurationResourceName=
ehcache.single.vm.config.location=
ehcache.multi.vm.config.location=
Lifeiays conguiation les aie, of couise, used by default. lf youie ovei-
iiding these piopeities, its because you want to customize the conguiation
foi youi own site. A good way to stait with this is to extiact Lifeiays cong-
uiation les and then customize them. lf youie iunning an application seivei
(such as Tomcat) that allows you to biowse to the iunning instance of Lifeiay,
you can extiact Lifeiays conguiation les fiom Lifeiay itself. lf youie not,
you can extiact them fiom Lifeiays .war le oi Lifeiays souice code. ln eithei
place, youll nd the les in the portal-impl.jar le, which is in Lifeiays
WEB-INF/lib foldei. Te les you want aie hibernate-clustered.xml, life-
ray-single-vm.xml, and liferay-multi-vm-clustered.xml, and theyll
be in the /ehcache foldei in this .jar. Once you have these, make a subfoldei
of the docroot foldei in youi pioject. Place the les you extiacted into this
foldei and then specify this foldei in the piopeities above.
loi example, if you cieated a foldei called custom_cache in youi piojects
docroot foldei, youd copy the thiee XML conguiation les (hibernate-clus-
tered.xml, liferay-single-vm.xml, and liferay-multi-vm-clustered.xml)
theie. Ten youd edit youi portlet.properties and specify youi congu-
iation les in the thiee piopeities above
net.sf.ehcache.configurationResourceName=/custom_cache/hibernate-clustered.xml
ehcache.single.vm.config.location=/custom_cache/liferay-single-vm.xml
ehcache.multi.vm.config.location=/custom_cache/liferay-multi-vm-clustered.xml
Save the le and deploy the plugin (deploying plugins is coveied in the Lif-
eray Developers Guide), and the seuings youve placed in those les will ovei-
iide the default Lifeiay seuings. ln this way, you can tweak youi cache seuings
CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
so that youi cache peifoims optimally foi the type of tiac geneiated by youi
site. Te stiength of doing it this way is that you dont have iestait youi seivei
to change the cache seuings. Tis is a gieat benet, but bewaie since Ehcache
doesnt allow foi changes to cache seuings while the cache is alive, iecongui-
ing a cache while the seivei is iunning will ush the cache.
Teie is, of couise, anothei way to do this if you dont want to cieate a
plugin. lt iequiies you to iestait the seivei to enable the new cache seuings,
but you dont have to woik with any developei tools to do it.
Modifying the Ehcache settings directly
Tis method is pieuy similai to the plugin method, except that you have to
modify the Lifeiay installation diiectly. Youll still need to extiact Lifeiays
conguiation les as desciibed in the pievious section. Next, shut down youi
seivei and nd the location in the seivei wheie Lifeiay is installed (this may
not be possible on all application seiveis, and if this is the case, youll need
to use the plugin method desciibed above). loi example, say youie iunning
Lifeiay on Tomcat. Tomcat stoies the deployed veision of Lifeiay in [Tomcat
Home]/webapps/ROOT. lnside this foldei is the foldei stiuctuie WEB-INF/clas-
ses. You can cieate a new foldei in heie called custom_cache to stoie the cus-
tom veisions of the cache conguiation les. Copy the les you extiacted fiom
Lifeiay into this foldei.
You then need to modify the piopeities in portal-ext.properties that
point to these les. Copy/paste the Hibernate section of portal.properties
into youi portal-ext.properties le and then modify the net.sf.ehcache.con-
figurationResourceName piopeity to point to the clusteied veision of the
conguiation le that is now in youi custom foldei
net.sf.ehcache.configurationResourceName=/custom_cache/hibernate-clustered.xml
Now that Lifeiay is pointing to youi custom le, you can modify the seuings
in this le to change the cache conguiation foi Hibeinate.
Next, copy/paste the Ehcache section fiomthe portal.properties le into
youi portal-ext.properties le. Modify the piopeities so they point to the
les in youi custom foldei. loi example
ehcache.multi.vm.config.location=/custom_cache/liferay-multi-vm-clustered.xml
You can now take a look at the seuings in these les and tune them to t
youi enviionment and application. Lets examine how to do that next.
19.1. LIFERAY CLUSTERING
Customizing Hibernate cache settings
By default, Hibeinate (Lifeiays database peisistence layei) is conguied to use
Ehcache as its cache piovidei. Tis is the iecommended seuing. lf youie us-
ing the default seuings using Clustei Link, you alieady have this enabled. lf,
howevei, you need to customize the seuings, youll have to customize it in one
of the ways desciibed above eithei in a plugin oi in the deployed instance of
Lifeiay. Te ist thing, of couise, is to stait o with the clusteied veision of the
le. Copy the hibernate-clustered.xml conguiation le to youi plugin oi
to a place in Lifeiays classpath (as desciibed above) wheie you can iefei to it.
Ten change the following piopeity to point to the le
net.sf.ehcache.configurationResourceName=/path/to/hibernate-clustered.xml
Next, open this le in a text editoi. Youll notice that the conguiation is
alieady set up to peifoim distiibuted caching thiough a multi-cast connection.
Te conguiation, howevei, might not be set up optimally foi youi paiticu-
lai application. Notice that by default, the only object cached in the Hibeinate
cache is the Usei object (com.liferay.``portal``.model.impl.UserImpl).
Tis means that when a usei logs in, his oi hei Usei object will go in the cache so
that any poital opeiation that iequiies access to it (such as peimission checking)
can ietiieve that object veiy quickly fiom the cache.
You may wish to add othei objects to the cache. loi example, a laige pait
of youi application may be document management using the Documents and
Media poitlet. ln this case, you may want to cache media objects, such as
DLFileEntryImpl to impiove peifoimance as useis access documents. To do
that, add anothei block to the conguiation le with the class you want to cache
<cache
eternal="false"
maxElementsInMemory="10000"
name="com.liferay.portlet.documentlibrary.model.impl.DLFileEntryImpl"
overflowToDisk="false"
timeToIdleSeconds="600"
>
<cacheEventListenerFactory
class="com.liferay.portal.cache.ehcache.LiferayCacheEventListenerFactory"
properties="replicatePuts=false,replicateUpdatesViaCopy=false"
propertySeparator=","
/>
<bootstrapCacheLoaderFactory class=
"com.liferay.portal.cache.ehcache.LiferayBootstrapCacheLoaderFactory" />
</cache>
8 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
Youi site may use the message boaids poitlet, and those message boaids may
get a lot of tiac. To cache the thieads on the message boaids, conguie a block
with the MBMessageImpl class
<cache
eternal="false"
maxElementsInMemory="10000"
name="com.liferay.portlet.messageboards.model.impl.MBMessageImpl"
overflowToDisk="false"
timeToIdleSeconds="600"
>
<cacheEventListenerFactory
class="com.liferay.portal.cache.ehcache.LiferayCacheEventListenerFactory"
properties="replicatePuts=false,replicateUpdatesViaCopy=false"
propertySeparator=","
/>
<bootstrapCacheLoaderFactory class=
"com.liferay.portal.cache.ehcache.LiferayBootstrapCacheLoaderFactory" />
</cache>
Note that if youi developeis have oveiiidden any of these classes in an Ext
plugin, youll have to specify the oveiiidden veisions iathei than the stock ones
that come with Lifeiay Poital. You can customize the othei ehcache cong-
uiation les in exactly the same way. Refei to Ehcaches documentation foi
infoimation on how to do this.
As you can see, its easy to add specic data to be cached. Be caieful, how-
evei, as too much caching can actually ieduce peifoimance if the JVM iuns out
of memoiy and staits gaibage collecting too fiequently. Youll likely need to
expeiiment with the memoiy seuings on youi JVM as well as the cache seuings
above. You can nd the specics about these seuings in the documentation foi
Ehcache.
Te last thing well covei about caching is a special EE-only optimization
that can be made to the cache.
Enhanced distributed cache algorithm
EE Only Feature
By default, Lifeiays distiibuted cache uses the RMl ieplication mechanism,
which uses a point to point communication topology. As you can guess, this
19.1. LIFERAY CLUSTERING 9
kind of stiuctuie doesnt scale well foi a laige clustei with many nodes. Because
each node has to send the same event to othei nodes N - 1 times, netwoik tiac
becomes a bouleneck when N is too laige. Ehcache also has a peifoimance
issue of its own, in that it cieates a ieplication thiead foi each cache entity.
ln a laige system like Lifeiay Poital, its veiy common to have moie than 100
cached entities. Tis tianslates to 100 cache ieplication thieads. Tieads aie
expensive, because they take iesouices (memoiy and CPU powei). Most of the
time, these thieads aie sleeping, because they only need to woik when a cached
entity has to talk to iemote peeis.
Figure 19.5: The default algorithmrequires each node to create massive
amounts of dispatch threads to update the cache for each node in the
cluster.
Puuing heap memoiy aside (because the amount of memoiy on the heap
depends on the application(s) iunning), considei the stack memoiy footpiint
of those 100 thieads. By default on most platfoims, the thiead stack size is 2
0 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
MB, foi 100 thieads, thats moie than 200 MB. lf you include the heap memoiy
size, this numbei can become as high as 00 MB foi just one node. And that
massive amount of thieads can also cause fiequent context switch oveihead,
which tianslates to incieased CPU cycles.
loi laige installations containing many nodes, Lifeiay has developed an al-
teinative algoiithm foi handling cache ieplication that can can x both the 1
to N - 1 netwoik communication bouleneck, as well as the massive thieads
bouleneck. Te default implementation uses JGioups UDP multicast to com-
municate.
Figure 19.6: Liferays algorithmuses a single UDP multicast channel, so
that nodes dont have to create a thread for each other node in the cluster.
To ieduce the numbei of ieplication thieads, we piovide a small pool of dis-
patching thieads. Tese delivei cache clustei events to iemote peeis. Since all
cache entities clustei events must go thiough oui pool of dispatching thieads
to communicate, this gives us a chance to coalesce events if two modications
19.1. LIFERAY CLUSTERING 1
to the same cache object happen at almost the same time, we can combine the
changes into one, and then we only need to notify iemote peeis once. Tis
ieduces tiac on the netwoik. We should also note that newei veisions of
Ehcache suppoit the JGioups ieplicatoi and can also x the 1 to N - 1 netwoik
communication, howevei, they cannot x the massive thieads issue and they
cannot coalesce cache events.
loi EE customeis who aie inteiested in this featuie, all you have to do to
enable the alteinate algoiithmis to install a plugin fiomthe Lifeiay Maiketplace.
Seaich foi the Ehcache Cluster EE plugin, which is fiee to all EE customeis, and
install it on all youi nodes. Te new algoiithm is immediately activated and you
can ieap the benets iight away.
Now we can look at the last consideiation when clusteiing Lifeiay hot de-
ploy.
Hot Deploy
Plugins which aie hot deployed will need to be deployed sepaiately to all the
Lifeiay nodes. Te best way to do this is to conguie youi application seivei
to suppoit farms. Tis is a featuie that enables you to deploy an application on
one node and then it ieplicates automatically to each of the othei nodes. Tis,
of couise, is conguied dieiently foi each application seivei, so youll need to
consult youi application seiveis documentation to leain how to do this. lts by
fai the best way to handle hot deploy, and is the iecommended conguiation. lf
you have this woiking, gieat' You can skip the iest of this section completely.
lf foi some ieason youi application seivei doesnt suppoit this featuie oi you
cant use it, youll need to come up with a way to deploy applications acioss youi
clustei. Each node needs to have its own hot deploy foldei. Tis foldei needs
to be wiitable by the usei undei which Lifeiay is iunning, because plugins aie
moved fiom this foldei to a tempoiaiy foldei when they aie deployed. Tis is
to pievent the system fiom enteiing an endless loop, because the piesence of a
plugin in the foldei is what tiiggeis the hot deploy piocess.
When you want to deploy a plugin to the entiie clustei, copy that plugin to
the hot deploy foldeis of all of the Lifeiay nodes. Depending on the numbei
of nodes, it may be best to cieate a sciipt to do this. Once the plugin has been
deployed to all of the nodes, you can then make use of it (by adding the poitlet to
a page oi choosing the theme as the look and feel foi a page oi page hieiaichy).
All of the above will get basic Lifeiay clusteiing woiking, howevei, the con-
guiation can be fuithei optimized. We will see how to do this next.
2 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
19.2 Performance Tuning
Once you have youi poital up and iunning, you may nd a need to tune it foi
peifoimance, especially if youi site winds up geneiating moie tiac than youd
anticipated. Teie aie some denite steps you can take with iegaid to impioving
Lifeiays peifoimance.
Memory
Memoiy is one of the ist things to look at when you want to optimize peifoi-
mance. lf you have any disk swapping, you want to avoid it at all costs it has a
seiious impact on peifoimance. Make suie youi seivei has an optimal amount
of memoiy and youi JVM is tuned to use it.
Teie aie thiee basic JVM command switches that contiol the amount of
memoiy in the Java heap.
-Xms
-Xmx
-XX:MaxPermSize
Tese thiee seuings contiol the amount of memoiy available to the JVM
initially, the maximum amount of memoiy into which the JVM can giow, and
the sepaiate aiea of the heap called Peimanent Geneiation space.
Te ist two seuings should be set to the same value. Tis pievents the JVM
fiom having to ieallocate memoiy if the application needs moie. Seuing them
to the same value causes the JVM to be cieated up fiont with the maximum
amount of memoiy you want to give it.
-Xms1024m -Xmx1024m -XX:MaxPermSize=256m
Tis is peifectly ieasonable foi a modeiately sized machine oi a developei
machine. Tese seuings give the JVM 1024MB foi its iegulai heap size and
have a PeimGen space of 2MB. lf youie having peifoimance pioblems, and
youi piolei is showing that theies a lot of gaibage collection going on, the
ist thing you might want to look at is incieasing the memoiy available to the
JVM. Youll be able to tell if memoiy is a pioblem by iunning a piolei (such
as Jpiobe, YouiKit, oi the NetBeans piolei) on the seivei. lf you see Gaibage
Collection (GC) iunning fiequently, you denitely want to inciease the amount
of memoiy available to the JVM.
Note that theie is a lawof diminishing ietuins on memoiy, especially with 4
bit systems. Tese systems allow you to cieate veiy laige JVMs, but the laigei
the JVM, the moie time it takes foi gaibage collection to take place. loi this
19.2. PERFORMANCE TUNING 3
ieason, you piobably wont want to cieate JVMs of moie than 2 GB in size. To
take advantage of highei amounts of memoiy on a single system, iun multiple
JVMs of Lifeiay instead.
lssues with PeimGen space can also aect peifoimance. PeimGen space
contains long-lived classes, anonymous classes and inteined Stiings (immutable
Stiing objects that aie kept aiound foi a long time to inciease Stiing piocessing
peifoimance). Hibeinatewhich Lifeiay uses extensivelyhas been known to
make use of PeimGen space. lf you inciease the amount of memoiy available to
the JVM, you may want to inciease the amount of PeimGen space accoidingly.
Garbage Collection
As the system iuns, vaiious Java objects aie cieated. Some of these objects aie
long-lived, and some aie not. Te ones that aie not become de-referenced, which
means that the JVM no longei has a link to them because they have ceased to be
useful. Tese may be vaiiables that weie used foi methods which have alieady
ietuined theii values, objects ietiieved fiom the database foi a usei that is no
longei logged on, oi a host of othei things. Tese objects sit in memoiy and ll
up the heap space until the JVM decides its time to clean them up.
Noimally, when gaibage collection (GC) iuns, it stops all piocessing in the
JVMwhile it goes thiough the heap looking foi dead objects. Once it nds them,
it fiees the memoiy they weie taking up, and then piocessing can continue.
lf this happens in a seivei enviionment, it can slow down the piocessing of
iequests, as all piocessing comes to a halt while GC is happening.
Teie aie some JVM switches that you can enable which can ieduce the
amount of time piocessing is halted while gaibage collecting happens. Tese
can impiove the peifoimance of youi Lifeiay installation if applied piopeily.
As always, you will need to use a piolei to monitoi gaibage collection duiing
a load test to tune the numbeis piopeily foi youi seivei haidwaie, opeiating
system, and application seivei.
Te Java heap is divided into sections foi the young geneiation, the old gen-
eiation, and the peimanent geneiation. Te young geneiation is fuithei divided
into thiee sections Eden, which is wheie newobjects aie cieated, and two sui-
vivoi spaces, which we can call the From and To spaces. Gaibage collection oc-
cuis in stages. Geneially, its moie fiequently done in the young geneiation,
less fiequently done in the old geneiation, and even less fiequently done in the
peimanent geneiation, wheie long-lived objects ieside. When gaibage collec-
tion iuns in the young geneiation, Eden is swept foi objects which aie no longei
iefeienced. Tose that aie still aiound aie moved to the To suivivoi space, and
4 CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
Figure 19.7: Java Memory
the From space is then swept. Any othei objects in that space which still have
iefeiences to themaie moved to the To space, and the Fromspace is then cleaied
out altogethei. Afei this, the Fromand the To spaces swap ioles, and piocessing
is fieed up again until the next time the JVM deteimines that gaibage collection
needs to iun.
Afei a piedeteimined numbei of generations of gaibage collection, suiviving
objects may be moved to the old geneiation. Similaily, afei a piedeteimined
numbei of generations of gaibage collection in the old geneiation, suiviving
objects may be moved to the peimanent geneiation.
By default, the JDK uses a seiial gaibage collectoi to achieve this. Tis woiks
veiy well foi a shoit-lived desktop Java application, but is not necessaiily the
best peifoimei foi a long-lived, seivei-based application like Lifeiay. loi this
ieason, you may wish to switch to the Concuiient Maik-Sweep (CMS) collectoi.
ln CMS gaibage collection, iathei than halting application piocessing alto-
gethei, this gaibage collectoi makes one shoit pause in application execution
to maik objects diiectly ieachable fiom the application code. Ten it allows the
application to iun while it maiks all objects which aie ieachable fiom the set it
maiked. linally, it adds anothei phase called the remark phase which nalizes
maiking by ievisiting any objects modied while the application was iunning.
lt then sweeps thiough and gaibage collects. Tough it sounds moie compli-
cated, this has the eect of gieatly ieducing the amount of time that execution
needs to be halted to clean out dead objects.
Just about eveiy aspect of the way memoiy management woiks in Java can
be tuned. ln youi pioling, you may want to expeiiment with some of the
following seuings to see if any of them can inciease youi peifoimance.
NewSize, MaxNewSize: Te initial size and the maximum size of the New
oi Young Geneiation.
19.2. PERFORMANCE TUNING
+UseParNewGC: Causes gaibage collection to happen in paiallel, using mul-
tiple CPUs. Tis decieases gaibage collection oveihead and incieases applica-
tion thioughput.
+UseConcMarkSweepGC: Use the Concuiient Maik-Sweep Gaibage Col-
lectoi. Tis uses shoitei gaibage collection pauses, and is good foi applications
that have a ielatively laige set of long-lived data, and that iun on machines with
two oi moie piocessois, such as web seiveis.
+CMSParallelRemarkEnabled: loi the CMS GC, enables the gaibage collec-
toi to use multiple thieads duiing the CMS iemaik phase. Tis decieases the
pauses duiing this phase.
SurvivorRatio: Contiols the size of the two suivivoi spaces. lts a iatio
between the suivivoi space size and Eden. Te default is 2. Teies not much
bang foi the buck heie, but it may need to be adjusted.
ParallelGCreads: Te numbei of thieads to use foi paiallel gaibage col-
lection. Should be equal to the numbei of CPU coies in youi seivei.
A sample conguiation using the above paiameteis might look something
like this
JAVA_OPTS="$JAVA_OPTS -XX:NewSize=700m -XX:MaxNewSize=700m -Xms2048m
-Xmx2048m -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=20
-XX:ParallelGCThreads=8"
Again, you should always follow the pioceduie of adjusting the seuings,
then testing undei load, then adjusting again. Eveiy system is dieient and
these aie geneial guidelines to follow. Next, well see some modications we
can make to Lifeiays piopeities to help inciease peifoimance.
Properties File Changes
Teie aie also some changes you can make to youi portal-ext.properties
le once you aie in a pioduction enviionment.
Set the following to false to disable checking the last modied date on seivei
side CSS and JavaSciipt.
last.modified.check=false
Set this piopeity to tiue to load the themes meiged CSS les foi fastei
loading foi pioduction. By default it is set to false foi easiei debugging foi
development. You can also disable fast loading by seuing the URL paiametei
css_fast_load to 0.
theme.css.fast.load=true
CHAPTER 19. CONFIGURING LIFERAY FOR HIGH AVAILABILITY
Set this piopeity to tiue to load the combined JavaSciipt les fiom the piop-
eity javascript.files into one compacted le foi fastei loading foi pioduc-
tion.
javascript.fast.load=true
Tese aie vaiious things the Lifeiay engineeiing team has done to inciease
peifoimance geneially. lf youi developeis make use of Lifeiays tools and plat-
foim, theii JavaSciipt and themes can also take advantage of these piopeities.
Lets look at one nal, geneial way of incieasing Lifeiays peifoimance dis-
abling unused seivlet lteis.
Disabling unused servlet lters
Lifeiay comes by default with a numbei of seivlet lteis enabled and iunning.
lt is likely that foi youi installation, you dont need them all. Since seivlet
lteis inteicept the HTTP iequest and do some piocessing on it befoie Lifeiay
even has a chance to stait building the page, you can inciease peifoimance by
disabling the ones youie not using.
You can disable seivlet lteis youie not using by using youi portal-ext.pro-
perties le. Copy the Servlet Filters section fiom the oiiginal portal.pro-
perties le into youi customized le, and then go thiough the list and see if
theie aie any you can disable, by seuing them to false.
loi example, if you aie not using CAS foi single sign-on, disable the CAS
liltei. lf you aie not using NTLM foi single sign-ons, disable the NTLM liltei.
Te fewei seivlet lteis you aie iunning, the less piocessing powei is needed
foi each iequest.
As you can see, theie aie many things you can do to inciease Lifeiays pei-
foimance geneially. But dont foiget to load test youi own applications' lt may
be that a peifoimance issue comes fiom a custom-built application thats doing
something it shouldnt do. Always load test youi system befoie puuing it into
pioduction thats the best way of nding out potential peifoimance pioblems,
and that way, youll nd them duiing peifoimance testing, and not when youi
system is in pioduction.
19.3 Summary
Weve seen how good a t Lifeiay Poital is foi the enteipiise. lt can be scaled
lineaily to giow to whatevei size you need to seive youi useis. Clusteiing is a
19.3. SUMMARY
snap, and Lifeiay haimonizes veiy well with whatevei enviionment you may
have.
Lifeiay Poital is also built foi peifoimance. You can take advantage of iead-
wiitei database conguiations, as well as database shaiding. You can tune it to
suppoit ovei 3300 concuiient useis on a single seivei with mean login times
undei half a second and maximum thioughput of moie than 9 logins pei sec-
ond. Weve seen some tips foi tuning Lifeiay Poital, and we have to keep in
mind the adage about tuning load test and piole, tune, iepeat.
ln all, Lifeiay Poital gives you all the options you need to build a high-
peifoimance, iobust enviionment that suppoits youi enteipiise.
lNurx
Activities Poitlet, 22
advanced le system stoie, 44
advanced seaich, 1, 19
Advanced Styling, 201
Amazon, 3, 39, 4, 4
Andioid, 9, 101, 103, 104, 133, 134,
13, 144
App Managei, 394
Aichived Setups, 20
Asset Publishei, 38, 43, 10, 18, 14
1, 19182, 198
Atlassian Ciowd, 8
audit events, 99, 00, 03
audit plugins, 99
auto deploy, 41, 419, 420
Backgiound Styles, 199
Backing up, 203
backup, 2, 9, 00
Base DN, 1
Beanshell, 94, 22, 23
Blogs, 3, 11, 203, 212, 213, 21,
21, 219222, 2, 20,
329, 333, 2
Bookmaiks, 34334, 348, 31
Boidei Styles, 199
bundle, 20, 2, 313, 40, 41, 422,
42429, 432, 434, 441,
4, 4, 494, 39, 10
12, 1820, 43
Calendai, 3, 90, 91, 221224, 2,
22
Captcha, 89
cait, 20, 224, 29, 31, 3, 39, 31
CAS, , 8, 81,
categoiies, 10, , 8, 83, 10, 12,
1, 18, 10, 11, 13,
14, 1, 1, 181, 182,
204, 20, 218, 228, 229,
233, 23, 243, 28, 33,
34, 3, 393, 8, 08
Chat, 20, 222
chat, 9, 11, 24, 20, 222, 28
8
INDEX 9
checkin, 208,
clusteiing, 42, 48, 2, 1
CMlS, 11, 118121, 4
CMlS stoie, 4
CMS, 4
Community Edition, 134, 239, 21,
423, 42
connection pool, 432, 43, 438, 42
Content Display Page, 180
Contiol Panel, 2022, 32, 33, 39, 43,
40, 4, , , , 1
, 9, 80, 888, 9, 98,
101, 102, 104, 11, 18
11, 1, 190, 191, 221,
23, 241, 243, 24248,
292, 330333, 33, 31,
32, 39, 30, 3, 380,
382, 383, 38, 24, 40
42, 8, 1, 81, 1
coupons, 3
ciedit caids, 3
Custom lields, 4, 191
custom logo, 2
data denitions, 291, 293, 300, 30
data souice, 432, 434, 49, 42, 43,
49, 481, 490492, 02,
04, 10, 11, 118,
21, 24, 3, 3840
detail templates, 4, 300, 301, 30
Display Page, 43, 19, 180, 182, 198
Display Seuings, 1, 1, 19
Display Style, 12
distiibuted caching, 3, 4,
document types, 9, 10, 10, 110
112, 128, 181
Documentum, 8, 11, 4, 48
dynamic data lists, 304, 311
ehcache, 8
Email Notications, 83
Enteipiise Edition, 134, 183, 189, 190,
21, 304, 423, 42, 99
lacebook, 2, 121, 209, 210, 219,
239, 24, 2, 29, 288,
289, , , 81
faceted seaich, 14
foiks, 322
lieemaikei, , 0, 301, 302, 318
gadget, 12, 211, 232, 2, 29
281, 283, 284, 28, 28
gaibage collection, 9, 3, 4
Glasslish, 4, 4, 49, 4143,
4
Google Analytics, 30, 0
Gioovy, 31, 319, 40, 94, 22, 24,
2, 28, 34
gioup lD, 38, 43
heap, 0, 24
hibeinate, 484
Hook Plugin, 30
hook plugin, 12, 9,
hot deploy, 14, 402, 40, 408, 414
41, 419, 3, 0, 1
HSQL, 43, 49, 49, 38
lmage Galleiy, 90, 1, 1
lmage Uploadei, 4
lmageMagick, 12, 91, 93
iOS, 9, 104, 133, 134, 13, 144, 149,
10
JAAS, 10
Jabbei, 232, 28
jai le, 4, 4, 48, 00
JavaSciipt, 14, 3, 209, 301, 31, 319,
94, ,
0 INDEX
JBoss, 483, 48491, 494
JCR stoie, 4
JDBC, 01, 0, 90, 4
Jeuy, 4, 4, 49, 480, 483, 49
joins, 320, 322
JOnAS, 494499
JSR-10, 90, 0, 4
JSR-28, 20, 40
JVM, 48, 88, 89, 18, 8, 2
4
Kaleo, 491, 304, 30, 30310, 312
314, 32, 33333, 339,
342, 229
Kaleo Designei, 33, 342
Kaleo loims, 304, 30, 309, 33, 339,
342
KDE, 130, 133
Knowledge Base, 343, 39, 380, 382,
383, 38388
LAR le, 2, 9, 80, 3
layouts, 4, 29, 38, 3, 2, 8
LDAP, 14, 8, 11, 2, 42,
, 9, 81
LDAP Gioups, 2
LibieOce, 12, 91, 92
Lifeiay Home, 414, 429, 433, 43,
14, 20, 0, 0, 10
Lifeiay seivices, 23
Lifeiay Sync, 13313, 13, 139144,
10, 1
Linux, 130, 133, 428, 440, 441, 44,
41, 41, 49
list templates, 4, 300, 301, 303, 311
locations, , 23, 0
log levels, 89, 9, 0, 08
logging, 281, 9, 009, 30
logs, 24, 318, 328, 424, 01, 21,

Lucene, 419, 48, 1, 2


Mac OS, 130, 13313
Mail, 228, 438, 24, 90
mail session, 432, 438, 42, 43, 480,
481, 491, 492, 03, 04,
11, 12, 118, 23,
24, 3
Maigin and Padding, 201
maiketplace, 313, 39
meetups, 22
Membeiship Type, 4
Message Boaids, 2, 3, 88, 203, 20,
20, 224, 22, 22229,
233, 23, 23, 238, 239,
28, 288, 333, 32, 8,
90
metadata sets, 10, 111, 112, 114,
11, 1
Miciosof Oce, 123, 124
mobile device iules, 1, 9, 98, 100,
101, 104
modeiatoi, 22
Monitoiing, 8
Mule Tcat, 439, 440
MySQL, 439, 01, 11, 0, 4
Navigation, 32, 18, 180, 182, 208,
218, 38,
Netvibes, 209, 211
notication, 10, 134, 139, 18, 22,
22, 229231, 241, 2,
31318, 320, 323, 324,
340, 31, 3, 42, 3,
90, 9
NTLM, , 81,
OAuth, 29281, 283, 284, 28
OpenlD, 2, , 8, 81
OpenOce, 4, 12, 91, 92, 9
INDEX 1
OpenSocial, 2, 12, 14, 211, 23, 24,
2, 28, 284, 28, 289
OpenSSO, 14, 9
Oiacle, 21, 2, 4
oideis, 4, 31
Oiganization, 28, 29, 313, 331, 333,
42, 44, 448, 2,
, 1
page customizations, 29, 30, 18, 18
page template, 4, 24, 33, 1, 80,
180, 182, 41
page vaiiations, 9193
passwoid expiiation, 4
patches, 1013, 21
patching tool, 1013, 21
peimissions, 4, 29, 3, 3, 4, 4,
8, 4, , 1, , 8, 8,
92, 9, 9, 104, 131, 143,
10, 18, 19, 204, 20,
20, 21, 21, 23, 238,
21, 22, 2, 34, 348,
33, 380, 382, 431, 40,
43, 4, 4, , ,
8, 9, 1, 3, 8,
98, 1, 18
peisonal sites, 22, 10, 18318, 19,
2, 1
pingback, 21, 218
plugin, 1, 3, 0, 9, 98, 11, 12,
191, 21, 24, 30, 313,
333, 343, 3133, 3
3, 39, 30, 388, 402,
40, 4041, 419421, 423,
430, 431, 43, 44, 48,
48, 40, 41, 8, 9,
9, 99, 0, 08, 14,
1, 18, 32, 33, 3,
48, 0, 1, 48,
1
plugin iepositoiy, 31, 32
Plugins Conguiation, 8
Polls, 24, 24820, 28
poital instance, 8, 10, 211, 394,
94, 9, 40
Poital Seuings, , 80, 8
poital-ext.piopeities, 4, 94
poitlet, 14, 23, 24, 2, 29, 30, 343,
38, 424, 4, 48, 0, 3,
, 1, 838, 8, 88,
9092, 9, 9, 100, 10
108, 110, 111, 122, 124,
12, 12, 131, 133, 1,
18, 14, 1, 18, 14
1, 180182, 184, 18,
18, 188, 190, 191, 19,
19199, 201, 203211, 213,
21, 21, 21822, 228
230, 233, 23, 23, 239,
241, 242, 24, 24, 248
20, 2228, 2024, 2
29, 21, 23, 24, 2
29, 28289, 291, 29,
298, 300, 301, 304, 30,
324, 329, 330, 333, 33,
33, 339, 342, 34, 34,
348, 3034, 3, 3,
3933, 3, 3, 3,
39, 380, 382, 383, 38
38, 393, 402, 40411,
41341, 419, 421, 423,
4, 2, , 8, 9,
3, 8, 90, 9, 98
00, 03, 08, 22, 28,
, 8, 1
Poitlet Conguiation, 198
poitlet pages, 24
poitlet URL, 198
Powei Useis, 80
piivate pages, 4, 22, 2, 31, 3, ,
2 INDEX
9, 8, 99, 10, 18318,
223, 290, 4, 1, 3,
80
public pages, 4, 22, 3, , 9, 8,
104, 184, 18, 20, 288,
2, 3,
public iendei paiameteis, 239
Puichase, 98, 392394
Python, 31, 319, 94, 22, 2
iead-wiitei database, 38, 39
ieindex, 410, 0, 0, 1
ielated assets, , 43, 44, 12, 181,
182
Resin, 0003, 0
Role, 8, 4, 204, 31, 32, 331, 348,
43, , , 8, 1
RSS, 2, 10, 12, 181, 211, 22, 242,
2, 383, 38
Ruby, 31, 40, 94, 22, 2
iule gioup, 9100, 102104
iules denition, 191
iules engine, 183, 188190, 19
salience, 193
schema, 314, 333
scope, 39, 4, , , 9, 98, 10, 11,
181, 20, 20, 213, 231,
23, 313, 318, 32, 332,
333, 33, 42, , ,
8, 80
sciipt engine, 22, 24, 2, 2, 34
seivlet, 8, 40, 40,
setup wizaid, , 428, 429, 432434,
43, 43, 439, 434,
481483, 493, 494, 0,
0, 12, 13, 120,
24, 2, 2, 33
shaiding, 3840, 42,
ShaiePoint, 11124
shipping, 33, 34, 31, 3
shopping, 14, 20, 3, 224, 291, 31,
32, 3, 3, 39, 31,
3
single sign-on, 14, 1, 42, , ,
8, 9, 3,
site pages, 3, 1, , 80, 93, 104,
39,
site seuings,
site template, 4, 33, , 9, 1,
9, 2, 42, 2, 4, ,
80
sitemap, 32
SiteMindei, , 9, 81
SMTP, 432, 43, 90
Social Activity, 29, 20, 23, 289
sofwaie catalog, 323, 30
Soli, 0, 481, 3
Spiing, 40, 40, 30, 32, 39
staging, 4, , 2, 30, 49, 1, 3, 9,
8388, 9093, 9, 104, 10,
330
state machine, 314
stiuctuie, 4, , , 38, 39, 48, 1, 3
8, 0, 1, 3, 80, 83,
10410, 134, 10, 192,
292, 301, 39, 414, 423,
42, 49, 42, 444,
49, 80, 43, 44, ,
9
Sync loldei, 141
tag, 2, , 14, 18, 3, , 83, 10, 11,
12, 111, 13, 14,
1, 1, 14, 1, 1,
181, 182, 190192, 20,
208, 21, 218, 22, 239,
2, 31, 318, 3, 380,
40, 411, 10, 8, 28
tax, 34, 398
INDEX 3
template, 4, 1, 24, 33, 38, 39, 43, 48,
1, 3, 4, , 8, 0, 1,
3, , 9, 180, 83,
100, 104, 10, 180, 182,
18, 18, 228, 291,
298303, 30, 311, 39,
380, 382384, 40, 408,
413, 49, 41, 42, 2,
4, , 80, 9
Text Styles, 199
theme, 2, 2, 3, , 1, , 92, 100,
18, 19, 198, 23, 2,
393, 40, 408, 412414,
419, 421, 423, 84, 8,
9, 0, 1, ,
thiead, 10, 12, 20, 212, 218, 22
229, 231, 233238, 28,
29, 314, 333, 4, 9,
3, 4, 81
thiead dump, 9
timeis, 322, 323, 32
Tomcat, 41, 422, 42, 428, 440, 443,
44, 42, 44, 498, 0,
10, 11, , 18, 19,
49, ,
tiackback, 21, 218
upgiade, 2, 3, 33, 3, 41, 430, 431,
1421, 0
Usei, 10, 12, 1, 29, 30, , 124, 10,
14, 184, 18, 188, 191,
194, 20, 22, 229, 233,
238, 2, 28, 22, 24,
28, 29, 21, 23, 29,
280, 314, 33, 39, 31,
42, 43, 4, 49, 1
, 1, , 2, 8
80, 83, 8, 91, 03,
24,
Usei Gioup, 28, 49, 24, 1
Usei Gioup Sites, 3
Velocity, , 0, 1, 291, 302, 303, 318
veision histoiy, 392
Viitual Host, 32
vocabulaiies, 10, 11, 13
WAP Styling, 201
WCM, 4, 120, 38, 42, 4, 4, 48,
1, 3, 1, 83, 84, 104
web content, 4, , , 18, 39, 42, 43,
4, 48, 04, 8, ,
80, 83, 88, 11, 1, 18,
1, 14, 1, 19, 182,
198, 292, 29, 301, 302,
313, 329, 330, 342, 4
Web loim, 411
WebDAV, 8, 130, 131, 133
WebLogic, 42, 141, 20, 21,
23, 2
WebSpheie, 419, 420, 32, 33, 3,
3
widgets, 11, 13, 209, 211
Wiki, 23, 3, 3, , 88, 20, 208,
238, 239, 241, 242, 24,
24, 28, 29, 288, 329,
333, 38
Windows, 120, 130, 131, 13313,
13, 41, 42, 428, 440,
441, 443, 44, 41, 4,
41, 0, , , 11
woikow designei, 312, 33333
XML, 32, 218, 23, 23, 28, 312
314, 31, 319, 32, 32,
329, 33433, 341, 31,
3, 38, 30, 488, 28,
32,
XSL, 0
Xugglei, 12, 91, 93, 94

You might also like