<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>TechBlog - Tarasenko Oleksandr</title><link>https://taradevko.com/</link><description>Recent content on TechBlog - Tarasenko Oleksandr</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 16 Jan 2019 00:00:00 +0000</lastBuildDate><atom:link href="https://taradevko.com/index.xml" rel="self" type="application/rss+xml"/><item><title>OSGi: migration to OSGi annotations caveats</title><link>https://taradevko.com/2019/01-16-migration-osgi-annotations-caveats-sling-aem/</link><pubDate>Wed, 16 Jan 2019 00:00:00 +0000</pubDate><guid>https://taradevko.com/2019/01-16-migration-osgi-annotations-caveats-sling-aem/</guid><description>&lt;p&gt;I think that every developer from AEM/Sling world has already read many articles regarding switching to the &lt;a href="http://www.nateyolles.com/blog/2017/05/osgi-declarative-services-annotations-in-aem"&gt;R6&lt;/a&gt; and &lt;a href="http://blogs.adobe.com/experiencedelivers/experience-management/osgi/using-osgi-r7-annotations-aem/"&gt;R7&lt;/a&gt; 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.&lt;/p&gt;
&lt;p&gt;Several days ago there was suggested a &lt;a href="https://github.com/Netcentric/accesscontroltool/pull/346"&gt;PR&lt;/a&gt; for &lt;a href="https://github.com/Netcentric/accesscontroltool"&gt;AC Tool&lt;/a&gt; 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:&lt;/p&gt;</description></item><item><title>AEM: AC Tool or How To Manage Groups &amp; Users</title><link>https://taradevko.com/2018/05-29-aem-ac-tool-manage-groups-users/</link><pubDate>Tue, 29 May 2018 00:00:00 +0000</pubDate><guid>https://taradevko.com/2018/05-29-aem-ac-tool-manage-groups-users/</guid><description>&lt;p&gt;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.&lt;/p&gt;</description></item><item><title>AEM: How to create custom Project Tile</title><link>https://taradevko.com/2018/04-17-aem-how-create-custom-project-tile/</link><pubDate>Tue, 17 Apr 2018 00:00:00 +0000</pubDate><guid>https://taradevko.com/2018/04-17-aem-how-create-custom-project-tile/</guid><description>&lt;p&gt;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 &lt;a href="https://helpx.adobe.com/experience-manager/6-3/sites/authoring/using/projects.html"&gt;Adobe&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note: steps here were written for Adobe AEM 6.3.&lt;/p&gt;
&lt;h2 id="add-and-render-our-aem-project-tile"&gt;Add And Render our AEM Project Tile&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;</description></item><item><title>Sling Model Exporter. Now really custom.</title><link>https://taradevko.com/2018/01-29-sling-model-exporter-now-really-custom/</link><pubDate>Mon, 29 Jan 2018 00:00:00 +0000</pubDate><guid>https://taradevko.com/2018/01-29-sling-model-exporter-now-really-custom/</guid><description>&lt;p&gt;Most of the articles which focus on Sling Model Exporter (like &lt;a href="https://helpx.adobe.com/experience-manager/kt/platform-repository/using/sling-model-exporter-tutorial-develop.html"&gt;this one&lt;/a&gt;) 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.&lt;/p&gt;
&lt;p&gt;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 &lt;a href="https://sling.apache.org/apidocs/sling9/org/apache/sling/models/export/spi/ModelExporter.html"&gt;ModelExporter&lt;/a&gt; interface. We are not going to invent the wheel, so let&amp;rsquo;s first add a dependency to Jackson, as it&amp;rsquo;s already used by Sling for json export:&lt;/p&gt;</description></item><item><title>AEM: Simplify unit testing with AemContextCallback</title><link>https://taradevko.com/2017/12-20-aem-simple-unit-testing-with-aemcontextcallback/</link><pubDate>Wed, 20 Dec 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/12-20-aem-simple-unit-testing-with-aemcontextcallback/</guid><description>&lt;p&gt;For testing (you do this, right?) your AEM project, most probably, you use AEM Mocks from &lt;a href="http://wcm.io/testing/aem-mock/"&gt;wcm.io&lt;/a&gt;. 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.&lt;/p&gt;
&lt;h2 id="how-to-useaemcontextcallback"&gt;How to use &lt;em&gt;AemContextCallback&lt;/em&gt;&lt;/h2&gt;
&lt;p&gt;Interface &lt;em&gt;AemContextCallback&lt;/em&gt; allows us to define some default operations which are common for all our test classes, e.g. to register our models.&lt;/p&gt;</description></item><item><title>Sling: More About Selector Best Practices</title><link>https://taradevko.com/2017/12-11-sling-selector-best-practice/</link><pubDate>Mon, 11 Dec 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/12-11-sling-selector-best-practice/</guid><description>&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id="how-to-not-use-sling-selectors"&gt;How to (not) use Sling Selectors&lt;/h3&gt;
&lt;p&gt;Let’s imagine a situation when you have a component which generates some reports. And it&amp;rsquo;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 “&lt;em&gt;/apps/mysite/mycomponent&lt;/em&gt;” as a resource type and selectors “&lt;em&gt;fullreport&lt;/em&gt;” and “&lt;em&gt;shortreport&lt;/em&gt;”. It may look like this:&lt;/p&gt;</description></item><item><title>Sling: Resource Resolving for multi-domain system</title><link>https://taradevko.com/2017/07-18-sling-resource-resolve-multi-domain-sys/</link><pubDate>Tue, 18 Jul 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/07-18-sling-resource-resolve-multi-domain-sys/</guid><description>&lt;p&gt;On publish instances for SEO purposes you may want to remove &lt;em&gt;/content/[sitename]&lt;/em&gt; 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&amp;rsquo;s a trivial task, but it&amp;rsquo;s getting complicated when you need to host several projects on the same AEM instance.&lt;/p&gt;
&lt;p&gt;So, let&amp;rsquo;s imagine, you have several projects hosted on the same AEM instance. One of them lives under /content/site1 and should be accessible via &lt;em&gt;&lt;a href="https://site1.com"&gt;https://site1.com&lt;/a&gt;&lt;/em&gt;. And another one – under &lt;em&gt;/content/site2&lt;/em&gt; and accessible via &lt;em&gt;&lt;a href="https://site2.com"&gt;https://site2.com&lt;/a&gt;&lt;/em&gt;. There are several ways to configure resource resolution in Sling and configuration via configuration tree (by default it’s &lt;em&gt;/etc/map&lt;/em&gt;) is the most flexible way and we will use it in this article.&lt;/p&gt;</description></item><item><title>OSGi: Control resolving process of the bundle</title><link>https://taradevko.com/2017/06-09-osgi-control-resolving-process-bundle/</link><pubDate>Fri, 09 Jun 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/06-09-osgi-control-resolving-process-bundle/</guid><description>&lt;p&gt;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 &lt;em&gt;ResolverHookFactory&lt;/em&gt; and &lt;em&gt;ResolverHook&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>AEM: Service User (Mapper) - do you really know it?</title><link>https://taradevko.com/2017/06-01-aem-service-user-mapper-do-you-know-it/</link><pubDate>Thu, 01 Jun 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/06-01-aem-service-user-mapper-do-you-know-it/</guid><description>&lt;p&gt;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 &lt;a href="https://docs.adobe.com/docs/en/aem/6-2/administer/security/service-users.html"&gt;here&lt;/a&gt;. However, there are some features which are either not widely used, either - not well documented. So, let&amp;rsquo;s uncover them!&lt;/p&gt;
&lt;h2 id="report-on-configured-service-users-in-aem"&gt;Report on configured Service Users in AEM&lt;/h2&gt;
&lt;p&gt;Since Service User Mapper 1.2.2&lt;/p&gt;
&lt;p&gt;There is a page in Web Console where you can check all configured system users - /system/console/status-slingserviceusers&lt;/p&gt;</description></item><item><title>AEM SEO: Canonical Tagging Support</title><link>https://taradevko.com/2017/03-27-canonical-tagging-support-aem-seo/</link><pubDate>Mon, 27 Mar 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/03-27-canonical-tagging-support-aem-seo/</guid><description>&lt;h2 id="canonical-tagging-support-for-aem-seo"&gt;Canonical Tagging Support for AEM SEO&lt;/h2&gt;
&lt;h3 id="why-does-somebody-needthis-library"&gt;Why does somebody need this library?&lt;/h3&gt;
&lt;p&gt;Hi there. Once I had to add a &lt;a href="https://en.wikipedia.org/wiki/Canonical_link_element"&gt;canonical tag&lt;/a&gt; to the pages due to duplicated content on the site. Having such duplication can greatly affect the ranking of your site so it&amp;rsquo;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&amp;rsquo;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).&lt;/p&gt;</description></item><item><title>Bot Dev: How to configure chatbot in Telegram</title><link>https://taradevko.com/2017/02-06-configure-telegram-chatbot/</link><pubDate>Mon, 06 Feb 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/02-06-configure-telegram-chatbot/</guid><description>&lt;p&gt;In previous articles (&lt;a href="https://taradevko.com/2017/01-02-write-stateful-bot-telegram-part-1/"&gt;part 1&lt;/a&gt;, &lt;a href="https://taradevko.com/2017/01-09-write-stateful-bot-telegram-part-2/"&gt;part2&lt;/a&gt;) we created chatbot for Telegram. As I promised, here we will configure some settings of our bot:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;commands list&lt;/li&gt;
&lt;li&gt;profile photo&lt;/li&gt;
&lt;li&gt;about text&lt;/li&gt;
&lt;li&gt;bot description&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&amp;rsquo;s begin by configuring our commands list.&lt;/p&gt;
&lt;h2 id="commands-list"&gt;Commands list&lt;/h2&gt;
&lt;p&gt;Command list represents the commands supported by the bot. Telegram suggests them when user types / in the chat with our bot. Each command in this list has a name, which starts with ‘/’, and a text description. Command name length is limited to 32 characters.&lt;/p&gt;</description></item><item><title>Sling Models: How to write Sling Model Injector</title><link>https://taradevko.com/2017/01-25-sling-model-request-parameter-injector/</link><pubDate>Wed, 25 Jan 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/01-25-sling-model-request-parameter-injector/</guid><description>&lt;p&gt;Once I needed to write several debugging servlets for some functionality. Those servlets had to accept a big pile of parameters and I was tired of having tens of rows like  String paramValue = request.getParameter(&amp;ldquo;paramName&amp;rdquo;). Luckily, I&amp;rsquo;ve already known Sling Models. So I&amp;rsquo;ve decided to find the way to inject these parameters into the model, so I could write just request.adaptTo(MyModel.class) . Unfortunately, I found nothing, so decided to write it myself. So in this article, I will show you how to write custom Sling Model injector on the example of Sling Model Request Parameter Injector.&lt;/p&gt;</description></item><item><title>Bot Dev: Write a stateful Telegram bot – Part 2</title><link>https://taradevko.com/2017/01-09-write-stateful-bot-telegram-part-2/</link><pubDate>Mon, 09 Jan 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/01-09-write-stateful-bot-telegram-part-2/</guid><description>&lt;p&gt;In the &lt;a href="https://taradevko.com/2017/01-02-write-stateful-bot-telegram-part-1/"&gt;first article&lt;/a&gt;, we implemented pretty simple Telegram bot, which gathers user requests to fix something. It’s already can be used in our business while we want to post-process requests with a separate tool. But, maybe, it would be too easy for us, so we will go ahead.&lt;/p&gt;
&lt;h3 id="application-requirements"&gt;Application Requirements&lt;/h3&gt;
&lt;p&gt;In this article we will add next features to our bot:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;initial authentication of our repairers&lt;/li&gt;
&lt;li&gt;requests broadcasting to our repairers&lt;/li&gt;
&lt;li&gt;request assignment to the repairer&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="telegram-bot-deeplinking"&gt;Telegram Bot Deeplinking&lt;/h2&gt;
&lt;p&gt;Let’s imagine that we have some separate administrative tool for our bot. And there we defined several unique IDs and assigned them to our employees/friends ( friends-employees? Why not). And now we need to authenticate them in our bot, so we can send them fix requests from our customers. We can use &lt;a href="https://core.telegram.org/bots#deep-linking"&gt;deep linking&lt;/a&gt; from Telegram to solve this task.&lt;/p&gt;</description></item><item><title>Sling Models: Why do I like @Self annotation?</title><link>https://taradevko.com/2017/01-05-sling-models-self-annotation/</link><pubDate>Thu, 05 Jan 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/01-05-sling-models-self-annotation/</guid><description>&lt;p&gt;At some point, &lt;a href="http://alistair.cockburn.us/Hexagonal+architecture"&gt;Hexagonal architecture&lt;/a&gt; has been introduced to me. It espouses a one-way flow of dependencies - from the outside, in.  And this is a great way to increase maintainability. However, we still need to access request and other external resources in our Sling Models. That is where @Self annotation can be used.&lt;/p&gt;
&lt;h2 id="self-annotation"&gt;@Self Annotation&lt;/h2&gt;
&lt;p&gt;According to the documentation, this annotation injects the adaptable object itself. If the @Self annotation is present it is tried to adapt the adaptable to the field type.&lt;/p&gt;</description></item><item><title>Bot Dev: Write a stateful Telegram bot - Part 1</title><link>https://taradevko.com/2017/01-02-write-stateful-bot-telegram-part-1/</link><pubDate>Mon, 02 Jan 2017 00:00:00 +0000</pubDate><guid>https://taradevko.com/2017/01-02-write-stateful-bot-telegram-part-1/</guid><description>&lt;p&gt;Why do we need all these bots? Why people are talking about them so much? What the bot is good for? Look around, it&amp;rsquo;s 2017 outside and nobody uses phones for calls only. Even more: today a lot of people prefer chatting to calling somebody.&lt;/p&gt;
&lt;p&gt;But, you are still forced to make calls to get a taxi or to understand why your LAN connection is down (oh man, you again forgot to pay for it!). How often are you listening to the music, when you are on hold, instead of doing real business? That&amp;rsquo;s fine when it&amp;rsquo;s Bach, but what if it&amp;rsquo;s Justin Bieber instead? They are just wasting your time!&lt;/p&gt;
&lt;p&gt;Chat is a better medium for a lot of people. But, yeah, you still will wait until there is a free person to respond you. Ok, finally somebody responded to you, but what if that person is in bad mood? So it still looks too unreliable and complicated. That is where bots come into play.&lt;/p&gt;</description></item></channel></rss>