Interview Questions

1) What is CQ5? Why Content Management System is Reqiured?Advantages of CQ5 over other CMS?

CQ5 is a java based content management system from adobe, previously Day CQ5

1)        It is based on a content repository(i.e it uses a content repository to store the content of a website) and use JCR(java content repository) specification to access the content repository.

2)        It uses RESTfulApache Sling framework to map request url to the corresponding node in content repository

3)        It uses powerful OSGi framework internally to allow modular application development. It means  individual pieces of your application(called bundles in terms of OSGi) can be independently started and stopped. CQ5 uses

Apache Felix as the OSGi container. Therefore different parts of cq5 can be independently started and stopped.

 why a content management system is required? Some websites are very dynamic in nature, content needs to be updated frequently, so it is easier to manage the content of such websites using a CMS.

Advantages of CQ5 over other CMS:

  • Implementation of workflows for creating, editing and publishing of content
  • Managing a repository of digital assets like images, documents and integrating them to the websites.
  • Usage of search queries to find content no matter where it is stored in your organization.
  • Setting up easily the social collaboration blogs, groups.
  • Tagging utility to organize the digital assets such as images.

2)    What is the technology stack of cq5?

Cq5 uses the following technologies :

1)    JCR – java specification for accessing a content repository  JSR-283 specification jcr 2.0 , cq5 uses its own implementation of jcr called CRX. Apache Jackrabbit is an open-source implementation of jcr 2.0 specification.

2)    Apache Sling – RESTful framework to access a jcr over http protocol. It maps the request url to the node in jcr.

3)    OSGi(Apache Felix) – framework for modular application development using java. Each module called bundle can be independently started and stopped.OSGi container which provides implemention classes for OSGi framework.

Architecture_TechnologyStack

Cick for Detail Study

3)    What is a content repository? What is JCR?

A Content repository is basically a place where digital content is stored. Generally the structure of the content repository is hierarchial and represented as a tree structure where each node of the tree is used to store content.

Java Content Repository is a specification provided by the java community to access the content repository in a uniform way (platform independent and vendor independent way). The specification was initially released as JSR-170(JCR 1.0) and then later revised version 2 as (JCR-283).The javax.jcr API provides the various classes and interfaces to access a content repository.

 Video Tutorial on  Java Content Repository

4) What is Sling? How is it different from other web-development frameworks? 

Apache Sling is RESTful framework to access a java content repository over http protocol.

It is a content driven framework that is it maps the incoming user request based on URI to the corresponding node in the content repository and depending on the type of the request(GET,POST, etc) executes the corresponding dynamic script.

For example –  consider a scenario where a user is hitting a US website products page and getting the details of product1.

The incoming URL request from user will be

http://www.mywebsite.com/products/product1.html

This would be mapped by the sling resource resolver to a node in the JCR

/content/mywebsite/us/products/product1

5) What is REST? What is a RESTful Framework?

REST stands for Representational State Transfer.REST-style architectures consist of clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses. Requests and responses are built around the transfer of representations of resources. A resource can be essentially any coherent and meaningful concept that may be addressed. A representation of a resource is typically a document that captures the current or intended state of a resource.
Apache Sling is RESTful framework to access a java content repository over http protocol.

6) How is resource resolution done in Sling?

 

The below images tells us how a URL is resolved and mapped to a resource.

https://adobecq5interviewquestions.wordpress.com/wp-content/uploads/2013/11/sling.gif?w=640

Consider the URL

GET – http://www.mywebsite.com/products/product1.printable.a4.html/a/b?x=12

Here the type of request will be HTTP GET request

We can break it down into its composite parts:

protocol host content path selector(s) extension suffix param(s)
http:// myhost products/product1 .printable.a4. html / a/b ? x=12

From URL to Content and Scripts

Using these principles:
• the mapping uses the content path extracted from the request to locate the resource
• when the appropriate resource is located, the sling resource type is extracted, and used to locate the script to be used for rendering the content

The figure below illustrates the mechanism used, which will be discussed in more detail in the following sections.

