Posts Tagged “AEM”

Using Grunt in an AEM Maven build

This post is a guide on how to establish a functional Maven build for AEM that includes Bower front-end dependency management and Grunt task management. The Grunt build will download Bower dependencies, move them to a client library, then create their respective .content.xml, css.txt, and js.txt to be used at...

Bulk file transfers with WebDAV

Bulk asset transfers to a JCR are sometimes tedious especially when using AEM's Assets Manager or Site Admin. Adobe has tutorials on how to upload to the DAM and accessing AEM via WebDAV. This tutorial will make accessing AEM's JCR via WebDAV clear for current versions of Windows and OSX,...

Vaulting to AEM

Image Credit: "DK Vault" By Dinoenthusiastguy Licensed under CC BY-SA via Wikia Using the CRX (Content Repository eXtreme) via CRXDE can be cumbersome especially for testing, the following are easier ways to interact with the CRX via common IDEs. The basic concept is similar to git where as to pull...

CQ Haiku: Analytics

web leads submitted without any analytics trees fell silently I'm sure many of us in the Web Development world have run into this scenario: you're 70-85% of the way through a website implementation and someone says "oh, hey... we need to add analytics."  So a ticket is added into the backlog, a s_code.js file gets added into source control and some klugy JavaScript library gets cobbled together to track most (but not all) of what visitors...

Creating a site footer in AEM 6 using Sightly and Sling Models

The Adobe-developed and [recently-donated-to-Apache-Sling](http://blogs.adobe.com/experiencedelivers/experience-management/donating-sightly-apache-sling/) project [Sightly](http://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html) project has been out for a little under a year now, alongside Adobe Experience Manager 6, and has slowly been amassing documentation and gaining presence. The server-side templating language aims to give a facelift to the web development facet of Java-based software stacks, Adobe's...

CQ Haiku: JCR vs. Sling

Adapt to Node like Assembly inside Java Use Sling API Quite often I see code, especially from less experience developers, with something like this: Node node = resource.adaptTo(Node.class); String property = null; try{ property = node.getProperty("myProperty").getString(); } catch (RepositoryException re){ log.error("Exception accessing myProperty", re); } Or even scarier, there may be just a global exception handler for the particular method. Either way, this code is a lot more fragile than it needs to be. If...

AEM-Lingotek Translation Connector Webinar

Are you using a custom or legacy integration for managing your translations in AEM?  Are you interested in supporting both machine and human translation? Do you want to make your translation process easier, cheaper and more reliable? If so the AEM-Lingotek Translation Connector Webinar is for you! Now it's easy to quickly translate your content directly from within Adobe Experience Manager (AEM) using the new Lingotek - Inside AEM Connector. Developed by Six Dimensions, an Adobe Business...

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...

Escaping the Dreaded VerifyError

Recently (read early this afternoon) I was doing my best to beat my head against the desk until something useful spilled out.  The problem I was having was with a relatively old, but frequently updated codebase where recently certain random services would not start. The project had recently updated from Java 1.6 to Java 1.8 and at some point, the problem occurred but had not been noticed immediately as it only affected a small subset of...

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....

9 JCR-SQL2 Queries Every AEM Developer Should Know

JCR-SQL2 queries are useful items in every AEM Developer's toolbag.  They are relatively quick, aren't deprecated and have a familiar SQL like grammer. JCR-SQL2 queries can be invoked from the JCR API: Session session = ...QueryManager queryManager = session.getWorkspace.getQueryManager();Query query = queryManager.createQuery("{QUERY}", Query.JCR_SQL2);QueryResult result = query.execute(); or through the Sling API: ResourceResolver resolver = ...Iterator<Resource> result = resolver.findResources("{QUERY}", Query.JCR_SQL2); Although there is an official specification for JCR-SQL2, there aren't a ton of really good resources out...

Debugging Apache Axis 1.4 with SLF4J

In my previous blog post, I discussed getting Apache Axis 1.4 working in AEM. One of the more interesting things about Axis 1.4 is that it's not easy to log the actual request from the client and response from the server.  You can configure the LogHandler, however it is somewhat problematic in AEM to configure due to the classpath complexity in OSGi and it will only log to the system outputstream.  This is problematic in...

Running Apache Axis 1.4 in AEM

Despite doing several Web Service implementations over the last couple years, I have successfully avoided using Apache Axis until now.  A client's Web Service implementation was incompatible with the code generation tools available in more modern Web Service clients, such as Apache CXF.  While there is documentation around using Axis 2 with AEM, there isn't really anything available for Axis 1 in AEM, which is what I needed to use.  So, I rolled up my sleeves...

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,...

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...

Monitoring AEM with New Relic

I love New Relic.  Their server monitoring tools allow me to remotely monitor my various servers and development applications for free and their stuff just works.  Recently, we were running into an issue at Six Dimensions where a couple of our development servers were toppling over and without any real monitoring in place we couldn't tell why.  To address this, we've been rolling out New Relic on all of our development servers.   As part...

My AEM Development Setup

I'm pretty particular about how I like to lay out my computer for development.  Ideally a good setup would:  Exist within my user's home directory  Contain short but meaningful folder names  Allow for multiple versions of an application To support this I create three folders:  dev - contains some app data and development utilities  git - contains all of my GIT repositories  scripts - contains custom shell scripts The git and scripts folders are pretty straight forward....

Modify the OOTB LinkChecker Config

I've come into the issue recently of needing to modify the prefix and suffix for invalid links detected by the linkchecker. This seemingly simple task is unfortunately not as easy as overlaying the /libs/cq/linkchecker/config.author/invalid to /apps/cq/linkchecker/config.author/invalid. For reasons unknown (to me at least) the standard overlay does not work for this type of update. Instead, after digging into the code, I found this information: REQUEST_ATTRIBUTE_NAME = LinkCheckerSettings.class.getName(); LinkCheckerSettings settings = (LinkCheckerSettings)request.getAttribute(REQUEST_ATTRIBUTE_NAME); The above lines indicate...

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...

Creating and Configuring your Maven Project for AEM

The goal of this document is to have a maven project that builds a single asset (the package profile) to deploy all Servlets, Services, and JCR Code. In addition to this, for development purposes we want to be able to build each item listed above individually, such that we do not require a full build to test a simple JSP change. For starters, this is a fairly common project structure that we'll be basing this...

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...