Posts Tagged “Best Practices”

Three AEM / DPS Tips

I recently created a reference integration between Adobe Experience Manager (AEM) and Adobe Digital Pubishing Suite (DPS). AEM 6.1 ships with an integration between the two tools, along with a reference implementation, Geometrixx Media. This is a very exciting solution, as it allows non-technical authors to publish content to DPS apps. The AEM...

Embedding Oak Index Configurations into a Package

AEM 6 ships with a new repository, CRX3 which is based on Apache Oak, a subproject of the Apache Jackrabbit project.  This repository promises significant performance increases over CRX2, however it does require a bit more work to setup.  Unlike CRX2, CRX3 requires you to explicitly declare which fields will be indexed.  If a field is not indexed, you will see an error like the one below in the error.log and significant performance degredation: 16.01.2015 13:56:45.206...

Sling Models for Fun and Profit

Recently, I finally had a chance to leverage Sling Models for a new project.  If you are not familiar with Sling Models, they allow developers to inject methods and fields based on resource properties, other resources and OSGi services.  For those developing in AEM 6, Sling Models are available as part of the default installation, for those on older versions of AEM / CQ5, Sling Models are available as downloadable bundles on the Sling website.  Sling Models...

Creating Custom CQ/AEM Workflow Process Step

It's no secret that CQ/AEM Workflows are quite powerful, but what happens when the default process steps aren't what you need? In a case like this you need to create your own custom process step. In this article I will detail the steps you need to take in accomplishing this. 1) This tutorial is going to be completed in java, drill down into the Java portion of your code base and create a java file....

Using the cq:template file

Often when developing Components I find that I need to specify a default value that is set as soon as the component is dropped on the page. Today I want to show an easy and quick way to do this using cq:template. 1) In CRXDE navigate to the component that you need the default value for. 2) On the same level as the component dialog create a node titled "cq:template" of type "nt:unstructured". Your component...

Tailing AEM Logs in Eclipse

My typical workflow for developing with AEM frequently involves reading from logs.  Whether it's for checking if bundles and services installed, following the logging of custom code or trying to get a full stack trace of an error, the logs provided by AEM are an invaluable tool.  Until now, this has meant switching back and forth between my IDE (Eclipse) and the terminal.  Dual monitors and Total Terminal help, but it's still not as efficient as it...

Follow Up to Integration Tests in Adobe CQ

In my previous post, I had introduced the idea of integrating testing AEM (CQ5) projects using Apache Sling Testing Framework.  After using the integration testing framework for a while and learning more about the framework, I have come up with some improvements to my original post. 1. Support Testing Existing AEM/CQ5 Instance This makes your tests a lot quicker and easier, instead of starting up a new CQ instance just to run your integration tests,...

Sightly vs Handlebars vs JSP: Comparing Scripting Languages

The latest release of Adobe Experience Manager, version 6.0, introduces two new languages for front end scripting in CQ.   The two languages are both attempting to address the problems found in the existing foundation and Geometrixx reference code, namely the lack of separation of concerns between business and presentation logic and the sloppy use of scriplet.   The two new templating languages are: Sightly Sightly has come from Adobe user groups and seems to be...

WhitePaper: Creating a Better Web User Experience for Intranets & Portals

6D White Paper: The white paper identifies ways to create a better user experience for the visitor and author, and 5 key considerations when moving to a new CMS for Intranets and Portals. Excerpt Moving to a Content Management System Websites are usually moved into a content management system (CMS) for a couple of reasons. The new CMS usually provides a much better user experience for the person editing the site, often called the site...

How NOT to Generate HTML

Recently, I have been working on an integeration between Adobe's Search and Promote and CQ5/AEM.  This work has reminded me of one of my least favorite anti-patterns, embedding HTML markup in Java code.  You tend to see this 'technique' a lot in Servlets, Tags and other Java web technologies.  This is a bad idea for several reasons: It breaks the MVC model It's hard to understand the HTML code It's difficult, if not impossible, to modify the...

Expression Language, Tags and You