sling_decomposition
https://adobecq5interviewquestions.wordpress.com/wp-content/uploads/2013/11/sling_decomposition.png?w=640
Mapping requests to resources
The request is broken down and the necessary information extracted. The repository is searched for the requested resource (content node):
• first Sling checks whether a node exists at the location specified in the request; e.g. ../
content/corporate/jobs/developer.html
• if no node is found, the extension is dropped and the search repeated; e.g. ../content/
corporate/jobs/developer
• if no node is found then Sling will return the http code 404 (Not Found).

Note:Sling also allows things other than JCR nodes to be resources, but this is an advanced
feature.

Locating the script

When the appropriate resource (content node) is located, the sling resource type is extracted. This is a path, which locates the script to be used for rendering the content.
The path specified by the sling:resourceType can be either:
• absolute
• relative, to a configuration paramete

7) What is OSGi? What is the benefit of OSGi? What is Felix?

OSGi is a framework which allows modular development of applications using java.
A large application can be constructed using     small reusable components(called bundles in terms of OSGi) each of which can be independently started, stopped, and also can be configured dynamically while running without requiring a restart.

Consider a scenario where you have a large application which uses a logging framework. This logging framework can be deployed as an OSGi Bundle, which can be managed independently. Therefore, it can be started when required by our application and can be stopped when not in use. Also the OSGi container makes these bundles available as services, which can be subsribed by other parts of application.

The main advantages of using OSGi :

1)    reduces the complexity of the system.
2)    Makes the components loosely couples and easy to manage.
3)    Increases the performance of the system, since parts of application which are not in use,need not to be loaded in the memory(although there is not a drastic change in performance and also some people argue that running an OSGi container itself takes huge memory).

8)    What is the role of Dispatcher in CQ5?

Dispatcher is a CQ5 tool for caching and load-balancing. It has 2 responsibilities.
1)    Caching – To cache as much content as possible, so that it doesnt need to access layout engine frequently for generating content dynamically.
2)    Load-balancing – To increase the performance by load-balancing.

9)    What is Replication in CQ5?

1)    Publish (activate) content from author to publish environment.
2)    Explicitly flush content from the dispatcher cache.
3)    Return user input from the publish environment to the author environment.

REPLICATION PROCESS:
1)    First, the author requests that certain content to be published (activated).
2)    The request is passed to the appropriate default replication agent.
3)    Replication agent packages the content and places it in the replication queue.
4)    the content is lifted from the queue and transported to the publish environment using the   configured protocol.
5)    a servlet in the publish environment receives the request and publishes the received content, the default servlet is http://localhost:4502/bin/receive.

10)    What is Reverse Replication?
Reverse replication is used to get user content generated on a publish instance back to the author instance. To do this you need a reverse replication agent in the author environment. This act as the active component to collect information from the outbox in the publish environment.

11)   Difference between Dialog and Design Dialog?Dialog is a key element of your component as they provide an interface for authors to configure and provide input to that component. The user input will be stored at page level.
Design dialog will share the content at the template level. Also we can dynamically change the content in design mode.
12) Difference between Parsys and Iparsys?

Parsys is a placeholder where we can drag and drop the component and the script (or content) inside the component will be rendered to that place.
Iparsys or Inherited Paragraph System is similar to parsys except it allows you to inherit the created paragraphs from the parent.


1
3)  Explain OSGi[Open Systems Gateway initiative] in CQ5 ?

• Dynamic module system for Java.
• Universal Middleware Category.
• Helps applications to be constructed from small, reusable and collaborative components.
• OSGi bundles can contain compiled Java code, scripts, or any contents to be loaded in the repository.
• Helps the bundles to be loaded, installed.

14) How bundles are loaded and installed in CQ5?
This is managed by the Sling Management Console of CQ5.

15) How clustering is done in CQ5?

CQ5 CRX is pre-loaded to run within a cluster,even when running a single instance. Hence the configuration of multi-node clusters with little effort happens in CQ5.

16)  What is the contribution of Servlet Engine in CQ5?

Servlet Engine pretends as a server within which each CQ (and CRX if used) instance runs. Eventhough you can run CQ WCM without an application server, always a Servlet Engine is needed.

17) Explain the role of Dispatcher in CQ5?

In CQ5 Dispatcher helps to cache and load-balance. The main responsibilities are,

i)    Caching – Cache as much content as possible[ It helps to reduce the continuous functioning of layout engine frequently for generating content when in dynamic.

ii)   Load-balancing – To increase the performance by load-balancing.

17) State various strategies used by Dispatcher?

