Showing posts with label InterviewQuestions. Show all posts
Showing posts with label InterviewQuestions. Show all posts

Thursday, June 11, 2020

AEM Newsletter

AEM Newsletter

AEM Newsletter can be created to distribute the product information/ related details using email. For example, consider a digital marketer that wants to promote events around a specific product. By creating an AEM newsletter, they can raise awareness of the product. Newsletter can have images, texts, links (to videos). This newsletter can be used as part of Adobe campaign as email campaign.

You can create newsletter using existing contents as well as provide new contents.

AEM allows you to manage newsletters, archive them and view the statistics.

In order to configure newsletter, you need to configure email notifications via osgi. Email service can be configured by configuring - Day CQ mailservice. SMTP server port, SMTP server host and from address must not be blank. Configure from email by providing config for com.day.cq.wcm.notification.email.impl.EmailChannel.

You can also personalize the newsletter by providing different variables like username, firstname, lastname, email, salutation, registration date, last visit, interests, city etc.

You can use different mail clients to send the emails like yahoo, gmail, hotmail, thunderbird.

One can also subscribe to the newsletter.

How to create newsletter :

Refer this link

AEM Default Search vs. Solr Search

AEM Default Search vs. Solr Search

AEM Oak Lucene Search :

This is Oak indexing.

Since this is inbuilt search, the indexing happens on AEM itself, which can grow to a large number as per the content repository size. Also index binaries take a lot of space.

Queries can not be cached efficiently here.

In case of e-commerce sites, the contents might be stored on the e-commerce engine. Those will have to be loaded in AEM to use AEM search with them. This will also increase the space requirement.

It doesn't support Natural Language search, keywords indexing, sponsored search, Geo-spatial search and query suggestions/spelling check.

Solr Search :

Reliable, scalabe and fault tolerant

Supports distributed environments which means, there can be cluster of solr instances those can work together to make the most efficient indexing and searching.

Automated failover and recovery

Query caching

You do not have to import the e-commerce contents on AEM for indexing

Advanced Full-Text Search Capabilities, Optimized for High Volume Traffic, Highly Scalable and Fault Tolerant, Near Real-Time Indexing, Faceted Search and Filtering, Geospatial Search, Highly Configurable and User Extensible Caching, Query Suggestions, Spelling Rich Document Parsing.


There are two ways of integrating solr with AEM :

i. Rest integration. Search can be performed using rest api.

ii. It can be configured along with AEM Oak index to optimize the jcr query search.

Scenario :

The out-of-the-box AEM searching feature works well and is a good fit for small applications looking to reduce overall costs and simplify implementations. It requires no extra development time/effort to implement it. It can also be configured and optimized to overcome some of its limitations.

On the other hand, integrating AEM with Solr requires design and development, as well as hosting and managing the Solr environments. This would increase costs and overall project timeline, but the reward is a wide variety of advanced searching features, blazing fast search performance, and a reduced footprint in AEM's environments.




Wednesday, June 10, 2020

Content Fragments Vs Experience Fragment

Content Fragments Vs Experience Fragment

Content Fragment :

- Presentation Agnostic i.e. they can be used in any type of presentation layer. This is achieved using exposing the content fragments in the form of JSON.
- They're of dam:asset type
- Can have several versions like mobile version, tablet version, third party version etc
- Can be created using Content Fragment Model
- Content centric i.e. contents matter not the presentation
- They're composed of form elements like text, date, text area etc
- Can be exported as JSON
- Content fragment model has to be enabled to create content fragment for a site
- Can be created dynamically and used on any channel
- Not meant for larger sizes of content paragraphs
- Advanced version of sling reference component
- It is about reusing the contents

Create content fragment model -> Author content fragment in assets -> Define content services template using editable templates (Empty template) -> Use components like text, image, content fragment or content fragment list -> Author content service page using the content fragment page template created in previous step -> Publish -> View json page the page by putting pagename.model.json.

- Content fragment can be used by third party

Scenario :

i. When dynamic changes in the contents are required frequently. For example events page, vacations planning page, service catalog page, small scale product information catalogs
ii. Multichannel sites
iii. News websites
iv. Legal disclaimers on different channels


Experience Fragment :