One of the things I've seen on many projects which makes code a lot more difficult to read and understand is scriptlet (aka Java inside JSPs). Especially now, there really isn't a good reason you need to ever use scriptlet inside your JSPs, but especially given the prevalence within CQ's codebase it's a common practice. ## Helpful tools Recently, myself and others have been contributing code to make it easier to develop JSPs in CQ...

Simple Web Console Templates

Awhile back, I wrote a blog post about [creating Apache Felix Web Console Plugins](/blog/2013-09-11/service-boss-level-part-2-custom-web-console-plugins/). It's a pretty great technique for creating a diagnostic configuration panel for complex services or applications, however the process for rendering HTML for the consoles is still somewhat stuck in the dark ages. Since servlets are used to render the HTML, you'll generally see HTML being written to the response in the Java code of the Web Console...

The Great and Powerful cq:EditConfig

One of the most under-appreciated features of AEM components, in my opinion, is the cq:EditConfig. This node allows developers to configure how a component is edited, add or remove functionality from the editor and generally tailor the authoring experience for component. The cq:EditConfig is simply a node with the primary type `cq:EditConfig` and the name cq:editConfig under the component root. The cq:EditConfig allows for configuring many important features of the component's editing experience including: *...

AEM Start/Stop Script Modification for a Cluster

When clustering AEM instances there is a required order for shutting down and starting the instances. This however can be very tricky in a shared nothing cluster as the master & slave can automatically swap places at any time for multiple reasons. This means in order to shut down an instance you typically need to identify the master instance first. Conversely in starting up an instance the slave can only be started after the master...

AEM Restricted Backup User

The AEM backup curl command is often passed using admin credentials however for security reasons it may be undesirable to store the AEM admin user's credentials in plaintext form in a system script. To mitigate this instead a generic user can be created and be granted more specific access rights to the granite backup console. This will allow to restrict what this user has the ability to do by only having granted rights to start,...

AEM Live Backup Strategy

AEM has a built in live backup mechanism which works rather well at creating an extractable archive of the complete instance it can take an extremely long and unmanageable amount of time due to the nature of what all it is creating an archive of. By default this backup will consist of the original CQ jar file and everything at an equal level and anything contained in any child directories of that path. While this...

Integration Tests in Adobe CQ

Awhile back I wrote a post on running integration tests in Apache Sling. This technique is useful for developers working directly on Apache Sling, but doesn't support downstream platforms like Adobe CQ/AEM.After some finagling and testing I was able to get a similar technique working using Adobe CQ / AEM instead of Apache Sling. To enable integration tests using Adobe CQ, add the following into your POM.DependenciesFirst, add plugins to copy required dependencies and the...

Six Dimensions Supports the Apache Sling Project: Resource.hasChildren

Recently, I had the chance to shepherd a new feature into the Apache Sling API. This feature adds the method hasChildren to the Resource andResourceResolver. My colleague, Brian Warner suggested adding this method after struggling to do this in a clean, correct way.What's new? The hasChildren method is a convenient shortcut for developers to check whether or not a Resource has child resources. This method returns correctly across different Resource Providers unlike the lower-level API's such as Node.hasNodes(). And this method enables developers to...

The 5 Hardest AEM Concepts for New Developers

Even experienced developers struggle when trying to transition to the Adobe Experience Manager (AEM) platform (formerly Day CQ5). Once you fully grok AEM, it can be a joy to develop against; the APIs are generally straightforward and it makes presenting content easier than any other platform I have encountered. So why do so many developers have trouble ramping up on AEM?AEM turns traditional WCMS products on their head. No other CMS really works in a...

My CQ JSTL/EL Best Practises

In my last article My CQ JSP Development Best Practises we solely talked about JSP related issues, one of which was the use of JSTL/EL.  Not having a reasonable approach for dealing with JSTL/EL can land you in just as much trouble as a poorly constructed JSP.  These practises should help. Variables and MethodsComparison OperatorsTagfiles vs. Classic TagsScoped variables 1) Variable and MethodsThere are two operators to address JavaBean attribute's (getXXX), List and Map values, and scoped variables....

Six Dimensions Supports the Apache Sling Project: New Resource Access Tags