i)    Cache as much content as possible as static pages.
ii)   Accessing layout engine as little as possible.

Where does the cache directory exists for CQ5?
The cached documents are created in the root of a web-server which is preconfigured.

18) Explain the methods of Caching adopted by Dispatcher?
i)    Dispatcher invalidates those pages whose content has been updated and replaces it with new content.
ii)   Auto-Inavidation automatically removes the contents which are not relevant.

19) How you can inherit properties of one dialog to another dialog ?
For inheriting properties we have to create two components with unique names in the base component dialog. For eg. If your plan is to have two rich text two rich text areas in the dialog of components that inherit from the base, then you must include two rich text areas with unique names in the base component dialog. In any case every input field of a dialog must have a unique name, else they will point to the same property path relative to the jcr:content node of the component when used on a page.

Any issue if name is not unique?
Each input field of a dialog must have a unique name else both will point to the same property path relative to the jcr:content node of the component when used on a page.

20) Can we restrict for certain users not to display some digital assets ?

You can always limit who can access certain folders in CQ Digital Assets by making the folder part of a CUG(closed user group).
Steps to make a folder part of a CUG:

In CQ DAM, right-click the folder you want to add closed user group properties for and select Properties.
Click the CUG tab.
Select the Enabled check box to make the folder and its assets available only to a closed user group.
Browse to the login page, if there is one, to add that information. Add admitted groups by clicking Add item. If necessary, add the realm. Click OK to save your changes.

 

21) Difference between OSGi bundle and Normal Jar file?

1)      OSGi bundles are jar files with metadata inside. Much of this metadata is in the jar’s manifest, found at META-INF/MANIFEST.MF. This metadata, when read by an OSGi runtime container, is what gives the bundle its power.

2)      With OSGi, just because a class is public doesn’t mean you can get to it. All bundles include an export list of package names, and if a package isn’t in the export list, it doesn’t exist to the outside world. This allows developers to build an extensive internal class hierarchy and minimize the surface area of the bundle’s API without abusing the notion of package-private visibility. A common pattern, for instance, is to put interfaces in one package and implementations in another, and only export the interface package.

3)      All OSGi bundles are given a version number, so it’s possible for an application to simultaneously access different versions of the same bundle (eg: junit 3.8.1 and junit 4.0.). Since each bundle has it’s own classloader, both bundles classes can coexist in the same JVM.

4)      OSGi bundles declare which other bundles they depend upon. This allows them to ensure that any dependencies are met before the bundle is resolved. Only resolved bundles can be activated. Because bundles have versions, versioning can be included in the dependency specification, so one bundle can depend on version junit version 3.8.1 and another bundle depend on junit version 4.0.
5)   In OSGi bundle, there will be an Activator.java class in OSGi which is an optional listener class to be notified of bundle start and stop events.

 

22) What is the difference between

1. <c:import url=”layout-link.jsp” /> 2. <sling:include path=”layout-link.jsp” /> 3. <cq:include script=”layout-link.jsp” />

What is the advantage of each tag? When should each be used?

CQ Include is most appropriate when you are doing standard component/template development.

Sling include is most appropriate when you are trying to include a piece of content as based strictly on sling resource resolution and not CQ component type logic.

  1. <c:import url=”layout-link.jsp” />
    I assume this is the import tag of the Standard Tag Library. This tag is documented athttp://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/c/import.html and does not know about Sling directly.
    But — asuming — this tag is using a RequestDispatcher to dispatch the request, this tag will also pass Sling and the Sling resource resolver.2. <sling:include path=”layout-link.jsp” />
    This is the include tag of the Sling JSP Tag library. This tag knows about Sling and also supportsRequestDispatcherOptions.3. <cq:include script=”layout-link.jsp” />
    This tag is Communiqué specific extension of the Sling JSP Tag library include tag. IIRC it supports callings scripts in addition to just including renderings of resources.
    What is the advantage of each tag? When should each be used?
    In a Communiqué application, I would suggest to generally use the Communiqué or Sling include tag since this provides you more Sling support.
    You may use the JSTL import tag if you don’t have specific requirements for Sling extended features, plan to use the JSP (fragment) outside of Communiqué or if you want to further process the generated (imported) content with a reader or a variable.
    In the future, it is conceivable that the Sling and/or Communique tag library will also provide an import tag similar to the JSTL import tag to be able to further process the imported result.http://dev.day.com/discussion-groups/content/lists/cq-google/2009-10/2009-10-06__day_communique_tag_difference_cq_sling_c__zambak.html23) What is Clientlibs?
    The “clientlib” functionality will manage all your Javascript and CSS resources in your application. It takes cares of dependency management, merging files and minifying content.
    http://experiencedelivers.adobe.com/cemblog/en/experiencedelivers/2012/12/clientlibs-explained-by-example.html

          24)  How does CQ perform load balancing?
