AEM DataLayer - WeRetail Reference

Reference implementation of the AEM DataLayer for WeRetail

License

License

GroupId

GroupId

com.perficient.aem
ArtifactId

ArtifactId

weretail-reference
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

bundle
Description

Description

AEM DataLayer - WeRetail Reference
Reference implementation of the AEM DataLayer for WeRetail
Project Organization

Project Organization

Perficient

Download weretail-reference

Dependencies

compile (1)

Group / Artifact Type Version
com.perficient.aem : aem-datalayer.core jar 0.3.0

provided (16)

Group / Artifact Type Version
com.day.cq : cq-commons jar 5.8.2
com.adobe.cq.commerce : cq-commerce-core jar 5.6.8
org.apache.geronimo.specs : geronimo-atinject_1.0_spec jar 1.0
org.apache.felix : org.apache.felix.scr jar 1.6.0
org.apache.felix : org.apache.felix.scr.annotations jar 1.9.6
biz.aQute : bndlib jar 1.50.0
org.osgi : org.osgi.core jar 4.2.0
org.osgi : org.osgi.compendium jar 4.2.0
org.slf4j : slf4j-api jar 1.5.11
javax.jcr : jcr jar 2.0
org.apache.sling : org.apache.sling.models.api jar 1.3.0
javax.servlet : servlet-api jar 2.4
commons-lang : commons-lang jar 2.4
org.apache.sling : org.apache.sling.api jar 2.7.0
com.day.cq.wcm : cq-wcm-api jar 5.7.2
com.day.cq : cq-tagging jar 5.8.6

test (3)

Group / Artifact Type Version
junit : junit jar 4.8.2
org.mockito : mockito-all jar 1.9.5
junit-addons : junit-addons jar 1.4

Project Modules

There are no modules declared in this project.

AEM DataLayer Build Status

This project is an implementation of the Customer Experience Digital Data Layer 1.0 specification produced by the W3C.

It provides a flexible, extensible model for implementers to create a Data Layer in Adobe Experience Manager by implementing clean, reusable Java code.

Modules

The main parts of the template are:

  • core: Java bundle containing all core functionality for the AEM DataLayer including the API and Sling Models for interacting with the AEM DataLayer
  • ui.apps: contains the cloud services configurations and testing mechanism for validating the Data Layer
  • weretail-reference: reference implementation based on the We.Retail Reference site from Adobe

Using this Project

The goal of this project is to create an easily extensible, flexible API for exposing CMS data to Digital Marketing tools. In order to use the AEM DataLayer on your project, you must create Sling Models to expose data to the DataLayer based on your needs.

Installing this Project

The AEM DataLayer is compatible with AEM versions 6.3 and 6.2. To install this project on AEM, download the latest release and install it into the AEM Package Manager.

Installing on AEM 6.2

The AEM DataLayer requires Sling Models API version 1.3.2 or more recent. In order to install AEM DataLayer on AEM 6.2, you must download and install the following bundles:

Implementing Your Data Layer

To get started, you may want to review the weretail-reference project to get a better idea of how to implement the AEM DataLayer for your project.

The implementation process is pretty simple, you simply create Sling Models for each component you want to use to populate your DataLayer. Each Sling Model should implement the interface ComponentDataElement and specify a resource type as shown below:

@Model(adaptables = Resource.class, resourceType = {
	"weretail/components/structure/page" }, adapters = ComponentDataElement.class)
public class DefaultPageDataElement implements ComponentDataElement {

As this is a Sling Model, you can inject any OSGi Service, Resource property or the Resource itself into your Model class.

The ComponentDataElement#updateDataLayer method will be called by the AEM DataLayer API when your Sling Model is adapted from a Resource in order to update the DataLayer.

Getting the Request

Your ComponentDataElement model can also be adapted from a SlingHttpSerlvetRequest. This will allow you to access any Request parameters or attributes. Simply specify the adaptable SlingHttpSerlvetRequest in your Sling Model definition.

@Model(adaptables = SlingHttpSerlvetRequest.class, resourceType = {
	"weretail/components/structure/page" }, adapters = ComponentDataElement.class)
public class DefaultPageDataElement implements ComponentDataElement {

And then use the @Self annotation to inject the SlingHttpSerlvetRequest as a private class variable.

Configuring the AEM DataLayer Cloud Configuration

Once you have installed the AEM DataLayer package, you can set up and configure it as such:

  1. Navigate to the CloudServices Console
  2. Scroll down to AEM DataLayer and add a DataLayer configuration:
  3. Click edit and configure all of the required settings under the General Settings and Page Settings tabs
  4. Navigate to your site root and edit the page
  5. Click Open Properties then the Cloud Services tab
  6. Add an AEM DataLayer configuration and then select your configuration

From here, your page should automatically include the DataLayer. You can use the test feature to validate that your custom DataLayer classes are being evaluated.

How to build

To build all the modules run in the project root directory the following command with Maven 3:

mvn clean install

If you have a running AEM instance you can build and package the whole project and deploy into AEM with

mvn clean install -PautoInstallPackage

Or to deploy it to a publish instance, run

mvn clean install -PautoInstallPackagePublish

Or to deploy only the bundle to the author, run

mvn clean install -PautoInstallBundle

Testing

There are three levels of testing contained in the project:

  • unit test in core: this show-cases classic unit testing of the code contained in the bundle. To test, execute:

    mvn clean test

  • server-side integration tests: this allows to run unit-like tests in the AEM-environment, ie on the AEM server. To test, execute:

    mvn clean integration-test -PintegrationTests

Releasing

The release process is as follows:

  1. Build the Code with: mvn clean install
  2. Update the version with: mvn versions:set -DnewVersion=[new-version]
  3. Commit the new version: git commit -a -m "Updating to release version [new-version] && git push"
  4. Tag the code: git tag [new-version] && git push origin [new-version]
  5. Deploy the code: mvn deploy
  6. Update to the new snapshot: mvn versions:set -DnewVersion=[new-snapshot]
  7. Commit the new snapshot: git commit -a -m "Updating to snapshot version [new-snapshot] && git push"
  8. Update release notes
com.perficient.aem

Perficient Digital

Versions

Version
0.3.0
0.2.2
0.2.1
0.2.0
0.1.0