Thông tin tài liệu
MANNING
IN ACTION
Richard Sezov, Jr.
FOREWORD BY BRIAN KIM
Official Guide
www.it-ebooks.info
Liferay in Action
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
Liferay in Action
The Official Guide to
Liferay Portal Development
RICH SEZOV, JR
MANNING
SHELTER ISLAND
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
To my wife: Yo Deborah! I did it!
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 261
Shelter Island, NY 11964
Email: orders@manning.com
©2012 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by means electronic, mechanical, photocopying, or otherwise, without prior written
permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial caps
or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books we publish printed on acid-free paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our planet, Manning books are
printed on paper that is at least 15 percent recycled and processed without elemental chlorine.
Development editor: Lianna Wlasiuk
Manning Publications Co. Copyeditor: Tiffany Taylor
20 Baldwin Road Proofreader: Melody Dolab
PO Box 261 Typesetter: Marija Tudor
Shelter Island, NY 11964 Cover designer: Marija Tudor
ISBN: 9781935182825
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – MAL – 17 16 15 14 13 12 11
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
v
brief contents
PART 1 WORKING WITH LIFERAY AND PORTLETS 1
1
■
The Liferay difference 3
2
■
Getting started with the Liferay
development platform 30
PART 2 WRITING APPLICATIONS ON LIFERAY’S PLATFORM 63
3
■
A data-driven portlet made easy 65
4
■
MVC the Liferay way 91
5
■
Designing your site with themes and
layout templates 128
6
■
Making your site social 154
7
■
Enabling user collaboration 176
PART 3 CUSTOMIZING LIFERAY 209
8
■
Hooks 211
9
■
Extending Liferay effectively 241
10
■
A tour of Liferay APIs 263
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
BRIEF CONTENTS
vi
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
vii
contents
foreword xiii
preface xv
acknowledgments xvii
about this book xx
about the cover illustration xxiv
PART 1 WORKING WITH LIFERAY AND PORTLETS 1
1
The Liferay difference 3
1.1 The Java portal promise: from disappointment to
fulfillment 4
The Java portal disappointment 6
■
Liferay keeps the Java
portal promises 8
1.2 Getting to know Liferay 9
Liferay is an application aggregator 10
■
Liferay is a content
manager 12
■
Liferay is a collaboration tool 14
■
Liferay is
anything you want it to be and any way you want it to look 15
What has this little exercise accomplished? 17
1.3 How Liferay structures a portal 18
The high-level view 18
■
Adding content to a collection with
pages 20
■
Configuring a portlet’s scope 20
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
CONTENTS
viii
1.4 Getting around in Liferay 23
Pin icon 24
■
Add menu 24
■
Manage menu 24
Toggle Edit Controls 26
■
Go To menu 26
■
User Account 26
1.5 Imagining your site in Liferay 26
Asking the right questions 27
■
Defining and categorizing
collections 28
■
Designing content 28
1.6 Summary 28
2
Getting started with the Liferay development platform 30
2.1 Installing Liferay and the Plugins SDK 31
Installing the Java SDK 32
■
Installing a Liferay bundle 33
2.2 A crash course in Liferay server administration 35
Removing the sample web site 35
■
Setting up a database 35
Connecting Liferay to the SQL database 37
2.3 Setting up the Plugins SDK 38
Installing Ant 38
■
Installing the Plugins SDK 39
Configuring the Plugins SDK 39
■
Configuring a non-Tomcat
application server 41
2.4 Developing a portlet plugin 42
Creating a portlet plugin: Hello World 43
■
Deploying the
Hello World plugin 43
2.5 Making Hello World into Hello You 45
Anatomy of a portlet project 46
■
Configuring Hello You 47
Portlet initialization and implementing View mode 49
■
URLs
in portals are different 52
■
Implementing Edit mode 53
2.6 Deploying and testing your portlet 57
Changing the portlet’s category and name 58
■
Telling Liferay
about a renamed portlet 60
2.7 Summary 61
PART 2 WRITING APPLICATIONS ON
LIFERAY’S PLATFORM 63
3
A data-driven portlet made easy 65
3.1 Introducing Inkwell: a case study 65
Company profile: Inkwell 66
■
What Inkwell needs in a web
site 67
■
Inkwell’s high-level portal design 67
■
Inkwell
portal phase 1 requirements 68
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
CONTENTS
ix
3.2 Designing the Product Registration portlet 69
A blueprint of the portlet 69
■
Designing the database
tables 70
■
Defining portlet modes and generating the project 72
3.3 Generating DB code with Service Builder 72
Filling a definite need 73
■
Creating the service.xml file 75
Running Service Builder 77
3.4 Creating a buffer to the persistence layer 78
Why layering is important 78
■
Using two layers for
persistence 79
■
Implementing the DTO layer 80
3.5 Service Builder in action 84
Defining table relationships 84
■
Sharing services 87
Adding registered users and their products 88
3.6 Summary 90
4
MVC the Liferay way 91
4.1 Using Model-View-Controller 92
Edit mode? What Edit mode? 93
■
MVC according to Liferay 95
4.2 Configuring the portlet project 96
Defining portlets in your deployment descriptors 97
■
Having
one location for JSP dependencies 99
4.3 Creating a form with AlloyUI taglibs 102
Getting started with AlloyUI tag libraries 102
■
Providing
feedback and messages 105
■
Translating messages to multiple
languages 108
■
Validating user-submitted forms 109
Displaying data with the search container 111
■
Using the
search container to present your data 111
■
Editing and
deleting data 114
■
Protecting data with Liferay
permissions 116
■
Pointing to the permissions
configuration 116
■
Configuring Liferay permissions 117
4.4 Generating different field types with AlloyUI taglibs 120
Generating date pickers 121
■
Selecting data with AlloyUI
taglibs 122
4.5 Using Liferay’s MVC makes your portlets simpler 124
4.6 Summary 126
5
Designing your site with themes and layout templates 128
5.1 Understanding themes and their structure 129
Generating a theme project 131
■
Deconstructing a theme 131
Download from Wow! eBook <www.wowebook.com>
www.it-ebooks.info
[...]... strategy 246 Deploying Ext plugins 247 ■ ■ 9.2 Ext in action 249 Struts 101 249 Modifying a core portlet action 251 Other extension points for the Ext plugin 252 ■ 9.3 Delivering a page, Liferay style Struts? Again? 9.4 254 ■ 253 Layers and layers 255 Understanding Liferay development best practices 257 Practices for developing applications 257 Practices for customizing Liferay 258 Deciding if you need... for taking off and running with the PDF tools Speaking of training, special thanks to Ed Shin and Jeff Handa for helping me maximize my time on the book by organizing various training tasks Thanks also to Mike Han for keeping us in line and for your help with my workflow questions Thanks to Greg Amerson for the awesome Liferay IDE/Developer Studio and all of your excellent feedback You’re making Liferay. .. the same by writing about it and teaching it And man, does he love Liferay When Rich isn’t working, you’ll generally find him spending time with his wife and daughter, doing all kinds of interesting things, and (he hopes) not getting into too much trouble www.it-ebooks.info Download from Wow! eBook about the cover illustration The figure on the cover of Liferay in Action is captioned... how Liferay helps you structure a web site You’ll also get to see what Liferay looks like by default and how you can navigate around it And finally, using all the information presented, I’ll show you how to begin thinking about implementing your site using Liferay Portal To get your bearings, let’s start by exploring why Liferay calls itself a portal and what that term has come to mean in the industry... properties ■ Workflow- ■ ■ 7.4 Tagging and categorizing content 196 Choosing between tags and categories 196 a tag for categories 197 7.5 7.6 193 ■ A tag for tags and Adding discussions and ratings 199 Creating custom queries using SQL 200 Crafting your query 201 Making your own finder 202 Displaying custom columns in a search container 204 ■ 7.7 Summary 206 PART 3 CUSTOMIZING LIFERAY 209 8 Hooks 211... paradigm Creating a hook 214 8.2 What hooks can customize 213 Hook basics ■ 213 214 Customizing portal properties 215 Customizing portal event properties 216 Customizing listener properties 217 Customizing language properties 217 Customizing JSP files 218 Customizing services 219 ■ ■ ■ ■ 8.3 Hooks in action: customizing Inkwell’s shopping cart Generating a service layer in a hook 223 Creating the configuration... networking: why is it important? 155 Allowing users to connect with each other 156 Expanding your reach beyond your own site 156 Creating a dynamic, more positive user experience 157 ■ ■ 6.2 6.3 Installing Liferay s social networking portlets 158 Understanding Liferay s social features 158 Relating with others 159 Publishing activities Sending social requests 159 ■ 6.4 Using profile pages 160 Identifying... flip through it, find what you’re looking for, and apply that information to your own project I’ve done this by grouping the chapters into three parts Part 1, which includes chapters 1 and 2, contains introductory material about Liferay and Liferay development Part 2, which includes chapters 3–7, is all about writing applications on Liferay s platform To round out the discussion of Liferay development,... plugins to customize anything in Liferay As far as Liferay s development framework goes, this is the ultimate in what you can do to make Liferay your own We round out this discussion by talking about development best practices, so you know when it’s appropriate to use each kind of plugin Now that you know all the components of Liferay development, chapter 10 ends the book by showing you seven APIs in Liferay. .. Wiring the data source up Sending messages over Liferay s message bus Configuring the bus to send your messages 278 the sender and the listener 280 10.6 10.7 appendix A appendix B appendix C appendix D appendix E 277 Implementing Scheduling jobs 281 Indexing and search 282 Indexing your data 10.8 ■ 283 ■ Searching your data 287 Summary 292 Liferay and IDEs 295 Introduction to the Portlet API 312 Inter-portlet . started with the Liferay development platform 30
2.1 Installing Liferay and the Plugins SDK 31
Installing the Java SDK 32
■
Installing a Liferay bundle 33
2.2. 37
2.3 Setting up the Plugins SDK 38
Installing Ant 38
■
Installing the Plugins SDK 39
Configuring the Plugins SDK 39
■
Configuring a non-Tomcat
application
Ngày đăng: 16/03/2014, 00:20
Xem thêm: Liferay in Action pdf, Liferay in Action pdf, 1 The Java portal promise: from disappointment to fulfillment, 5 Using Liferay’s MVC makes your portlets simpler, 2 Understanding theme markup, CSS, and JavaScript, 1 Social networking: why is it important?, 2 Installing Liferay’s social networking portlets, 5 Friends, Romans, and countrymen: they’re all social relations, 3 Hooks in action: customizing Inkwell’s shopping cart, B.2 Portlets, frameworks, and other languages