Cq5 Guide Architect
Cq5 Guide Architect
Cq5 Guide Architect
Contents
1. Introduction ........................................................................................................................ 1 1.1. Introduction ............................................................................................................. 1 1.2. Purpose of this Document ........................................................................................ 1 1.3. Target Audience ...................................................................................................... 1 2. CQ - The Concepts ............................................................................................................ 2 2.1. An Overview of CQ5 ............................................................................................... 2 2.2. The Technology Stack that CQ5 is based on ............................................................ 3 2.3. Inside CQ5 .............................................................................................................. 4 3. CQ5 - The Physical Architecture ......................................................................................... 6 3.1. Server Startup Sequence ......................................................................................... 6 3.2. CQ WCM Environments and how they interact .......................................................... 6 3.2.1. Author and Publish Environments .................................................................. 6 3.2.2. Environment levels used within the full development cycle ............................... 8 3.3. Performance and Availability .................................................................................... 9 3.3.1. Caching ........................................................................................................ 9 3.3.2. Load Balancing ............................................................................................. 9 3.3.3. High availability CQ5 ................................................................................... 10 4. Accessing CQ .................................................................................................................. 11 4.1. Authentication and Authorization ............................................................................. 11 4.1.1. Authentication ............................................................................................. 11 4.1.2. Authorization ............................................................................................... 11 4.2. CQ and the Web Accessibility Guidelines ................................................................ 12 5. Data Modelling ................................................................................................................. 13 5.1. Data Modeling - David Nuescheler's Model ............................................................. 13 5.1.1. Source ....................................................................................................... 13 5.1.2. Introduction from David ............................................................................... 13 5.1.3. Seven Simple Rules .................................................................................... 13 A. Copyright, Licenses and Formatting Conventions ............................................................... 19 A.1. Formatting Conventions ......................................................................................... 19
Page iii of 19
1 Introduction
1.1 Introduction
Day Management AG's CQ5 platform allows you to build compelling content-centric applications that combine Web Content Management, Workflow Management, Digital Asset Management and Social Collaboration. The product has been completely redesigned from Communiqu 4, allowing Day Management AG to use new architecture and technologies, thus increasing functionality while reducing complexity. Extensive use of standards helps reduce project risk, and protect your investment in the long-term. The Graphical User Interface has been completely re-engineered using AJAX and the latest browser technologies. This leads to an unparalleled user experience. With the help of the Apache Sling framework (a core part of the CQ5 platform) it becomes fast and efficient to develop contentenabled vertical applications (CEVA) that are both JCR-based and REST-style. The Java Content Repository (JCR) is fully leveraged with many important features; including search, versioning, access control and observation. The CQ5 architecture allows the move to a Data First philosophy as: structure Is an expensive overhead for the underlying storage, any data structure is (mostly) irrelevant see Chapter 5, This vastly improves flexibility and efficiency. All these changes ensure that CQ: is easily scalable is highly reliable makes it easier to reuse, or extend, elements is faster allows for rapid development is already feature-rich when taken straight out-of-the-box
Page 1 of 19
2 CQ - The Concepts
2.1 An Overview of CQ5
The following diagram illustrates the interrelationship between CQ and other operational elements; which may be products from Day Management AG, or their third-party equivalents:
Servlet Engine The Servlet Engine acts as the server within which each CQ (and CRX if used) instance runs as a web application. Any Servlet Engine supporting the Servlet API 2.4 can be used. Java Content Repository (JCR) A Java Content Repository uses the JSR-170 API to access the content repository using Java, independent of the physical implementation. JCR is the Java Content Repository standard, also known as JSR-170 after its Java Specification Request. A repository effectively consists of two parts: A Web application that offers the JSR-170 compliant API and temporary data storage (in the form of the session). A Persistence Manager with persistent data storage, such as the file system or a database. Content Repository Extreme (CRX) is Day Management AG's own repository product. See the CRX documentation for more details; including direct access using WebDAV, CIFS, File Vault etc. CQ5 The common foundation of the CQ5 platform provides a basis for the interoperability and seamless integration of all CQ applications. This is available to both: the applications that are integral to CQ itself any customized applications developed for the CQ5 platform. CQ WCM (Web Content Management) is the first application developed to exploit the advantages of CQ5, other Day products will be migrated in the near future (although they already interact with CQ WCM). These include Digital Asset Management (CQ DAM) and Social Collaboration.
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 2 of 19
CQ - The Concepts
Apache Sling Apache Sling is a web application framework for content-centric applications, using a Java Content Repository, such as Apache Jackrabbit or CRX, to store and manage content. Sling: is based on REST principles to provide easy development of content-oriented applications. is embedded within CQ5. is used to process HTTP rendering and data-storage requests which assemble, render and send the content to a client (i.e. the new delivery). maps Content objects to Components (which render them and process incoming data). comes with both server-side and AJAX scripting support. can be used with a range of scripting languages, including JSP, ESP and Ruby. started as an internal project of Day Management AG . has been contributed to the Apache Software Foundation. Note See http://incubator.apache.org/projects/sling.html for more information. OSGi (Apache Felix) CQ5 is built within an application framework which is based on the OSGi Service Platform Release 4. OSGi technology is the dynamic module system for Java. comes under the classification Universal Middleware. provides the standardized primitives that allow applications to be constructed from small, reusable and collaborative components. These components can be composed into an application and deployed.
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 3 of 19
CQ - The Concepts
OSGi bundles can contain compiled Java code, scripts, content that is to be loaded in the repository, and configuration or additional files, as needed. allows the bundles to be loaded, and installed, during normal operations. In the case of CQ5, this is managed by the Sling Management Console. Apache Felix has been used to implement this framework. Apache Felix is a open-source project to implement the OSGi R4 Service Platform, which includes the OSGi framework and standard services, as well as providing and supporting other interesting OSGi-related technologies. Java Content Repository (JSR-170 API) A JCR uses the JSR-170 API to access the content repository using Java, independent of the physical implementation.
CQ WCM Web Content Management within the CQ5 platform allows you to generate and publish pages to your website.. CQ Workflow Engine The CQ Workflow Engine is a powerful and easy to use process engine that can be used by all applications running on the CQ5 platform. A Java API and RESTful HTTP interface is also provided for access by applications outside CQ5. Within CQ WCM workflows can be used to control the process of generating and publishing content, which are often subject to organizational processes, including steps such as approval and sign-off by various participants. CQ Components Components provide the logic (code) to render content. They include both templates and specific components such as Text with Image, Column Control and Subtitle amongst others. Components are based on a combination of widgets, replacing the CFC from Communiqu 4.
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 4 of 19
CQ - The Concepts
CQ Widgets Widgets are the basic elements used to implement a specific user function, often the editing of a piece of content; they include buttons, radio-boxes, dialogs, etc. Apache Sling The Component Framework (Sling) provides the underlying mechanisms for rendering content.
Page 5 of 19
Page 6 of 19
Note This diagram covers a range of possible configurations, with multiple environments of either sort. Depending on your configuration, each author environment can propagate content to one, or more, publish environments. Author This is the environment where you and your colleagues will: administrate the entire system input your content configure the layout and design of your content activate your content to the publish environment It is accessed using the siteadmin. Access to the content and functionality is controlled by authorization permissions assigned to your user account. Publish This holds the content which you have made available to visitors to your website. The content is dynamic, real-time and can be personalized for each individual user. Static Web Server For performance optimization it is possible to convert your dynamically published content (excluding any personalized parts) to static HTML, serviced by a static web server. Static web servers are very simple, but fast. Examples include Apache, and IIS. The Dispatcher can then be used in conjunction with the web server to realize an environment that is both fast and dynamic and with moderate hardware requirements. Dispatcher The Dispatcher helps realize an environment that is both fast and dynamic. It works as part of a static HTML server, such as Apache, with the aim of: storing (or "caching") as much of the site content as is possible, in the form of a static website. accessing the layout engine to retrieve dynamic content as and when necessary, but as little as possible. Which means that: static content is handled with exactly the same speed and ease as on a static web server; additionally you can use the administration and security tools available for your static web server(s).
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 7 of 19
dynamic content is generated as needed, without slowing the system down any more than absolutely necessary. The Dispatcher contains mechanisms to generate, and update, static HTML based on the content of the dynamic site. You can specify in detail which documents are stored as static files and which are always generated dynamically.
Note Multiple instances of each environment level can exist. Development Prior to authors registering their content in CQ WCM, the developers are responsible for developing and customizing the proposed website. They: develop and customize components realize the design within the website develop the necessary scripts to implement the required functionality of the website The major development tools used are: an Integrated Development Environment. Day provides an Eclipse-based development environment, CQDE (the Communiqu Development Environment). It is also possible to use other IDEs, such as Eclipse or IntelliJ, for which plug-ins have developed to simplify their use for CQ and to integrate them with the repository. a method of direct access to the Java Content Repository. In the case of CRX, the Content Explorer, Content Loader and other in-built tools are used. WebDAV or CIFS, which simplify access to the repository. Depending on the scale of your system, the development environment can have both author and publish environments, or the test environment will be used for such functionality.
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 8 of 19
Test After development, it is usual to have a Testing environment where you can access the new system, to test both design and functionality. This will often comprise of both an author and publish environment. Day provides a basis for automated GUI tests, together with some reference test scripts. Live / Production As discussed previously, the Live (or Production) environment comprises both: an authoring environment for the input of content a publish environment for content made available to visitors to the website
Page 9 of 19
You gain: Increased processing power In practice this means that the Dispatcher shares document requests between several web servers. Because each server now has fewer documents to process, you have faster response times. The Dispatcher keeps internal statistics for each document category, so it can estimate the server load and distribute the queries efficiently. Increased fail-safe coverage If the Dispatcher does not receive responses from a web server, it will automatically relay requests to the other server(s). Thus, if a server becomes unavailable, the only effect is a slowdown of the site, proportionate to the computational power lost. However, all services will continue. Increased flexibility You can also manage different websites on the same static web server.
For information on setting up a high-availability CRX solution, please refer to the CRX Configuration Guide
Page 10 of 19
4 Accessing CQ
4.1 Authentication and Authorization
4.1.1 Authentication
Authentication is the process of identifying, and verifying, a user. The process of authentication and login can be broken down as follows: 1. Authentication information is extracted from the request. In CQ this is done by an authentication handler. 2. The authentication information is then checked to determine whether it is sufficient and/or correct. In CQ this is performed by the login modules. 3. The appropriate response is initiated. For CQ, initial authentication uses a standard HTML-login form in conjunction with the Authorization Header Authentication Handler. The HTML-form must have fields for the user name and password (the same field names must then be used by the Authorization Header Authentication Handler). You can also use a similar form for controlled access to various areas of your website.
4.1.2 Authorization
Authorization determines whether a user is allowed to take action on specific areas within the system. For example, a user can be authorized to read or update a specific page. Authorization is managed using a series of entities: User A user accesses a system using their user account. A user models either a human user or an external system connected to the system. The user account holds the details needed for accessing CQ; a key purpose of an account is to provide the information for the authentication and login processes - allowing a user to log in. Groups A group is a collection of users and/or other groups. A change in the permissions/privileges assigned to a group is automatically applied to all users in that group. A user does not have to belong to any group, but often belongs to several. Action Actions are performed on a resource. For example, a user can read, edit or delete a page, amongst other actions. Permissions A permission allows a user to perform an action on a given resource within the repository. Permissions are stored, and can be seen, at resource level within the repository.
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 11 of 19
Accessing CQ
Privileges Privileges allow access to functionality available within the application; for example, replication of a specific path, or the ability to update the page hierarchy (including creating new pages). Resources Resources define the functionality to be accessed.
Page 12 of 19
5 Data Modelling
5.1 Data Modeling - David Nuescheler's Model
5.1.1 Source
The following details are ideas and comments expressed by David Nuescheler. David is co-founder and CTO of Day Software AG, a leading provider of global content management and content infrastructure software. He also leads the development of JSR-170, the Java Content Repository (JCR) application programming interface (API), the technology standard for content management. Further updates can also be seen on http://wiki.apache.org/jackrabbit/DavidsModel.
5.1.3 Seven Simple Rules 5.1.3.1 Rule #1: Data First, Structure Later. Maybe.
5.1.3.1.1 Explanation
I recommend not to worry about a declared data structure in an ERD sense. Initially. Learn to love nt:unstructured (& friends) in development. I think Stefano pretty much sums this one up. My bottom-line: Structure is expensive and in many cases it is entirely unnecessary to explicitly declare structure to the underlying storage. There is an implicit contract about structure that your application inherently uses. Let's say I store the modification date of a blog post in a lastModified property. My App will automatically know to read the modification date from that same property again, there is really no need to declare that explicitly. Further data constraints like mandatory or type and value constraints should only be applied where required for data integrity reasons.
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 13 of 19
Data Modelling
5.1.3.1.2 Example
The above example of using a "lastModified" Date property on for example "blog post" node, really does not mean that there is a need for a special nodetype. I would definitely use "nt:unstructured" for my blog post nodes at least initially. Since in my blogging application all I am going to do is to display the lastModified date anyway (possibly "order by" it) I barely care if it is a Date at all. Since I implicitly trust my blog-writing application to put a "date" there anyway, there really is no need to declare the presence of a "lastModified" date in the form a of nodetype.
5.1.3.1.3 Discussion
http://www.nabble.com/DM-Rule-#1:-Data-First,-Structure-Later.-Maybe.-tf4039967.html
5.1.3.2 Rule #2: Drive the content hierarchy, don't let it happen.
5.1.3.2.1 Explanation
The content hierarchy is a very valuable asset. So don't just let it happen, design it. If you don't have a "good", human-readable name for a node, that's probably that you should reconsider. Arbitrary numbers are hardly ever a "good name". While it may be extremely easy to quickly put an existing relational model into a hierarchical model, one should put some thought in that process. In my experience if one thinks of access control and containment usually good drivers for the content hierarchy. Think of it as if it was your file system. Maybe even use files and folders to model it on your local disk. Personally I prefer hierarchy conventions over the nodetyping system in a lot of cases initially, and introduce the typing later.
5.1.3.2.2 Example
I would model a simple blogging system as follows. Please note that initially I don't even care about the respective nodetypes that I use at this point.
/content/myblog /content/myblog/posts /content/myblog/posts/what_i_learned_today /content/myblog/posts/iphone_shipping /content/myblog/comments/iphone_shipping/i_like_it_too /content/myblog/comments/iphone_shipping/i_like_it_too/i_hate_it
I think one of the things that become apparent is that we all understand the structure of the content based on the example without any further explanations. What may be unexpected initially is why I wouldn't store the "comments" with the "post", which is due to access control which I would like to be applied in a reasonably hierarchical way. Using the above content model I can easily allow the "anonymous" user to "create" comments, but keep the anonymous user on a read-only basis for the rest of the workspace.
5.1.3.2.3 Discussion
http://www.nabble.com/DM-Rule-#2:-Drive-the-content-hierarchy,-don't-let-it-happen.tf4039994.html
5.1.3.3 Rule #3: Workspaces are for clone(), merge() and update().
5.1.3.3.1 Explanation
If you don't use clone(), merge() or update() methods in your application a single workspace is probably the way to go.
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 14 of 19
Data Modelling
"Corresponding nodes" is a concept defined in the JCR spec. Essentially, it boils down to nodes that represent the same content, in different so-called workspaces. JCR introduces the very abstract concept of Workspaces which leaves a lot of developers unclear on what to do with them. I would like to propose to put your use of workspaces to the following to test. If you have a considerable overlap of "corresponding" nodes (essentially the nodes with the same UUID) in multiple workspaces you probably put workspaces to good use. If there is no overlap of nodes with the same UUID you are probably abusing workspaces. Workspaces should not be used for access control. Visibility of content for a particular group of users is not a good argument to separate things into different workspaces. JCR features "Access Control" in the content repository to provide for that. Workspaces are the boundary for references and query.
5.1.3.3.2 Example
Use workspaces for things like: v1.2 of your project vs. a v1.3 of your project a "development", "QA" and a "published" state of content Do not use workspaces for things like: user home directories distinct content for different target audiences like public, private, local, ... mail-inboxes for different users
5.1.3.3.3 Discussion
http://www.nabble.com/DM-Rule-#3:-Workspaces-are-for-corresponding-nodes.-tf4040010.html
5.1.3.4.2 Example
Use
/content/myblog/posts/what_i_learned_today /content/myblog/posts/iphone_shipping
instead of
CQ 5.1 WCM Copyright 1993-2008 Day Management AG
Page 15 of 19
Data Modelling
/content/blog[1]/post[1] /content/blog[1]/post[2]
5.1.3.4.3 Discussion
http://www.nabble.com/DM-Rule-#4:-Beware-of-Same-Name-Siblings.-tf4040024.html
5.1.3.5.2 Example
Let's assume I allow "references" from a document (a) to another document (b). If I model this relation using reference properties this means that the two documents are linked on a repository level. I cannot export/import document (a) individually, since the reference property's target may not exist. Other operations like merge, update, restore or clone are affected as well. So I would either model those references as "weak-references" (in JCR v1.0 his essentially boils down to string properties that contain the uuid of the target node) or simply use a path. Sometimes the path is more meaningful to begin with. I think there are use cases where a system really can't work if a reference is dangling, but I just can't come up with a good "real" yet simple example from my direct experience.
5.1.3.5.3 Discussion
http://www.nabble.com/DM-Rule-#5:-References-considered-harmful.-tf4040042.html
5.1.3.6.2 Example
Let's assume that someone would like to upload an image to a blog entry at:
/content/myblog/posts/iphone_shipping
Page 16 of 19
Data Modelling
and maybe the initial gut reaction would be to add a binary property containing the picture. While there certainly are good use cases to use just a binary property (let's say the name is irrelevant and the mime-type is implicit) in this case I would recommend the following structure for my blog example.
/content/myblog/posts/iphone_shipping/attachments [nt:folder] /content/myblog/posts/iphone_shipping/attachments/front.jpg [nt:file] /content/myblog/posts/iphone_shipping/attachments/front.jpg/jcr:content [nt:resource]
5.1.3.6.3 Discussion
http://www.nabble.com/DM-Rule-#6:-Files-are-Files-are-Files.-tf4040063.html
5.1.3.7.2 Example
use:
/content/myblog/posts/iphone_shipping/attachments/front.jpg
instead of:
[Blog] - blogId - author [Post] - postId - blogId - title - text - date [Attachment] - attachmentId - postId - filename
Page 17 of 19
Data Modelling
+ resource (nt:resource)
5.1.3.7.3 Discussion
http://www.nabble.com/DM-Rule-#7:-IDs-are-evil.-tf4040076.html
Page 18 of 19
Link
Code
Link to anchor-points within the current document and/or external sources. Example of programming code. Example of text, or commands, that you type. Example of variable text - you type the actual value needed. An optional parameter. Logging and error messages.
ls *.xml
ls <cq-installation-dir>
ls [<option>] [<filename>]
Page 19 of 19