Recently, I had the chance to release a new version of the Sling JSP Taglib. This new version includes a large number of features and improvements which I hope will help developers in Sling-based platforms, including Adobe CQ, develop cleaner and more reusable JSP scripts.What's new? Well, the JSP Taglib allows for access to the Sling Repository without requiring any Java code.  With the previous version of the Sling Taglib, if you wanted to the get the...

New from Apache Sling: Resource Access Tags

Recently, I had the chance to release a new version of the Sling JSP Taglib. This new version includes a large number of features and improvments which I hope will help developers in Sling-based platforms, including Adobe CQ, develop cleaner and more reusable JSP scripts. What's new? Well, the JSP Taglib allows for access to the Sling Repository without requring any Java code. With the previous version of the Sling Taglib, if you wanted to...

My CQ JSP Development Best Practises

I would guess that many or most developers in the CQ development space have their own set of development best practises they operate with.  This is a topic very near and dear to my heart.  It is something that I have spent significant personal time pursuing.  At the end of the day I want readable, maintainable, extensible, bug free code that is not a burden.I have deliberately kept the list short.  These have been primarily...

Beware of Export-Package

Quick - without checking the documentation, what does the Export-Package instruction do in the Maven Bundle Plugin?Did you say "sets what packages are exported by the bundle"?  If so, you're only half right.Recently, I was trying to diagnose some issues with a SOAP Web Services implementation in an existing code base.   Theoretically, everything was in place, however I was getting a ClassCastException when attempting to retrieve the OSGi Service for accessing the SOAP Web...

Three Commonly Missed CQ Best Practices

Recently, I saw this thread on the Day Communique Google Group.  In the thread, a developer asks why he cannot use CRXDE in their production environment.  As it turns out, his employer followed the best practices for hardening CQ instances as recommended by Adobe which disables the WebDav servlet CRXDE uses.  This thread demonstrates three common problems I've seen on CQ installations.  Especially, when the implementers of the CQ installation are not familiar with CQ and...

Simple Container Component Start & End Bars

When creating a container component for Adobe CQ, you often run into an issue where the resulting page is difficult to author as there are too many parsys adjacent to each other.  As bad as this situation is for the component developer, imagine how confusing it must be to authors who don't have a detailed understanding of how the component works.  As you can see from the illustration below of a tab component, when you...

JMeter, CQ SmokeTesting, and much much more

Sometimes when trying to solve one problem, I discover the answer to another yet undiscovered problem.My pet peeve with CQ development is detecting in a semi-automated painless fashion, when templates, components or client side functionality are broken.  While JUnit integration testing catches some issues, what about "client side" integration testing?  The question is, how do you make sure the build you just pushed with Jenkins, that was green, didn't break the functionality of a component,...

What is my CQ Mode?

Figuring out what is the current authoring mode in components in Adobe CQ can sometimes be a tricky prospect.  Determining the current authoring mode is important for component development when you may want to display different HTML or controls to authors than will be displayed to the end users.  As a best practice, the same interface should display in Author and Design mode, as hiding or showing components may affect design.The most obvious solution is...

Consistent and Clean Rich Text and Images in CQ5

How can you improve on the humble TextImage component; the basis for most Adobe CQ5 website implementations?  This component (as one would imagine from the name) allows authors to put both text and an image on the page.  There are both Text and Image components which are suited for each separate task, however it has always seemed silly to me to have two components when one can do both jobs.Well, one of the first tasks...

SlingFilter Addendum

One thing to keep in mind about Filters, their removal should not render your system unusable. For example, the ICS Filter in my last article, if I remove or disable it, the ICalExportServlet continues to function (as well as the rest of CQ) without error. I would say if your application does not function without the functionality you are writing, then a Filter is probably the wrong animal for you.  You could write alot of...

Webinar: CQ5 Development Setup, Maven Build and Deployment

Six Dimensions and 6D-Labs are pleased to announce its 2nd CQ webinar "CQ5 Development Setup: Maven Build and Deployment"  This webinar will cover best practices in building and deploying CQ5 applications.This Webinar is intended for technical audiences, i.e., developers and architects who have existing experience with CQ5.When: Thursday, June 21, 2012 Time: 11:00 - 12:00 PST (1:00 - 2:00 CST 2:00 - 3:00 EST) Where: You'll be sent a Webinar registration upon completing the signup.Topics:The...