- Presentation Centric  : Look and feel matters
- They're of cq:Page type
- Can have several variations based on the channel. Can also have social media specific form which can be created using social post
- Can be created using editable templates
- Can also be created using layout container on a page
- Not necessarily has to be a page, it can be collection of components inside layout container.
- They're composed of components like text component, list component, image component or combination of all
- Can be exported as HTML
- Can be different variation on different channels
- Live copies can be created
- Building blocks
- Experience fragment is about reusing the whole experience across different channels

Create experience fragment template using editable templates (xfpage type) -> go to sites and create experience fragment and select the template -> Ensure experience template policy allows the components you want to use on experience template -> define experience fragment -> Publish

- Experience fragment can be used by third party as simple html pages.

Scenario :
i. Emails
ii. Omnichannel experience
iii. Sites with personalized experiences (by integrating with target)
iv. Embedded on different sites as web component like RSS feed (like detached experiences)

Thursday, May 11, 2017

AEM 6 Advanced Interview Questions Part 4 (Asked in TCS)

AEM 6 Advanced Interview Quesitons Part 4 (Asked in TCS)

Here in this post "AEM 6 Advanced Interview Questions Part 4 (Asked in TCS)" I will be reiterating the questions asked in TCS interview.


1. Explain the entire process of replication with respect to the data flow.
A :
  • the author requests that certain content be published (activated); this can be initiated by a manual request, or by automatic triggers which have been preconfigured.
  • the request is passed to the appropriate default replication agent; an environment can have several default agents which will always be selected for such actions. These agent use buildContent method to build the content for replication. This method uses session for the read and write from the content repository. Also the replication agent has method replicate that take replication content, type and options are arguments. In case this method fails to replicate the content, they are stored in replication queue. A prceprocessor is used before the replication, which performs the actions like creating versions of the pages before replication. It also checks the permissions. A replicationContentFilter is used for filtering out contents before the replication. i.e. to check if a child of a page should be replicated or not. This filter uses replication filter chain.
  • the replication agent "packages" the content and places it in the replication queue.
  • in the Websites tab the colored status indicator is set for the individual pages.
  • the content is lifted from the queue and transported to the publish environment using the configured protocol; usually this is HTTP.
  • a servlet in the publish environment receives the request and publishes the received content; the default servlet is http://localhost:4503/bin/receive.
  • multiple author and publish environments can be configured.
  • Features such as comments and forms, allow users to enter information on a publish instance. For this a type of replication is needed to return this information to the author environment, from where it is redistributed to other publish environments. However, due to security considerations, any traffic from the publish to the author environment must be strictly controlled.
  • This is known as reverse replication and functions using an agent in the publish environment which references the author environment. This agent places the input into an outbox. This outbox is matched with replication listeners in the author environment. The listeners (PollingTransportHandler) poll the outboxes to collect any input made and then distribute it as necessary. This ensures that the author environment controls all traffic.

2. Explain serialization types in detail. And how they're handled.
A :
Defualt : For the default replication as explained above.
Dispatcher Flusher : For the dispatcher cache flush.
Binary less : To make the publish instance point to the same author datastore in order to reduce the storage cost and time taken to activate the pages. To use binary less, change the data store to filedatasote in repository.xml and then point all the instances to the same filedatastore on the network.
Static Content Builder : For the file system view of repository

3. How to get the properties in activate method.
A :
PropertiesUtil.toStringArray(componentContext.getProperties().get(name),type);

4. Explain the difference between workflow launcher and sling event listener and observation manager with respect to their performance.
A :
- Workflow launcher is used at AEM level : This is an ideal way of listening the events. They are cluster aware and are at AEM level. This is well documented and is useful when there are more customized non admin users.

- Event Listener (Handler) is used at Sling level : these are application level events. These events must have topic registered to them. Here the event can be sent by EventAdmin either synchronously or asynchronously. postEvent for async and sendEvent API for sync. An event handler can listen to such events as well as replication events. Events get black listed in case the specified time in EventAdmin is atained before the event is handled by the event handler. Also it should be noted that the handler is called for each and every event. There can be event filter used to avoid the same this will ensure event admin will check the filter parameter before calling the event handler.

- Observation manager is used at JCR level : This is done at the lowest level i.e. node level. Like node added, property added etc. A live session is required for this one to listen to repository. These listeners are not cluster aware, each time a change is made in nodes, the code will execute n times as per the no of clusters.

