Adobe CQ 5.6 Developer
Adobe CQ 5.6 Developer
Adobe CQ 5.6 Developer
01 - What is CQ 5? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
CQ5 Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
The CQ5 User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
CQ5 Web Consoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Websites Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Digital Assets Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10
Tools Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11
Developer Community . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12
Key Principles Underlying the Design and Implementation of CQ5 . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Standards and Open Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Everything is content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Davids Content Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14
Authoring Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14
Desktop Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14
OSGi and Apache Sling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15
Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15
CQ5 Functional Building Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15
Granite Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16
Architecture Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17
OSGi Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-19
OSGi Bundles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-20
Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-20
Java Content Repository (JCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-20
JCR Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21
Content Services of the JCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-22
Adobe CRX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-22
Built-in Protocols/APIs for the CRX Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-23
Representational State Transfer (REST) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-23
Apache Sling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
Everything is a Resource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
Sling Script Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-25
Sling and MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26
Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26
CQ5 Application Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-26
| iii
iv | iv
07 - Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
ExtJs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
Component Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
EXERCISE 7.1 - Create a Title Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
Extra Credit - Try different xtypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
Extra Credit - Create a List Children Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
Design Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
HTML5 SmartImage Widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
EXERCISE 7.2 - Create a Logo Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
09 - Mobile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
Mobile Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
Mobile Emulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
WURFL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Emulator Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Emulator Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Mobile components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
EXERCISE 9.1 - Create a mobile time component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
Responsive Web Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10
Pros and Cons of responsive web design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-11
Creating Mobile Web Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12
EXERCISE 9.2 - Re-purpose desktop web site content for mobile devices . . . . . . . . . . . . . . . . . 9-12
Extra Credit - Create the Training Emulator Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16
Create the emulator Client Library Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-17
Emulator Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-18
Create the emulator image library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
Adding your Mobile Emulator to a Device Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
Using the Custom Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-22
| v
vi | vi
Disclaimer
Adobe reserves the right to revise this publication from time to time, changing content without notice.
vii
01
What is CQ 5?
Adobe CQ is the foundation of the Adobe Experience Manager solution. It provides digital marketers
with easy-to-use, web-based applications for creating, managing, and delivering personalized online
experiences. Adobe CQ provides out-of-the-box integration with other products in Adobe Marketing
Cloud.
Built atop the industry-leading JSR-283-compliant CRX content repository, CQ5 provides a complete
suite of applications for the Web Experience Management (WEM) of organizations.
With this
software people in your organization can:
Build, author and publish websites, complete with enforcement of corporate design and
user access control of editing and publishing rights.
Compose pages using drag-and-drop methodologies from a rich library of web
components.
Define and implement workflows for the creation, editing and publishing of content.
Manage a repository of digital assets such as images, videos and documents, and integrate
these assets into your website.
Use search queries to find content no matter where it is stored in your organization.
Set up social collaboration tools like blogs, user groups, and calendars.
Organize your digital assets and web pages using tagging.
Chapter 01 | 1-1
Chapter 01
| 1-7
Authoring Interface
CQs web-based interface uses AJAX and other modern browser technologies to enable WYSIWYG
editing and formatting of content by authors right on the web page. The use of Web 2.0 capabilities
produces an intuitive, streamlined (and fun) experience for authors.
Desktop Integration
WebDAV lets you display and edit the repository content. Setting up WebDAV gives you direct
access to the content repository through your desktop. Office and PDF files that are dropped into the
repository through the WebDAV connection are automatically full-text indexed and can be searched
with the standard search interfaces through the standard Java APIs.
CIFS s a Microsoft-based network file sharing system that CRX can use to give you direct access to the
content repository through the desktop. It is similar to WebDAV.
1-14 | Chapter 01
Adobe CRX
CRX implements the Content Repository API for Java Technology (JCR). This standard defines a data
model and application programming interface (that is, a set of commands) for content repositories.
Content is available through a standardized API:
JSR 283
JCR API
Node node.addNode(JCR)
Node node.getNode(JCR)
Node node.setProperty(opinion,excellent and recommended)
Node node.getProperty(opinion).getString()
1-22 | Chapter 01
Chapter 01
| 1-23
Servlets and Scripts are handled uniformly in that they are represented as resources themselves and
are accessible by a resource path. This means, that every script, servlet, filter, error handler, etc. is
available from the ResourceResolver just like normal content providing data to be rendered upon
requests.
Chapter 01
| 1-25
Chapter 1 Notes
1-28 | Chapter 01
Chapter 1 Notes
Chapter 01
| 1-29
02
A Java web application (or web app) is a program that runs on a remote server and is accessed by
users through a web browser. It is usually contrasted with a static website, which is simply a collection
of documents that reside on the server and that can be viewed through a browser, over the web. A
web application, on the other hand, typically assembles the data to be sent back to the browser, on
the fly with each request (or even, using AJAX, between requests). Most modern websites nowadays
are essentially web applications. CQ5 is also a web application, but one that serves as a platform for
building other web applications and managing the content that they deliver.
As a Java web application, CQ5 runs on any server that supports the Java Servlet API . For ease
of installation CQ5 comes bundled as a self extracting Quickstart file that needs only to be double
clicked, in order to install and start the server (see deployment)
Since CQ5 is Java-based it can run on any system for which a Java Runtime Environment is available.
This means, for example, that CQ5 can run on any mainstream operation system, including Windows,
Macintosh, Linux, or other flavors of Unix.
While different instances in different environments are all installations of the same CQ5 software,
installed in different places in the overall system infrastructure, they differ mainly in the way they
are configured. For example, it is that configuration, or run mode, that determines whether a CQ5
instance behaves as an author instance or a publish instance.
What is an Author instance?
Author instances are usually located behind the internal firewall. This is the environment where you,
and your colleagues, will perform authoring tasks, such as:
Administer the web properties
Input your content
Chapter 02
| 2-1
Installing CQ5
Unlike many other applications, you install CQ5 WCM by using a Quickstart self extracting jar file.
When you double-click the jar file for the first time, everything you need is automatically extracted
and installed. The CQ5 quickstart jar file includes all files and repository structures required for:
CRX repository (a fully JCR 2.0 / JSR-283 compliant repository and Apache Sling), virtual
repository services, index and search services, workflow services, security and a Web server.
CQ5 Servlet Engine (CQSE). You can run CQ5 WCM without an application server, but you
need a Servlet Engine. Both CRX, and therefore CQ5 WCM, ship with Days CQSE servlet
engine, which you can use freely and which is fully supported. The first time you start the
jar file, it creates an entire JCR-compliant repository in the background, which may take
several minutes. After this startup is much quicker as the applications have been installed
and the repository already created.
2-2 | Chapter 02
Congratulations! You have successfully logged into CRXDE Lite and have browsed the custom
components created for the Geometrixx Web site/project. Again, CRXDE Lite is embedded into CQ5/
CRX and enables you to perform standard development tasks in a Web browser.
2-30 | Chapter 02
Chapter 2 Notes
Chapter 02
| 2-31
Chapter 2 Notes
2-32 | Chapter 02
You can also add Java API documentation, for CQ5 APIs and your own APIs, to CRXDE. Simply define
the location of the javadocs to CRXDE using the Package Explorer pane.
Component Context
When you develop the JSP script of a CQ5 component, it is required to include the following code at
the top of the script:
<%@include file=/libs/foundation/global.jsp%>
The Adobe provided global.jsp script declares the Sling, CQ5 and JSTL taglibs and exposes the
regularly used scripting objects defined by the,
<cq:defineObjects /> tag.
This shortens and simplifies the JSP code of your component.
The <cq:defineObjects> tag exposes the following, regularly used, scripting objects which can be
referenced by the developer. It also exposes the objects defined by the <sling:defineObjects> tag.
ComponentContext
Component
CurrentDesign
CurrentPage
CurrentNode
CurrentStyle
Designer
3-20 | Chapter 03
Chapter 3 Notes
Chapter 03
| 3-25
Chapter 3 Notes
3-26 | Chapter 03
04
CQ5 is built using Apache Sling, a Web application framework based on REST principles that
provides easy development of content-oriented applications. Sling uses a JCR repository, such as
Apache Jackrabbit or Days CRX, as its data store.
Apache Sling is included in the installation of CQ5. Apache Sling was originally designed and
implemented by Day Software (now Adobe Systems). Sling has since been contributed to the
Apache Software Foundation - further information can be found at Apache (http://sling.apache.com).
Using Apache Sling, the type of content to be rendered is not the first processing consideration.
Instead the main consideration is whether the URL resolves to a content object for which a script
can then be found to perform the rendering. This provides excellent support for Web content
authors to build Pages which are easily customized to their requirements.
The advantages of this flexibility are apparent in applications with a wide range of different content
elements, or when you need Pages that can be easily customized/viewed differently.
Chapter 04 | 4-1
Chapter 4 Notes
Chapter 04
| 4-11
Chapter 4 Notes
4-12 | Chapter 04
05
Chapter 05
| 5-1
Chapter 5 Notes
Chapter 05
| 5-19
Chapter 5 Notes
5-20 | Chapter 05
06
Component Basics
As promised, we will now talk about components that are not page-rendering components. These
components will make up the bulk of the custom components that you will create. In addition to
properties, components have child nodes that help to control the rendering process. In particular, the
following child nodes may be defined for components:
cq:editConfig
cq:childEditConfig
dialog
design_dialog
Chapter 06
| 6-1
Chapter 6 Notes
6-10 | Chapter 02
Chapter 6 Notes
Chapter 06
| 6-11
07
Dialogs
So far, you have focused mostly on rendering content (static and dynamic), which is important as one
could argue that rendering content comprises 50% of what you do as a CQ5 developer.
However, most components that you create will allow the author to input that content. Typically, the
mechanism that authors will use to input content is through a dialog box.
ExtJs
CQs web-based interface uses AJAX and other modern browser technologies to enable WYSIWYG
editing and formatting of content by authors right on the web page.
The widget library used by CQ5, called ExtJS, provides the highly polished user interface elements that
work across all the most important browsers and allow the creation of desktop-grade UI experiences.
The popular ExtJS JavaScript framework gives developers the ability to easily create Rich Internet
Applications (RIA) through the use of AJAX. It includes:
High performance, customizable UI widgets
Well designed and extensible Component model
An intuitive, easy to use API
ExtJs is a cross-browser JavaScript library for building interactive web applications. It supports the
rapid development of high performance, customizable User Interface widgets.
Chapter 07
| 7-1
Chapter 7 Notes
Chapter 07
| 7-17
Chapter 7 Notes
7-18 | Chapter 07
Chapter 8 Notes
Chapter 08
| 8-13
Chapter 8 Notes
8-14 | Chapter 08
09
Mobile
Mobile Functionality
Mobile channels gained considerable importance in the last few years. With CQ you can manage
websites for mobiles devices, view a mobile page in a way that emulates a mobile device or switch
between several views.
CQ enables you to author webpages with an iPad. You can open a page on your iPad with the
embedded Safari browser, move paragraphs around, add pictures, change paragraph titles and once
done with editing you can publish the page.
The CQ5 GO is an iPhone/iPad application available through the App Store that lets you manage your
CQ workflow inbox on the iPhone or an the iPad. With CQ5 GO you can configure several inboxes
accessing several CQ instances. Once the inbox is configured, you can manage the items that are
in your inbox: you can navigate between items, add a comment and complete a step, step back,
delegate the item to a co-worker or view the payload.
Mobile Emulators
CQ5 provides several device emulators that allow you to see how your web contentwill appear on
those mobile devices. The default emulators can be found in the
following location in the repository:
/libs/wcm/mobile/components/emulators
Chapter 09
| 9-1
If the emulator supports specific functionalities defined by plugins (like touch scrolling), create a
configuration node below the emulator:name = cq:emulatorConfig, node type = nt:unstructured and
add the property that defines the plugin. For example, to support Rotation:
Name = canRotate
Type = Boolean
Value = true
To support Touch Scrolling:
Name = touchScrolling
Type = Boolean
Value = true
More functionalities can be added by defining your own plugins.
Mobile components
Creating mobile components is done actually in a very similar way than creating regular components.
The only difference between a regular component and a mobile component is that the component
needs to be aware if the emulator that is used to display the page is able to handle the kind of content
that he needs to display. For that we have to main classes that come quite handy every time that we
are developing mobile components.
com.day.cq.wcm.mobile.core.MobileUtil
com.day.cq.wcm.mobile.api.device.capability.DeviceCapability
The class MobileUtil provides you with the following methods
Chapter 09
| 9-5
Responsive web design is an approach to web design aimed at implementing sites that provide an
optimal viewing experience for all web site visitors:
easy reading and access to content
clear and easy navigation
minimum of resizing, panning, and scrolling across a wide range of devices (desktop and
mobile) with varying
screen sizes
memory capacity
network speeds
CPU speeds
Responsive web design is not a single piece of technology, but rather, a collection of techniques and
ideas that allow the site to identify and then respond to the browsing environment or device through
which they are being viewed. The three tenets of responsive Web design are:
fluid grids
9-10 | Chapter 09
flexible images
CSS3 media inquiries to detect screen resolution
Responsive web design is one of many powerful strategies, but may not be the right solution for your
web property. Therefore, a business should not instantly drop plans for a mobile website in favor of
the responsive web design route.
Every website has particular, defined objectives. It is important to approach the issue of multi-device
experience from a strategic standpoint to ensure that your web goals are met.
Responsive Web design works well for sites where users consume content. But it doesnt work well
when you want your customer to interact with the content. Purchasing applications are complex.
Many banks and other businesses that offer mobile apps to sell their products and services dont use
responsive web design because of limitations on the types of things you can do on the website. A
popular example is a mobile banking app that allows you to deposit a check by taking a picture of it.
The application that creates the deposit from a picture functionality is complicated and often cant
fit into a grid layout.
Cons
Hard to get a natural look and feel for desktop devices without messy customization
Type is often still too small for smartphone users, resulting in pinching and zooming
Download times when browsing over a mobile network can be quite long
Older devices, without CSS3 support, would still be served with the normal desktop
website
User journey for mobile users is typically very different than desktop users, especially in
retail scenarios. Mobile users would probably want to get right to the end of the journey,
whereas desktop users are happier to browse more.
Challenges
getting navigation right for smartphones
Chapter 09
| 9-11
Name = canRotate
Type = Boolean
Value = true
Name = touchScrolling
Type = Boolean
Value = true
http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/wcm/emulator/Emulator.html
In our case we are going to create an emulator close to the Blackberry so we dont need any of these
definitions, but you should take a look at the cq:emulatorConfig node of the Android emulator.
Chapter 09
| 9-19
Chapter 9 Notes
9-24 | Chapter 09
Chapter 9 Notes
Chapter 09
| 9-25
10
cq:EditConfig
We introduced the cq:EditConfig construct earlier when we talked about Component child nodes.
Now we will explore the cq:EditConfig functionality in more detail.
cq:EditConfig is used to configure content input actions when the dialog box is not in control. For
example:
Drag-and-drop from the Content Finder
In-line Editing
Refresh of a dialog box or page after an author action
To demonstrate functionality of cq:EditConfig, we will use drag-and-drop from the Content Finder
as an example. To drag assets from the Content Finder to a component, the following are required:
Node of type cq:editConfig that is a child node to the cq:component node
Chapter 10
| 10-1
Chapter 10 Notes
10-32 | Chapter 10
Chapter 10 Notes
Chapter 10
| 10-33
11
Advanced Concepts
Chapter 11
| 11-1
Is made of WorkflowNodes and WorkflowTransitions. The transitions connect the nodes and define
the flow. The Model has always a start node and an end node. Workflow models are versioned.
Running Workflow Instances keep the initial workflow model version that is set when the workflow
is started.
Step
All the steps share the following common properties: AutoAdvance and Timeout alerts (scriptable).
Transition
Defines the link between two consecutive steps. It is possible to apply rules to the Transition.
WorkItem
The workItem is the there is a task identifier and is put into the respective inbox. A workflow
instance can have one or many WorkItems at the same time (depending on the workflow model).
The WorkItem references the workflow instance. In the repository the WorkItem is stored below the
workflow instance.
Payload
References the resource that has to be advanced through a workflow. The payload implementation
references a resource in the repository (by either a path or an UUID) or a resource by a URL or by a
serialized java object. Referencing a resource in the repository is very flexible and in conjunction with
sling very productive: for example the referenced node could be rendered as a form.
Lifecycle
Is created when starting a new workflow (by choosing the respective workflow model and defining
the payload) and ends when the end node is processed. The following actions are possible on a workflow instance:
Terminate
Suspend
Resume
11-10 | Chapter 11
Restart
Inbox
Each logged in user has its own workflow inbox in which the assigned WorkItems are accessible. The
WorkItems are assigned either to the user itself or to the group to which he belongs.
Workflow Console
The Workflow console is the centralized location for workflow management in CQ5. It can be accessed
via the Workflows button on the Welcome page or through the Workflows button in the toolbar on
any CQ5 console (for example: Websites, Tools, Tagging).
Within the console there are 4 tabs:
Models
Lists the workflow models currently available. Here you can create, edit or delete workflow mode
Instances
Shows you details of workflow instances which are currently active. These instances are also version dependent.
Archive
Enables you to access details of workflow instances which have terminated, for whatever reason.
Launcher
Allows you to define a workflow to be launched if a specific node has been updated.
Starting a Workflow
There are four methods of manually starting a workflow:
Workflow Console
SiteAdmin Console (Websites tab)
Right Context Menu
Workflow item in Toolbar
Sidekick
Chapter 11
| 11-11
Chapter 11 Notes
Chapter 11
| 11-23
Chapter 11 Notes
11-24 | Chapter 11
12
Chapter 12
| 12-1
Author Environment
This environment is used by authors entering, and updating content, so it must cater for a small
number of users who each generate a high number of performance intensive requests when updating
content pages and the individual elements on those pages.
Publish Environment
This environment contains content which you make available to your users, where the number of
requests is even greater and the speed is just as vital, but since the nature of the requests is less
dynamic, additional performance enhancing mechanisms can be leveraged, such as that the content
is cached or load-balancing is applied.
Performance Optimization Methodology
A performance optimization methodology for CQ5 projects can be summed up to five very simple
rules that can be followed to avoid performance issues from the start. These rules, to a large degree,
apply to Web projects in general, and are relevant to project managers and system administrators to
ensure that their projects will not face performance challenges when launch time comes.
Planning for Optimization
Around 10% of the project effort should be planned for the performance optimization phase. Of
course, the actual performance optimization requirements will depend on the level of complexity
of a project and the experience of the development team. While your project may ultimately not
require all of the allocated time, it is good practice to always plan for performance optimization in
that suggested range.
Whenever possible, a project should first be soft-launched to a limited audience in order to gather
real-life experience and perform further optimizations, without the additional pressure that follows
a full announcement. Once you are live, performance optimization is not over. This is the point
in time when you experience the real load on your system. It is important to plan for additional
adjustments after the launch.
Since your system load changes and the performance profiles of your system shifts over time, a
performance tune-up or health-check should be scheduled at 6-12 months intervals.
Simulate Reality
If you go live with a Web site and you find out after the launch that you run into performance issues
there is only one reason for that: Your load and performance tests did not simulate reality close
enough.
Simulating reality is difficult and how much effort you will reasonably want to invest into getting
real depends on the nature of your project. Real means not just real code and real traffic,
but also real content, especially regarding content size and structure. Keep in mind that your
templates may behave completely different depending on the size and structure of the repository.
Establish Solid Goals
The importance of properly establishing performance goals is not to be underestimated. Often, once
people are focused on specific performance goals, it is very hard to change these goals afterwards,
even if they are based on wild assumptions.
Establishing good, solid performance goals is really one of the trickiest areas. It is often best to
collect real life logs and benchmarks from a comparable Web site (for example the new Web sites
predecessor).
12-10 | Chapter 12
Stay Relevant
It is important to optimize one bottleneck at a time. If you do things in parallel without validating the
impact of the one optimization, you will lose track of which optimization measure actually helped.
Agile Iteration Cycles
Performance tuning is an iterative process that involves, measuring, analysis, optimization and
validation until the goal is reached. In order to properly take this aspect into account, implement an
agile validation process in the optimization phase rather than a more heavy-weight testing process
after each iteration.
This largely means that the developer implementing the optimization should have a quick way to tell
if the optimization has already reached the goal, which is valuable information, because when the
goal is reached, optimization is over.
Basic Performance Guidelines
Generally speaking, keep your uncached html requests to less than 100ms. More
specifically, the following may serve as a guideline:
70% of the requests for pages should be responded to in less than 100ms.
25% of the requests for pages should get a response within 100ms-300ms.
4% of the requests for pages should get a response within 300ms-500ms.
1% of the requests for pages should get a response within 500ms-1000ms.
No pages should respond slower than 1 second.
The above numbers assume the following conditions:
measured on publish (no authoring environment and/or CFC overhead)
measured on the server (no network overhead)
not cached (no CQ5-output cache, no Dispatcher cache)
only for complex items with many dependencies (HTML, JS, PDF, ...)
no other load on the system
There are a certain number of issues that frequently contribute to performance issues which mainly
revolve around (a) dispatcher caching inefficiency and (b) the use of queries in normal display
templates. JVM and OS level tuning usually do not lead to big leaps in performance and should
therefore be performed at the very tail end of the optimization cycle. Your best friends during a usual
performance optimization exercise are the request. log, component based timing, and last but not
least - a Java profiler.
Chapter 12
| 12-11
Chapter 12 Notes
Chapter 12
| 12-17
Chapter 12 Notes
12-18 | Chapter 12