Posts

Showing posts from April, 2020

Need for Query and Index in AEM

Image
For functionalities like full text search, retrieve content based on certain property or conditions associated with property/to avoid iterations on huge volume of content under the root, we write query based logic in AEM. Languages supported : XPATH JCR-SQL2  XPath: Created using AEM Query Builder API. - com.day.cq.search.* From development point of view, we need to be aware of standard OOB predicates to arrive at XPATH query. JCR-SQL2: JCR-SQL2 queries are created using QueryManager - javax.jcr.query.QueryManager QueryManager is acquired through JCR Session  - session.getWorkspace().getQueryManager() Query Processing: Before AEM 6.0/Jackrabbit 2, everything in AEM is indexed by default. With Jackrabbit Oak, we can create custom indexes based on the need. OOB indexes are available under /oak:index node in the repository. Oak Query Engine Process queries in the form of JCR-SQL2.  This means if we write queries using QueryBuilder API involvi...

Content Fragments in AEM - High level pointers

Image
Content Fragments(CF), an implementation for re-using content across multiple locations/channels, a means for headless-CMS. jcr:primaryType Content Fragments(CF) is of asset type - dam:Asset  to hold mixed media content - Text and Assets. Types Simple Fragment, Created out of Fragment Template named " Simple Template " OOB Structured Fragment, Created out of Content Fragment Model(CFM) Note :   Per 6.5 Adobe docs, it is recommended to create CF using CFM. Simple Template Defines single "Multiline text" element. Content Fragment Model(CFM) Offers different data types to define the type of content.(Single line, Multiline text, Date field, Numberfield, dropdown and so on OOB and an option to render each of this in multifield format as well. ) Elements Each of this data types that we define as part of CFM is referred to as  Elements in CF Mutiline Text element It is available in 3 types/formats Rich Text, text/html Plain Text, text/p...

OSGI Factory Configuration implementation

OSGI Factory configuration is used to have many instances of an OSGI config (represented/identified via an identifier) for the single OSGI service/PID. Most often used OOB Factory configurations for example: Logger Factory/writer configuration (for log statements) Service user Mapper service Amendment (for using service resource resolver in projects) Few sample real time use case for the need of OSGI factory config: For multi tenant projects, if we have generic service used across tenants with properties/attributes specific to tenant. For single tenant, generic service targeting all locales with properties/attributes specific to locale. (where generic service -> holds logic in the lines of calling third party service for retrieving/updating information.) Implementation: ( In terms of OSGI R6 annotations ): Create Object Class Definition(OCD) defining desired properties for the OSGI service. - OSGIFactoryConfigOCD.java OSGI Service/Factory service to retrieve ...

Custom xfpage component/template for Experience fragment

Image
Experience fragment(XF) is a page in AEM, like we have our project site pages of the type cq:Page.  Given that it is a page, it is backed by a template and hence a page component.  Site specific XF Page component( inheriting from OOB xfpage component ) -> Template Type -> Editable Template -> XF page -> Use in site pages via OOB "Experience fragment" component(from the componentGroup - General) When we develop a new site, we do create page component with supertype as OOB page component( wcm/foundation/components/page ) or core v1/v2 page component( core/wcm/components/page ) Likewise, for XF specific to our site, we are creating one inheriting from OOB XF page component.  OOB XF page component :   /libs/cq/experience-fragments/components/xfpage. Site specific XF page component: Create a component with super type being /libs/cq/experience-fragments/components/xfpage. We need to override two files customheaderlibs.html and customfo...