There are two more ways :

- Scheduled events
- Post to repository


5. TarMK vs MongoMK. Which one to prefer when?
A : MongoMK provides better scalability and TarMK provides better performance. Based on the number of author instances required one can make choice of MongoMK or TarMK. i.e. when there's requirement of more than one author instance, MongoMK is the answer. If there are huge number of page updates in a day, TarMK is the right choice. Also the choice of underlying database depends upon the number of concurrent users, number of assets, number of page edits, number of searches per day. In case of publish instance, the selection of MongoMK or TarMK should be based on the fact if there's any user generated contents or not. So if the site requires users generated contents go for MongoMK.


6. Explain content builder and it's methods.
A: A ContentBuilder assembles data for the replication. It contains two variations of create method and getTitle and getName method. The content builder is registered with the name property.

7. Global objects

8. What is the usage of SlingSafeMethodsServlet?
A:
  • Read only
  • Doesn't support post put delete
  • Supports get, head, trace, options
9. What is the usage of SlingAllMethodsServlet?
A:
  • Used for data modifying servlets
  • Supports all methods inclusing post, put and delete


10. What is Tar farm?

11. What is fragment in OSGI bundles?
A : Fragments are used to customize and osgi bundle. They are dependent upon the host bundle and they use the same classloader as host bundle.

12. What is bundle context and what is component context?
A :

13. How are the big size images being replicated on publish?
A : Use binary less replication. This will mean the same data is shared to used on author and publisher instances and no copies will be created. Binary less ensures only meta data are copied and shared amongst the instances. TarMK should be the choice since binary less is used here.

14. Your system architecture in terms of author publisher servers.
A : Please prepare this answer according to your system.

15. How is the load balancing done on publishers with different dispatchers?
A : refer https://cqdump.wordpress.com/2015/01/12/connecting-dispatchers-and-publishers/

16. If there are multiple instances of a service implementations, which one will be picked up? The one that is used recently or the one that is older.
A : service with highest service ranking will be picked up. If there are more than one service implementation with the same service ranking then the lowest service id will be picked up. Also if you have specific requirement of service being used. There should be a service type defined as propery and the same should be called usin

16. Why sling?
A : Sling is a web application frame work based on RESTful API which provides the easy development of content centric system.

17. Why JCR?
A : Sling uses JCR repository like jackrabbit or in case of AEM it is CRX.

18. Why OSGI?
A :
  • Defines architecture for the moduler applications
  • Dynamic discovery of service and contract
  • Allows dynamic loading, unloading and configuration of the controls of the bundle

19. Why Sling API is preferred over JCR?
A : Higher level APIs like Sling API provides easy way of accessing the data. It is more readable, maintainable and productive. This reduces the boilerplate code. Exceptions are handled elegantly. They have more useful and new features included.

20. What is new in AEM 6.4?

21. How are the Replication Queues maintained in case of system failure?

A : The replication queue is stored in /var/replication/data and are retrieved from this location in case of system failure.

Also AEM uses a proprietary binary format for replication called Durbo. Durbo includes the necessary checksumming to ensure that replicated content is not corrupted during transport.

22. Managing repository growth.

A first of all, the root cause of the repository growth has to be identified. Following steps can be taken for the same.

1.
Configure a logger - org.apache.jackrabbit.oak.jcr.operations.writes at traces log level in  http://aemhost:port/system/console/slinglog

2. Run the disk usage report at - http://host:port/etc/reports/diskusage.html

3. Perform following

CPU Profiling, capturing thread dumps, Analysing AEM thread dump


23. Tell about some of the Sling API you've used.

ResourceResolver
ValueMap
Resource
ResourceWrapper

24. Why OAK?

25. Why do we need component and why do we need service?

26. Explain Query API in detail in java.

27. Explain how the permissions are evaluated on a node/page with internal logic.

28. How is micro kernel different from persistence manager?

29. Indexing in AEM.

Monday, May 1, 2017

AEM 6 Campaign and Segments Interview Questions

AEM 6 Campaign and Segments Interview Questions

What is campaign?

Collection of individual Experiences

What is brand?

Brand is collection of campaigns.

What is experiences?

