OpenCms 7 Development Extending and customizing OpenCms through its Java API 1st Edition Liliedahl pdf download
OpenCms 7 Development Extending and customizing OpenCms through its Java API 1st Edition Liliedahl pdf download
https://ebookname.com/product/opencms-7-development-extending-
and-customizing-opencms-through-its-java-api-1st-edition-
liliedahl/
https://ebookname.com/product/embedded-android-porting-extending-
and-customizing-1st-edition-karim-yaghmour/
https://ebookname.com/product/web-api-development-for-the-
absolute-beginner-a-step-by-step-approach-to-learning-the-
fundamentals-of-web-api-development-with-net-7-1st-edition-irina-
dominte/
https://ebookname.com/product/open-source-messaging-application-
development-building-and-extending-gaim-1st-edition-sean-egan/
https://ebookname.com/product/advances-in-marine-biology-
vol-53-1st-edition-david-w-sims-ed/
Contemporary Social Psychological Theories 1st ed
Edition Peter J. Burke
https://ebookname.com/product/contemporary-social-psychological-
theories-1st-ed-edition-peter-j-burke/
https://ebookname.com/product/a-companion-to-greek-religion-1st-
edition-daniel-ogden-ed/
https://ebookname.com/product/designing-audio-effect-plugins-in-
c-for-aax-au-and-vst3-with-dsp-theory-2nd-edition-will-c-pirkle/
https://ebookname.com/product/franklin-s-passage-1st-edition-
david-solway/
https://ebookname.com/product/risk-assessment-and-management-in-
mental-health-nursing-1st-edition-phil-woods/
Proceeding International Conference on Democracy and
Accountabilty ICoDA 2015 1st Edition Nanang Haryono
(Ed.)& Irfa Puspitasari (Ed.)
https://ebookname.com/product/proceeding-international-
conference-on-democracy-and-accountabilty-icoda-2015-1st-edition-
nanang-haryono-ed-irfa-puspitasari-ed/
www.it-ebooks.info
OpenCms 7 Development
Dan Liliedahl
BIRMINGHAM - MUMBAI
www.it-ebooks.info
OpenCms 7 Development
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of
the information presented. However, the information contained in this book is sold
without warranty, either express or implied. Neither the author, Packt Publishing,
nor its dealers or distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-847191-05-2
www.packtpub.com
www.it-ebooks.info
Credits
Reviewer Indexer
Olli Aro Rekha Nair
www.it-ebooks.info
About the Author
www.it-ebooks.info
I would like to thank the people at Packt who have helped me
along the way with this book, especially Douglas Paterson, Senior
Acquisition Editor for his initial guidance and ongoing support.
Thanks also to Abhijeet Deobhakta for his patience and for putting
up with many delays and missed deadlines. Many thanks to Olli
Arro and Himanshu Panchal for their time, comments, and helpful
suggestions. It is great people like these who have made this book
enjoyable to write and seem to go by quickly.
www.it-ebooks.info
About the Reviewer
Olli Aro hails from Finnish Lapland, but is based now in the north of England.
Olli Aro has over 10 years experience in the area of innovation and development of
software and web-based applications. In his current role as head of technology and
product development for Clicks and Links Ltd, Olli has been responsible for the
company's portfolio of Open Source-based solutions. He has been involved in the
OpenCms project since 2001 (version 4), contributing various open source modules
and bug fixes to the project. Olli was also involved in reviewing the previous version
of the OpenCms book. Prior to Clicks and Links, Olli worked for organizations such
as Nokia, eMobile Ltd, and CCC Systems Oy. In his spare time, he works on his own
social networking site, Breakaway Republix.
www.it-ebooks.info
Table of Contents
Preface 1
Chapter 1: Overview 7
The Site Design 8
Required Developer Skills 12
Basic Site Development 12
Sites Requiring Custom Content Types 13
Sites Requiring Custom Features 14
Bespoke Site Development 14
OpenCms Application Overview 14
The OpenCms Directory Structure 15
The Real File System Layout 15
The Virtual File System Layout 18
OpenCms Architecture 19
Extensibility through Modules 20
The OpenCms Web Request Process 20
OpenCms Web Application Packaging 21
Building a Complete Site with OpenCms 21
Summary 22
Chapter 2: Developing in OpenCms 23
Developing Basic Site Content 23
Setting Up an Environment for Creating JSP Code 24
Editing Files Using File Synchronization 26
Using WebDAV for Editing 28
Debugging JSP Code in OpenCms 30
Setting Up an Eclipse Environment to Build OpenCms 33
Tools Needed to Build OpenCms in Eclipse 33
Step 1: Checkout the Project Source from CVS 34
Step 2: Setting the Classpath for Compilation 40
Step 3: Using Ant to Build a Distribution Package 41
Building OpenCms outside of Eclipse Using Ant 44
Debugging OpenCms in Eclipse 45
www.it-ebooks.info
Table of Contents
[ ii ]
www.it-ebooks.info
Table of Contents
[ iii ]
www.it-ebooks.info
Table of Contents
[ iv ]
www.it-ebooks.info
Preface
OpenCms can be used by Java developers to create sophisticated add-ons and
customizations that extend the power of OpenCms in virtually unlimited directions.
Starting by showing how to set up a development environment for OpenCms
work, this book moves you through various tasks of increasing complexity. Some
of the common tasks covered are building OpenCms, XML asset type development,
templating, module development, user and role setup, and search integration. In
addition to these common tasks some more advanced topics are covered such as
self-registering users, RSS support, developing custom widgets, and extending the
administrative interface. All the topics include examples and are presented while
building a sample blog site.
This book is a clear, practical tutorial to OpenCms development. It will take you
through the development of an example site, illustrating the key concepts of
OpenCms development with examples at every stage.
Chapter 2 sets the stage for coding by providing details on how to set up various
OpenCms development environments. The chapter includes a step-by-step
procedure for using Eclipse to check out and build OpenCms from the CVS
repository. The chapter describes how to build OpenCms using Ant and also how to
debug OpenCms itself.
www.it-ebooks.info
Preface
Chapter 4 continues developing the sample site by covering JSP template coding.
A set of templates is created to display the blog content, including a complete run
through of how they are put together. The example illustrates the use of custom
template coding beyond the standard OpenCms tag library by sub-classing Java
template classes. Included in the chapter is an overview of the resource and template
loading mechanism. Also relating to templates is a description of using expressions
and JSTL within template code. Lastly in the chapter is a guide to using WebDAV for
template editing in Eclipse.
Chapter 5 covers the usage of Lucene within OpenCms, beginning with an overview
of basic Lucene concepts. This is followed by an in-depth guide to creating a search
index in OpenCms. The guide provides an example of building a new search index
for the blog site example and describes a developer tool, which may be used to
perform test queries against the index. The chapter includes a walkthrough of
implementing a search form in OpenCms for simple cases and for more
advanced situations.
Chapter 6 continues the build out of the sample site by adding support for users
and commenting. It starts with an explanation of OpenCms security, including a
discussion on Roles, Groups, Users, and Organizational Units. It then proceeds with
the set up of the group and role structure for the sample, and shows how they are
used within the code.
Chapter 7 shows how easy it is to support user customizations of site pages. It then
show an example of this by adding RSS feed support to the sample site, allowing
users to specify a custom feed. Included in the chapter is a discussion of integrating
third-party libraries into OpenCms.
Chapter 8 describes the custom widget interface, and then shows how to design and
create a widget. The widget provides a pluggable data interface that is used to obtain
a list of selection values for a select list. The chapter then illustrates how to read XML
content fields by creating a list source that gets its values from any content field.
Finally, the chapter shows how to localize message strings and how to register and
use the custom widget.
[]
www.it-ebooks.info
Preface
Chapter 9 shows how RSS feeds can be generated from OpenCms content. It also
shows how wrapper classes can be used around structured content items to make
them easier to work with, and then walks through creation of an RSS feed generation
module using these concepts.
Chapter 10 discusses how administration points are created in OpenCms, and also
how to use OpenCms dialog classes. The chapter also discusses how widgets can
be used programmatically. An example administration point is created that ties
together topics from previous chapters, showing how to use widgets, dialogs, and
multiple screens.
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles and an
explanation of their meaning.
There are three styles for code. Code words in text are shown as follows: "We can
include other contexts through the use of the include directive."
[]
www.it-ebooks.info
Preface
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items will be made bold:
<mappings>
<mapping suffix=".jsp" />
<mapping suffix=".html" /> (add this line)
<mapping suffix=".htm" /> (add this line)
</mappings>
New terms and important words are introduced in a bold-type font. Words that you
see on the screen, in menus or dialog boxes for example, appear in our text like this:
"clicking the Next button moves you to the next screen".
Reader Feedback
Feedback from our readers is always welcome. Let us know what you think about
this book, what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
If there is a book that you need and would like to see us publish, please send
us a note in the SUGGEST A TITLE form on www.packtpub.com or
email [email protected].
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
[]
www.it-ebooks.info
Preface
Customer Support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our contents, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in text or
code—we would be grateful if you would report this to us. By doing this you can
save other readers from frustration, and help to improve subsequent versions of
this book. If you find any errata, report them by visiting http://www.packtpub.
com/support, selecting your book, clicking on the Submit Errata link, and entering
the details of your errata. Once your errata are verified, your submission will be
accepted and the errata are added to the list of existing errata. The existing errata can
be viewed by selecting your title from http://www.packtpub.com/support.
Questions
You can contact us at [email protected] if you are having a problem with
some aspect of the book, and we will do our best to address it.
[]
www.it-ebooks.info
www.it-ebooks.info
Overview
This book is a guide for developers interested in building websites using the
OpenCms content management system. The book is intended for developers
who are familiar with Java, JSP, and building web applications based on the
Java J2EE framework.
In this book, we will develop a website designed for a blog writer. In the course of
building our site, we will go over these topics:
We will go over all the steps involved in building a blog website using OpenCms.
We will start by describing the features and requirements of our website and will
then provide an overview of OpenCms. Next, we will discuss how to create a
development environment. We then will go over the steps involved in creating
structured content types, to hold our site content. After that, we will cover creation
of templates and Java code, to display the content. The site also supports search and
user comments;, so we will cover the Lucene search engine as well to show how to
provide login support. As the site additionally supports RSS clients and feeds, we
will discuss how to add new features to OpenCms.
Before we get into the development details, we will first discuss some of the skills
required to develop sites with OpenCms. This will provide us with a basis
for understanding the environment and tools, which we will need to do our
development work.
www.it-ebooks.info
Overview
[]
www.it-ebooks.info
Chapter 1
• Blogs are listed in descending order of date, with the most recent blog
appearing at the top.
• Each blog entry is listed in teaser style, with a link to the full blog appearing
at the end.
• Blog entries support a list of topics attached to them.
• Archives of previous blogs appear on the righthand side, in
descending order.
• Past blog archives can be browsed.
• The site supports contents search with paginated results.
• Ads may be placed on the righthand side.
• Users may self register for the site.
• Registered users may add comments and create a customized RSS feed on
their homepage.
• Blogs may be viewed in various RSS formats.
[]
www.it-ebooks.info
Overview
There are two additional mockups for the site. The first one shows a detailed view of
a blog. This view is shown when a user clicks on a blog from the homepage:
[ 10 ]
www.it-ebooks.info
Chapter 1
The last mockup shows what the search result screen looks like. Search results are
shown in decreasing order of relevance to the search term. The pagination controls at
the bottom of the page allow for the results to be scrolled, if necessary:
[ 11 ]
www.it-ebooks.info
Overview
Files in the VFS may also be exported to the Real File System (RFS) and served
statically or by a web server. In this way, the website can operate in exactly the same
way it did, prior to being placed into OpenCms, except for the fact that it is now
version controlled. The following illustration shows how OpenCms can be used in
this fashion:
[ 12 ]
www.it-ebooks.info
Chapter 1
For this developer audience, the skill levels will include the following:
Before undertaking this task, we will want to understand the feature and content
requirements of our site in detail. This will allow us to properly design the templates
and custom content types, which our site will need. This is a design exercise which
will not be touched upon in this book. However, we will discuss the specific tasks
required in implementing templates and the custom content types once they have
been designed.
For this type of development, the developer requires first level skills plus:
[ 13 ]
www.it-ebooks.info
Overview
Developing custom features in OpenCms will require the second level skills, plus:
[ 14 ]
www.it-ebooks.info
Another Random Document on
Scribd Without Any Related Topics
THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com