Load Balancing distributes user requests (load) across different clustered CQ instances.The following list describes the advantages for load balancing:

  • In practice this means that the Dispatcher shares document requests between several instances of CQ. Because each instance has fewer documents to process, you have faster response times. The Dispatcher keeps internal statistics for each document category, so it can estimate the load and distribute the queries efficiently.
  • If the Dispatcher does not receive responses from an instance, it will automatically relay requests to one of the other instance(s). Thus, if an instance becomes unavailable, the only effect is a slowdown of the site, proportionate to the computational power lost.

25) What is Personalization?

Personalization provides your users with a customized environment that displays dynamic content selected according to their specific needs.There is an ever-increasing volume of content available today, be it on internet, extranet, or intranet websites.Personalization centers on providing the user with a tailor-made environment displaying dynamic content that is selected according to their specific needs; be this on the basis of predefined profiles, user selection, or interactive user behavior.
Teaser Component used in Personalization

26) Multi-Site Management?

Multi-Site Management handles multilingual and multinational content, helping your company balance centralized branding with localized content

 27) Difference between Parbase and parsys?

Parbase

Parsys

Parbase is a key component as it allows components to inherit attributes from other components, similar to subclasses in object oriented languages such as Java, C++, and so on. For example, when you open the/libs/foundation/components/text node in the CRXDE Lite, you see that it has a property named sling:resourceSuperType, which references the parbase component. The parbase here defines tree scripts to render images, titles, and so on, so that all components subclassed from this parbase can use this script.

Also for image component : crop,map etc inheritd

Users do not need access to the parbase.

The paragraph system (parsys) is a compound component that allows authors to add components of different types to a page and contains all other paragraph components. Each paragraph type is represented as a component. The paragraph system itself is also a component, which contains the other paragraph components.

31 Comments

  1. I’m really loving the theme/design of your web site. Do you ever
    run into any web browser compatibility problems? A small number of my blog readers have
    complained about my blog not working correctly in Explorer but looks great in Firefox.
    Do you have any tips to help fix this issue?

    Reply

  2. Hi Anav,
    Thanks for posting the question and answers.

    for the 18th question on Caching adopted by dispatcher below are my little more details on process. let me know if any mistake involved.

    1 Author sends an invalidation request of the asset to the dispatcher, if any request comes for that asset after invalidation, dispatcher then replaces the asset with the new one fetched from publish.

    Reply

    1. Hi Veera,

      We cannot create components in publish instance.
      Publish instance holds the content which you have made available to visitors to your website.

      hope i answer to your query

      Thanks
      ADMIN

      Reply

    2. Publish instance means where client can visit our website. So client can read our website. client cannot edit anything in our site

      Reply

  3. It is very much helpful.
    But could you please post or refer any link for Sys Admin (Interview question)?

    Reply

    1. Hi Manjeet ,

      I dont have much idea about others CQ5 blogs .But if you want to learn more about CQ5 Admin.Please Go to Downloads –> Admin Guide .Hope it solves your problem

      @Admin

      Reply

  4. Thanks very much for usefull information.. pls add some real time sceneraio questions.. and also add Multi site management in details.. like blueprint, diff between live copy and language copy etc.. .

    Reply

    1. After reading this blog: resourceType is used by the resource resolve to find the script to render. resourceSuperType is used to inherit another component.

      Reply

    2. template having resource type property references rendering component path, whereas resourceSuperType references other component having header,footer or other stuff or parbase component as per requirement. let me correct if i am wrong.

      Reply

    3. resourceSuperType is like inheritance. it will get the properties from resource node and excute from the source node.
      when comes to resourceType it goes to the resource node and excute there(at resource Node only)

      Reply

Leave a comment