Focused content form various experiences those define personalized pages or touchpoints to the users. following are the types of experiences.


  • Teasers : Teasers are used to steer the specific visitor focus to their interest pages. Teasers are used for collecting user information like short registration forms. They are active only for short time or until the other teaser takes place.
  • News letters : Are used for encouraging the users to visit your website using the data generated in leads.
  • Test & Targets : provides one intuitive interface to design and execute tests and target the right audience using contents all using a single application.


What is touchpoint?

Connection point between the audience and the campaign.

What is leads?

Leads are the details of the users/audiences along with their communication means those are collected through the forms via campaigns.

What is lists?

Lists are the groups of leads/audiences divided according to the specific characteristics.

What is segment?

Segments are the definitions of the targeted audiences for a campaign based on the details relating a customer/user and their interests or activities through site those are collected on the basis of their profiles/inputs.

What is strategies?

A strategy is the criteria that is used for identifying a teaser to be resolved on a page. There are three strategies.

  • Random
  • First 
  • Click stream score : This is based on tags. 
What is landing page?

End point for the marketing outreach. They define the task that should be fulfilled by the visitor to consider the success of landing page.

What are the components of landing page?
  • Textbox
  • Title
  • Click to Action components - click through link and graphical link

What are the components of CTA lead form?
  • About
  • Address
  • Date of birth
  • Email id
  • First name
  • Last name
  • Gender

What are the steps for creating a lead form?
  • create importer page
  • prepare the html for importing
  • import the design package

What are target offers?

Segmentation terminology and their meanings.

  • Visitor
  • User
  • Trait
  • Segment
  • Behavioral traits
  • Demographic traits
  • Derived traits
  • Subsegment
  • Campaign
  • Teaser page
  • Teaser paragraph









Monday, April 24, 2017

AEM 6 Advanced Interview Questions Part 3

AEM 6 Advanced Interview Questions Part 3


1. What will be your approach to implement a website that is compatible to desktop, mobiles and tablets?
A:
  • Make your website responsive
  • Create your pages in HTML 5, so that they can be easily adapted by any devices. i.e. <!DCOTYPE html> should be the first line of your page.
  • Use Media queries
  • Add devices list for simulation in side kick by adding jsp - /libs/wcm/mobile/components/simulator/simulator.jsp
  • Register your page components for simulation. In config node add an entry for MobileEmulatorProvider. Set a property mobile:resourceTypes and add the pages as multistring values.
  • Implement adaptive images

2. Explain FileVault.
A : FileVault is the tool developed by adobe to map your file system content with crx. It is same as source control system which provides check-in check-out features.

3.Explain QueryBuilder API.


4. What is link-checker in AEM?
A : A link checker is provided with AEM. It checks all the content pages and prepares the list of valid and invalid links. It also makes invalid links on site on all the content pages. Link checker can be accessed using tools menu. One can disable the link checker pragmatically by loading the LinkCheckerSettings object and setting the value of ignoreExternals as follows.

if(isPublish) {
LinkCheckerSettings s = LinkCheckerSettings.fromRequest(slingRequest);
s.setIgnoreExternals(true);
}

Link checker transformer can be set using configMgr to configure link checker.


5. How static image rendering works in AEM?
A : AEM provides an image component that can be used to render the images. Using this component author can configure the image file source and the other parameters. When the jsp/html page is acessed, the image servlet creates an img tag to insert the image. This tag renders the image as per the value of src which is actually file source with a unique selector.

Adaptive image rendering servlet is used for setting the image resolution according to the device size. The JSP in this component adds div elements to provide the different resolution and renditions of the image as per device screen size.

6.  Explain some of the xtypes and their corresponding CQ types.
A :
textfield -> TextField
pathfield -> PathField
spinner -> Spinner
spacer -> Spacer
tabpanel -> TabPanel
dialog -> Dialog
datefield -> DateField
datepicker -> DatePicker
checkbox -> CheckBox
checkboxgroup -> CheckBoxGroup
radio -> Radio
radiogroup -> RadioGroup
multifield -> MultiField

7. What are the developer tools provided by AEM?
A :
FlieVault
Dialog editor
Translator
Site Importer
CRXDE
Package Manager

8. Externalizer in AEM.
A : Externalizer allows to create absolute urls. One can create links based on the server instance line authorLink, publishLink, externalLink, absoluteLink. Externalizer can be configured in configMgr


