You are at mine technical blog, which is mostly related to AEM/AEMaaCS. I am Oleksandr Tarasenko - Solution Architect with 13+ years of experience in IT. Here I share experience and thoughts, which I get on my projects.
OSGi: migration to OSGi annotations caveats
I think that every developer from AEM/Sling world has already read many articles regarding switching to the R6 and R7 OSGi annotations. But new annotations do not only allow us to write less boilerplate code, but also bring new caveats and we better be aware of them. Several days ago there was suggested a PR for AC Tool which fixes missing referenced service in AEM 6.4, even though this service was shown as satisfied in Web Console. The fix contained next change: ...
AEM: AC Tool or How To Manage Groups & Users
Before I learned about AC Tool, I worked with a couple of projects several years ago - they were quite big and had many markets and locales. And, as you can imagine, these projects had quite a sophisticated hierarchical structure of users and groups. Time to time, we were rolling out content for new markets/locales, what required the creation of a bunch of groups and setting of correct permissions to them. This routine required one developer to be fully focused on this job for several hours until everything was created, assigned and activated. Then, we had to synchronize made changes among all environments, and later, sometimes, fix issues which we made because of human mistake. If only we had Access Control Tool that days. ...
AEM: How to create custom Project Tile
In this article we will look into the steps we need to go through to create a custom Project Tile. In case you are not familiar with AEM Projects, there is a good intro from Adobe. Note: steps here were written for Adobe AEM 6.3. Add And Render our AEM Project Tile As a content for our custom Project Tile, we will display a number of not activated pages per market/locale in We-Retail website. We will start with creating our tile component. ...
Sling Model Exporter. Now really custom.
Most of the articles which focus on Sling Model Exporter (like this one) tell us how to configure exporter for our models. But none of them really tells how to develop custom Sling Model Exporter. I will try to fill this gap. So let’s imagine, that instead of json, we want to receive Sling Models in a human-readable yaml format. But OOTB we have the ability to export only as JSON. To have it as a yaml, we need to provide our custom implementation of ModelExporter interface. We are not going to invent the wheel, so let’s first add a dependency to Jackson, as it’s already used by Sling for json export: ...
AEM: Simplify unit testing with AemContextCallback
For testing (you do this, right?) your AEM project, most probably, you use AEM Mocks from wcm.io. This is a powerful library, which makes your life easier when it comes to testing Sling Models, Servlets, other classes which work with Page and other entities from AEM. How to use AemContextCallback Interface AemContextCallback allows us to define some default operations which are common for all our test classes, e.g. to register our models. ...
Sling: More About Selector Best Practices
It’s written quite a lot about Sling selectors, best practices and how we should use them. However, misuse is as common as many articles about selectors. So I would like to add my 5 cents to this topic. How to (not) use Sling Selectors Let’s imagine a situation when you have a component which generates some reports. And it’s requested from some other part of the site via Ajax. There can be 2 representation of them - full and short. We know that it’s a good approach to map our servlet, which will generate a report, to a resource type. Also, you know about selectors, so you decide to map it to “/apps/mysite/mycomponent” as a resource type and selectors “fullreport” and “shortreport”. It may look like this: ...
Sling: Resource Resolving for multi-domain system
On publish instances for SEO purposes you may want to remove /content/[sitename] from the URLs. At the same time, you want these short URLs to be resolved to resources when a user requests them.To achieve this, you need to configure Mapping for Resource Resolution. Usually, it’s a trivial task, but it’s getting complicated when you need to host several projects on the same AEM instance. So, let’s imagine, you have several projects hosted on the same AEM instance. One of them lives under /content/site1 and should be accessible via https://site1.com. And another one – under /content/site2 and accessible via https://site2.com. There are several ways to configure resource resolution in Sling and configuration via configuration tree (by default it’s /etc/map) is the most flexible way and we will use it in this article. ...
OSGi: Control resolving process of the bundle
In this article, we will take a look at how to control resolving process for bundles, in particular, how to restrict access to the bundle only for a specific set of OSGi bundles. This may be useful when you want to give access to the bundle only to authorized ones and prevent others from using it for satisfying imported packages. In such cases, you should take a look at interfaces ResolverHookFactory and ResolverHook. ...
AEM: Service User (Mapper) - do you really know it?
Starting from AEM 6 developers are encouraged to create special service users for their bundles/services instead of using administrative sessions. Adobe has documentation on this topic here. However, there are some features which are either not widely used, either - not well documented. So, let’s uncover them! Report on configured Service Users in AEM Since Service User Mapper 1.2.2 There is a page in Web Console where you can check all configured system users - /system/console/status-slingserviceusers ...
AEM SEO: Canonical Tagging Support
Canonical Tagging Support for AEM SEO Why does somebody need this library? Hi there. Once I had to add a canonical tag to the pages due to duplicated content on the site. Having such duplication can greatly affect the ranking of your site so it’s important for AEM SEO as well. At that moment I had a lack of time to write something nice and flexible, so I ended up with nasty and not tested solution. It worked, but it was not something I can feel good with. Later on, I’ve decided to write the library for adding canonical tags. The main reason for creating this library was that I felt really badly about that code I could not refactor (because I was not working in that company anymore). ...