Sunday, April 16, 2017

AEM 6 Advanced Interview Questions Part 2

AEM 6 Advanced Interview Questions Part 2


1. What is the role of persistence manager, data store, journal and indexes?
A: Persistence manager is used for storing the data in the repository. By Default AEM uses Tar persistence manager, which uses Linux's standard type of archive files - Tar. 
A data store is used for storing large contents. When the data is too big, it is not directly stored in persistence manger's storage but instead stored in data store and only the reference to this data is stored in persistence manager.
Journal helps in maintaining the data consistency and helps in system recovery from crashes. This also helps in synchronizing the cluster data.
Indexes are used for fast lookups of data for search and other function.

2. How to implement etc/mapping?
A : Inside /etc create a sling:Folder with the name map
Inside this folder create a sling:Folder with the name http
Inside this folder define sling:mapping node with the properties sling:match and sling:internalRedirect. Here sling:match is the request that is to be matched with respect to the actual website and sling:internalRedirect suggests the sling where the request should be redirected in AEM (say inside /content) or sling:redirect that suggests the sling where the request should be redirected outside the AEM.
These properties use regex to match with the url paths.

3. Explain design_dialog.
A : A design_dialog is used for the configuration of components on design level i.e. the site level. A design_dialog can be defined as cq:dialog just under the component node and can be accessed in design mode. A design dialog can have similar configurations as a dialog.

4. What is personalization?
A : Personalization provides the users with contents tailor made for them. There are three main components of it.
  • Users 
  • Content
  • Personalization rules
AEM provides a built in targeting engine that presents the personalized contents to the users.

5. How would you pass parameters to sling model from Sightly?
A: Following is the example how this can be done.

in Sightly template

<div data-sly-use.model3="${'org.example.models.Model3' @ colour='red', path=resource.path}">
${model3.shine}
</div>

In sling model class

@Inject
private String colour;

@Inject
private String path;


6. How would you design a global header and footer? Can you explain the same with the example of SDI?

7. How to configure WebDav and advantage of it?
A : You can configure WebDav using this link - 

The advantages of using WebDav is that the drive folder structure is mapped to AEM and you can upload larger DAM assets easily.

8. Why sling models are preferred on WCM Use API?
A : Following are the advantages of using sling models.
  • Easy to inject parameters
  • Easy to extend from other sling models
  • Simple set up for unit testing.
9. How do you transfer group permissions from one environment to another?

10. Purpose of servlet engine? Explain the same with respect to AEM 6.
A : Prior to AEM 6 the CQ5 used CQSE which is CQ Servlet engine. Which is replaced by Eclipse Jetty in AEM 6 version.
A servlet engine is used for handling servlet life cycle. Jetty can be configured in configMgr at org.apache.felix.http. AEM can also run on other application servers. For which you have to create a war file. You can configure the run mode of the war file in web.xml file.You can deploy publish and author instances both on the same application server.

11. Explain policy=ConfigurationPolicy.REQUIRE in @component.
A: ConfigurationPolicy defines the component's configuration policy. There are three values - OPTIONAL, REQUIRE and IGNORE. Here, REQUIRE means the configuration should be available in config node that is used for configuring run mode configuration.

12. What is ACL and ACEs?
A: ACL is access control list. It is implementation of AbstractAccessControlList which implements JCR's JackrabbitAccessControlList.The default implementation is nodeACL and principalACL.

ACE is access control entry. Which is implementation of AbstractAccessControlEntry. It contains restrictions and principals.

An ACE can be defined for a page in crxde lite environment under local access control policy. There are three types of access control policies here. Applicable access control policy, local access control policy and effective access control policy which can be of the current node or inherited from the parent.

There are priviledges like jcr:read, jcr:write, jcr:all,jcr: replicate,jcr:readAccessControl, jcr:modifyAccessControl, jcr:addChildNodes etc. And these priviledges are granted to the user/groups.

13. How to enforce UPDATE startup mode in AEM?
A: There are following ways of doing it.
  • By changing the jar file with higher version and starting the instance. This will start the UPDATE startup mode.
  • While starting the instance using java argument -Dorg.apache.sling.launchpad.startupmode=update

14. What is the difference between Tar Persistence manager and RDMS persistence manager?
A :
  • Tar PM is designed specifically for JCR repository.
  • Tar files are easy to backup.
  • Tar is platform independent format.
  • It can be accessed via standard zip tools like winzip.
  • It is based on key-value pair structure.
15. What is ACS? name and explain some of the features provided by it.
A: ACS is a bootstrap project with common AEM functionality and a set of components and AEM development toolkit.

  • It provides Dispatcher Flusher UI which can be used for flushing the cache manually.
  • Provides commons utils like CookieUtils, PathInfoUtil, OsgiUtil etc.
  • Also provide convenient way of exporting users in csv files.
16. How to implement a servlet in AEM?
A : A sling servlet can be registered as Sling service using @SlingServlet annotation. Which has properties like resourceType, name, description, selectors, extensions, methods. A servlet can have either resourceType of path. The path has to be starting with /bin which restricts the servlet to be used in publish instance. The servlet extends SlingSafeMethodsServlet or SlingAllMethodServlet however, it is not mendatory. SlingAllMethodServlet should be preferred when the data modification is intended.
This servlet can be called using jquery on the dialog box in order to retrive appropriate values in the dialog box and also can be used for inserting data input from forms.

17. Maven plugin for build AEM project.
A: maven-bundle-plugin

18. How is sling model mapped to sighlty page?
A : The java class that is declared as sling model should have the annotation @model with the value of adaptables which can be anything like resource or request.
This model class then can be initialized in the sightly page using <div data-sly-use.name="packagepath.class">... </div>

19. List down sling model annotations.
A :

  • Model 
  • Inject
  • Optional
  • Default
  • Named
  • Via
  • Source
  • PostConstruct
  • Self
  • SlingObject
  • ResourcePath
  • OsgiService
  • ValuesMapValue
  • RequestAttribute
20. What is script-bindings?
A : Script binding is the object which has all the variables and their values that is used for execution of the script.

21. Explain sightly templates.
A : Sightly templates are the functions or reusable html code that can be called with different values of parameters.
e.g.

 Non-parameterized template

<div data-sly-template.one>
some html code
</div>

<div data-sly-call="${one}">

Parameterized template

<div data-sly-template.paramTemp={@ a, b, c}>
 <a href="a" alt="b">c </a>
</div>

<div data-sly-call={paramTemp @  a="test.com", b="test", c="click here"}>
</div>

22.How to find maven dependency?
A: http://<host>:<port>/system/console/depfinder

23. How to see sling etc mappings?
A:http://<host>:<port>/system/console/jcrresolver

24. How to access sling model class in JSP?
<c:set var="class" value="<%=resource.adaptTo(class.class)%>">
or
<sling:adaptTo var="class" adaptable="${resource}"adaptTo="packagepath.class" >





Saturday, April 15, 2017

AEM 6 Advanced Interview Questions Part 1

AEM 6 Advanced Interview Questions Part 3


Here, I will try to list down some of the advanced AEM interview questions I have come across. Please correct my answers if required in the comments and I will do the changes accordingly.

1. Difference between service and component
A :
Service :
  • A service is an OSGI component that can be looked up from other OSGI components.
  • Any java object is eligible to be a service
  • All the services in OSGI are components
  • Services are maintained in service registry from which they can be looked up
Component :
  • A component is a java object whose life cycle is handled by the OSGI container.
  • Any java object is eligible to be a component
  • A component is not necessarily an OSGI service, however, to make it callable by other components it has to be declared as service.
2. How a class is made available to OSGI container?
A : By providing @component at the top of the class declaration

3. Do you always need @service and @component annotations for a class in OSGI?
A : No, a component may not be declared as an OSGI service. However, there is a requirement to consume/look up for the component in another component it has to be declared as @component.

4. How to debug a situation where a component is not configurable on ConfigMgr?
A : Following steps should be taken in order to ensure component is configurable

  • The attribute-value metadata=true of @component annotation is responsible to making the component configurable on ConfigMgr. That should be verified first.
  • If the component is using @reference to other service, they should be available to the component and should have been initialized
  • There should be configurable properties associated with the component using - @property or @properties 
5. What is the difference between Live Copy and Language Copy?
A : A Live Copy is the copy of blueprint/source with its live relation with the blueprint/source which means the changes in live copy and source are tracked. Source can be attached or detached or reattached or sync to the Live Copy. While a Language Copy is a static copy of some or all the pages of the source.

6. How Live Copy is connected to blueprint?
A : Using Rollout configuration the Live Copy can be configured to be updated automatically when a update in blueprint occurs.

7. MSM configuration.
Please refer - https://docs.adobe.com/docs/en/aem/6-0/administer/sites/multi-site-manager/msm-blueprints.html

8. How to configure run modes?
A : Run modes are configured in following ways.
  • Provide the run mode as name of AEM jar file e.g. cq6_publish_p4503.jar. Where publish is the run mode.
  • Provide property - sling.run.modes in sling.properties file
  • Provide run mode with java argument for example -Dsling.run.modes=publish
  • Provide -r <run mode> which starting the jar file using batch file
9. How is the configuration of AEM instance done according to run modes?
A : You can define a config (nt:folder) node inside your project folder - /apps/projectA and define configuration of a service/component by creating a node sling:OsgiConfig under it having the full qualifying name like org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl. The configuration should be provided as the property of this node.



When you specify the run mode along with config separated by a dot, it becomes the configuration of a specific run mode and is used when that particular run mode is initialized. For example config.author will define configurations for author run mode.




10. What is the advantages of using Sightly?
A : Following are the advantages of using Sightly over JSP.
  • Easy and no requirement of knowing JAVA to use Sightly.
  • Protection against cross scripting.
  • Uses sightly context to output data in correct format.
  • Clear separation of client side and back end logic. No scriptlets.
  • Strong connection to Sling.
  • Has two ways of handling backend logic. WCM Use Java API and WCM Use Javascript API.
11. What is HTML (display) context in Sightly?
A : The display context of a content refers to its location where it is used in the page. HTL is capable of identifying the context of the output except in case of CSS and JS where in if required explicit context can be passed. This context is used to prevent XSS security problem. XSS is cross site scripting attack on the website, in which attacker can inject the custom script and attack the site. HTL gives protection from this by introducing display context. HTL is capable of identifying the context in link, text and title properties. There are several display contexts those can be used when required. Which are listed below.
  • text
  • html
  • attribute
  • uri
  • number
  • scriptToken
  • scriptString
  • scriptComment
  • styleToken
  •  styleString
  • styleComment
  • unsafe
  • attributeName
  • elementName
12. Why designs are different from clientlibs and why should clientlibs be defined outside designs?
A : Designs contain the details of site level configurations of the components along with it it can contain the clientlibs. However, when a clientlibs are configured in designs, it will be combined into one main.js/main.css and will be loaded each time a page is called. However, there are cases when not all the scripts/css are needed to be loaded on page as they are not used by the components. In such cases, the clientlibs can be defined along with the component and imported according to the requirement on the page. This will ensure only those client libs are called which are required by the page/components on the page and they are easy to maintain due to their clear separation according to the page.

13. What does clientlibs contain and what is embed, dependencies and categories?
A: Clientlibs contain js.txt, css.txt and the sources of javascript and css.
  • Categories specify the clientslibs required by the page
  • Dependencies specify the clientlibs those are required to run the clientlibs defined in categories and it means there will be an extra call made to load these clientlibs.
  • Embed specifies aggregating the clientlibs along with the defined in categories, this means they will be attached to the main clientlibs.

14. Difference between CRX2.0 and OAK (CRX3.0).
A:
  • CRX2.0 is the implementation of Jackrabbit while OAK is the implementation of Jackrabbit OAK
  • Since CRX2.0 is implementation of Jackrabbit, it uses JCR completely, while OAK uses JCR just as facades.
  • CRX2.0 has persistence manager (PM) which writes data as blob however, OAK has microkernel which writes data as per underlying DB.
  • CRX2.0 uses Lucene while OAK uses Solr.
  • CRX2.0 doesn't support clustering (i.e. distributed database across the servers) while OAK uses MongoDB like database which use clustering.


15. Difference between CQ5.6 and AEM6.1?
A:
  • Since AEM6.0 the touch UI is introduced which was not there in CQ5.6
  • AEM6.1 uses OAK which 5.6 uses CRX2.0 which is adobe's implementation of JCR.
  • Since AEM6.0 sightly is introduced as new markup language to facilitate the front end developers with page definitions which reduces the requirement of having developers with knowledge of java.
  • CQSE servlet engine has been replaced by Eclipse Jetty 

16. Do you always require @activate and @deactivate?
A : No. They indicate the methods required for pre or post processing of the components/services.

17. How do you use a service in a component?
A : The simplest way is to use @reference annotation and use the name of the service.
If the service needs to be used inside a jsp, you can use following syntax of code in scriptlet.

com.adobe.cq.KeyService keyService = sling.getService(com.adobe.cq.KeyService.class);

18. Explain dispatcher configurations (especially /filter)
A : Please refer - Dispatcher Configurations

19. Explain @reference annotation.
A: This annotation is used for injecting an OSGI service in OSGI component/service. Following are the different attributes used along with the annotation.

name : in case name of the service is different from the declared variable reference
interfaceName : interface name for the service.
policy : It can be one of ReferencePolicy.STATIC or ReferencePolicy.DYNAMIC. Where in dynamic means, if the reference service goes off, it is bound to the calling component/service when it is on again dynamically without the requirement of resetting the calling component/service. By default this value is always static, which means the calling component/service will not be up until the reference is resolved.
target : to select the referenced service.
strategy : one of event or lookup. This value defines how the reference will be resolved.

20. How sling does resource resolution?
A : There are three basic steps.

  • URL decomposition : The URL is decomposed in protocol, path, extension, selector, suffix and parameters.
  • ResourceType identification : Using the path sling decided at which location in content repository the page resource should be looked for. From there, the sling:resouceType of the page is extracted. In case sling:resouceType is not available, sling:superResourceType is looked for. Once the resourceType is determined say /apps/project/components/pages/componentA, the script is located inside the component definition in apps folder.
  • Script resolution : Here the priorities to the scripts are given as per the name, extension, method and type, which is as follows.
    • selector + extension + jsp/html
    • selector + jsp/html
    • extension + jsp
    • node name + jsp/html
    • method + jsp/html first GET/HEAD and then POST, DELETE etc. These names has to be in capitals.
21. Why a webservice consumer in AEM should be implemented at server side instead of client side?
A : One should be evaluating the output of webservice in order to decide if the consumer should be implemented at service side or client side. For example a webservice giving response in JSON can be better be consumed on the client side while a webservice giving response in XML format can be better consumed on the server side. Also, while implementing the consumer client side, one should consider the size of the response returned by the webservice. Large sized responses should be handled by the server side consumer.

22. Analytics integration.
A : Please refer - SiteCatalyst

23. Sling Dynamic Includes in AEM.
A : This is a separate project created to handle the situation when there is a page with most of the static components and a dynamic component. This enables the dispatcher to cache the static components of the page and load the dynamic components from the publish instance. This is done using a servlet filter that intercepts the request of a component with given resourceType.

Implementation and configuration details can be found at - SDI

24. How to provide different configuration of the same service dynamically?
A : This is done by adding configurationFactory=true as one of the attributes in @component annotation as given in following example.

@component(label = "test component", immediate = true, enabled = true,
metatype = true,
description = "Testing configuration factory",
policy = ConfigurationPolicy.REQUIRE, configurationFactory = true)

This will allow multiple configuration of the component/service by providing + sign at right side on the configMgr.

25. Why an out of the box component should not be altered?
A: The out of the box components are prone to change when a new service pack is installed or when a version upgrade is done or when a new update is provided to the AEM. This will remove the existing configurations done in the component in libs folder. The other reason is the component might have been used inside another project/component which may bring inconsistent behavior in the component that is using the altered component.

26. How to create an overlay component?
A :An overlay component is created by copy pasting the component from \libs to \apps with exact path of the component and doing required changes.

27. How to create an overriden component?
A : A component can be overriden by creating a new component and providing sling:resourseSuperType property.

28. How to create a custom event handler?
A : Define a class that extends EventListner and implement the required method activate method which takes ComponentContext as the argument.

Using session, you can fetch the observation manager like

session.getWorkSpace().getObservationManager()

Using this observation manager you can add event listener with arguments like path, type, event (Node added,  node removed, node moved, persist, property added, property changed, property removed)


Some more AEM 6 Interview Questions for Architects

 Some more AEM 6 Interview Questions for Architects 1. Consider you have a workflow with two steps. One step is to transfer the asset from s...