Showing posts with label AEM. Show all posts
Showing posts with label AEM. Show all posts

Thursday, May 16, 2019

Adobe Experience Manager (AEM) Link Transformer

I've been taught the wrong way to configure the Adobe Experience Manager (AEM) /etc/mappings in the past. There's zero documentation about how your URL, rendered from the Path Browser widget, gets Transformed to a relative URL hiding /content/sitename. Everyone says that the node name is important (it's not). So after spending an hour trying to sort this out, here's how it works.

You can create your own Link Rewriter by implementing the org.apache.sling.rewriter.Transformer interface. Adobe comes with one out-of-the-box that will use the Sling Mappings for Resource Resolution (a.k.a. /etc/mappings). The key is setting up your /etc/mapping correctly.

Here's an example of an /etc/mapping for a SSL (https) Site:


The OOTB Link Transformer will traverse your configured /etc/map directory from top to bottom, based on the node order. This is why setting the "jcr:primaryType" to "sling:OrderedFolder" is so important.

As it traverses the nodes, the first sling:internalRedirect regex that matches the link path will be used to rewrite the URL to what is set in the sling:match property. It uses the following values to rewrite the link:

  • Protocol is selected based on the parent http or https;
  • The regex grouping(s) that are created from the sling:internalRedirect property are used when rewriting the link; and
  • The link will be rewritten using a combination of the protocol and the sling:match regex.


This is why using a sling:OrderedFolder is so important. As all sites should be https; if we have multiple sites and domains, and we offer linking via AEM Path Browser between them, we need to configure the sites to create fully qualified URLs with https. Without an Ordered Folder, http configurations would be ordered above https and this wouldn't work. Same with doing multiple mappings within a protocol node.

Finally, whatever domain is configured to at the Dispatcher will be used as part of Link Transformer to match and write a relative path. So...

  • If your domain is bmxcode.com and that points to your reverse proxy;
  • Your domain bmxcode.blogspot.com points at your AEM instance; then
  • Set your "sling:match: property to "bmxcode.blogspot.com/$1" and this will rewrite your links as relative URLs (without the protocol and domain).


Hope this helps!

Friday, March 31, 2017

Adobe Activation Core Services (DTM) integrating with Adboe Experience Manager (AEM)

Adobe has rebranded their Dynamic Tag Manager (DTM) to now be called Activation Core Services.

There are two ways to integrate Adobe Experience Manager to Activation Core Services:
  • The Nice Way - Using Cloud Integrations
  • The Nasty Way - Adding the Head and Foot scripts directly to your templates.
I'm not going to go through the Nasty way, except that it's quick, dirty and, well, nasty!

Configuring it via Cloud Services you need to get your Marketing Cloud API token. To get this, you need to contact Adobe Client Care for API token by emailing clientcare@adobe.com.

https://helpx.adobe.com/dtm/kb/How_to_retrieve_API_token_for_DTM_account.html

Friday, September 16, 2016

AEM Quick Tips

How to find the runmode
http://host:port/system/console/status-System%20Properties
Listed as sling.run.modes

How to find the version info
http://host:port/system/console/status-productinfo

Wednesday, August 24, 2016

Setting up an AEM 6.2 project with Archetype 10

Adobe hasn't released a new Archetype for Adobe Experience Manager 6.1 and 6.2, so the AEM dependancies have not been updated to use the aem-uber.jar. I noticed this when I extended WCMUse in 6.2 and it was not deprecated. This has been replaced by WCMUsePojo in 6.2. Here's what you need to do to get your AEM project working with aem-uber.jar.

Update the AEM dependency in the project root pom.xml file:

Update the referenced dependencies in the core, it.tests, ui.apps and ui.content module pom.xml files:

That should do it, now WCMUse is deprecated!

Thursday, July 28, 2016

Content Fragment Templates in AEM 6.2 means content centric sites!

Just had the opportunity to start digging through the AEM 6.2 changes, upgrades and improvements and I've stumbled across Content Fragment Templates. WOW! So many times I've seen, heard and been requested to be able to create Content Types and reuse content snippets in an easy and manageable fashion in AEM, and now it's possible.

Content Fragment Templates will allow us to create fragments of content, containing a combination of text, images and whatever we want, in a template format, with renditions, then drag and drop it into a page as if we were adding in an Asset. Great news for replying to every RFP that asks for this!

Check it out on the Adobe AEM Help:

https://helpx.adobe.com/experience-manager/using/content-fragments.html

Friday, May 6, 2016

ACS Commons twitter4j bundle not resolved

We were getting an annoying error in our log files due to the ACS Commons Twitter integration not being able to resolve the twitter4j dependancy. We were seeing this in the logs and one of the bundles remained in an "Installed" state.
06.05.2016 10:11:22.263 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle com.adobe.acs.acs-aem-commons-bundle-twitter [519]. Reason: {}. Wil
l retry.
org.osgi.framework.BundleException: Unresolved constraint in bundle com.adobe.acs.acs-aem-commons-bundle-twitter [519]: Unable to resolve 519.0: missing requirement [519.0] osgi.wiring.package; (&(osg
i.wiring.package=twitter4j)(version>=3.0.5)(!(version>=4.0.0)))
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3980)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2043)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:976)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:963)
        at org.apache.sling.installer.core.impl.tasks.BundleStartTask.execute(BundleStartTask.java:93)
        at org.apache.sling.installer.core.impl.OsgiInstallerImpl.executeTasks(OsgiInstallerImpl.java:735)
        at org.apache.sling.installer.core.impl.OsgiInstallerImpl.run(OsgiInstallerImpl.java:249)
        at java.lang.Thread.run(Thread.java:745)
In the OSGi Bundles, we're seeing the following:
After a bit of digging I came across the ACS AEM Bundles page and there it is, our missing twitter4j bundle!

Installing the com.adobe.acs.bundles.twitter4j-content-1.0.0.zip bundle resolved the missing constraints, allowed the ACS Commons Twitter bundle to be installed and got rid of the constant errors.

Hope this helps someone else out there!

Thursday, April 21, 2016

AEM Quartz Scheduler Cron Expressions

AEM uses the Quartz Scheduler to configure scheduled services. The full details of the schedule expression can be found at at the Quartz Scheduler Tutorial Lesson 6: CronTrigger.

Wednesday, April 20, 2016

Easier way to find AEM cURL Commands

We've been in the process of automating everything on AEM 6.0 and this means we have to dig around and find the cURL commands that we need to run from our Puppet scripts. I used to follow the technique where I would look for the POST request after clicking a button in AEM, then looking for the URL and what parameters were passed down, then manually compile a cURL command.

This has now all changed!

In Chrome, you can now open the Developer Tools, select the Network Tab, complete your POST request, then right click on the POST URL and select "Copy as cURL". This generates the cURL command! On Chrome Windows, it gives you the option to select a CMD or Bash version.
From here you can strip out what's not necessary and you're good to go!

Tuesday, April 19, 2016

The AEM 6.0 SP2 Author Primary and Standby Switch

I spent a couple hours getting a AEM 6.0 Service Pack 2 Author Standby switched to the Author Primary. The How to Run AEM with TarMK Cold Standby doc gives some great details about to create and configure the TarMK Cold Standby. There was a bit of a fail in the details of switching the Cold Standby to become the Primary.

After a bit of digging I came across Jayan Kandathil's blog post at CQ-OPS: How to Configure an AEM 6 “Cold Standby” Failover Instance and it pointed the the missing step in AEM 6.0.

Assuming that the Author Primary and Standby are active, working and syncing data, the steps to switch the Standby to Primary should go:

  1. Shutdown the Author Primary (it's failed anyway).
  2. Shutdown the Author Standby.
  3. Snapshot/backup the Author Standby crx-quickstart directory (to use when creating the the new Author Standby).
  4. On the Author Standby instance, move (if testing) or delete (if failover) the /crx-quickstart/install/install.standby directory.
  5. On the Author Standby instance, create the /crx-quickstart/install/install.primary directory. Add in the 3 required config files for the Author Primary.
  6. On the Author Standby instance, update the /crx-quickstart/bin/start script and set the runmode from "standby" to "primary"
  7. On the Author Standby instance, start AEM. This is now the Author Primary.
If you don't remove the install.standby, it still starts in Standby mode. In Standby mode, you can access the System Console, but you have no access to the CRXDE or to AEM Sites. Removing the directory is what ensures that it has started as the AEM Primary.

Monday, January 18, 2016

Creating a file in AEM via CURL

I've just come across a requirement to create a status.html file that's purely used as a health check file. to move a stack in or out of the load-balance pool. If the file exists (returns a 200) then the node is in the pool; if it 404's then it's out of the pool.

Searching around I couldn't find much until I came across this post on the Adobe Forums: How do i create a nt:file using Curl? and that gave me the correct command to use.
echo "OK" | curl -u admin:admin -T - http://localhost:4502/etc/hc/status.html
What we're doing here is creating the contents of the file using echo and piping this into the "-T -" as the file contents. Pretty nifty!

Friday, December 4, 2015

Setting up IntelliJ for AEM 6.1

I'm lucky enough to run my development on a MacBook Pro. I like the Terminal that's offered and after you get over using your thumb on the command key instead of your pinky on the Ctrl key, you're off and running! Here's how I set up IntelliJ for Mac.

If brew is your friend, cask is your bestie! Install both of these to set up your MacBook in minutes, all from the Terminal! It will set up and configure all the tools we need to set up IntelliJ. Here's the steps to install brew and cask, otherwise you can follow the details on each site.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install caskroom/cask/brew-cask
You'll have to enter your MacBook password for each and within a few minutes you're set up to start installing everything else. From the Terminal we can now search brew and cask to find the applications we need to install simply by running a search.
brew search enter-search-term...
First off the bat we need Java JDK 8 for AEM 6.1 so let's install Java 8 from the Terminal with Brew Cask.
brew cask install java
Now we want Apache Maven so that we can build our AEM Project. This one comes from Brew.
brew install maven
We might need GIT...
brew install git
And finally we want IntelliJ IDEA Community Edition...
brew cask install intellij-idea
Done! Now all our default software is installed!

Finally we need to install IntelliVault so that we can interact with the CRX repository. Open Eclipse then select Configure > Plugins > Browse Repositories... then type IntelliVault and install. IntelliJ will be restarted.

While this is restarting, we need to get a copy of FileVault. This comes as part of an AEM install located under <aem-install>/crx-quickstart/opt/filevault. Unzip filevault.zip.

After IntelliJ has restarted, navigate to Preferences > Other Settings > IntelliVault and update the following:

  • Vault Directory: <unzipped-filevalut.zip-dir>/bin


Monday, September 28, 2015

Developing Page Content in AEM for a Future Release - Launches

We've had a requirement that has come from a customer who has basically said...
Each region/section of the home page is modified by a different content owner. They make changes independently of each other and they would like to have their region/section published independently.
Adobe Experience Manager (AEM) is a page-centric content management system at its core. You build pages from templates and components. There are other CMS's, such as OpenText Web Experience Manager (WEM) that are content-centric. You build content items and assign them to channels and/or a template to build a page.

Our customer has been using a content-centric CMS for almost a decade and old habits die slow. There has been a huge push to get things working "like the old system".

When you dig to the root of this requirement, what they are really after is a way to efficiently develop the content on an activated page for a future release while still maintaining the production content. That's where AEM has offered Launches!

To create a Launch from the Touch UI console, navigate to any page within the Sites Menu, click on Create > Create Launch. There is no need to navigate to the page that you want to create a Launch for as you are forced to navigate to it through the Launch Wizard. Navigate through to your page and click Next.
There are two main options when creating a launch; to create the launch with existing content or to create a launch using a new template to replace the page.

If you create a launch using a new template, you are creating a new page with a new template that will replace the existing page. The final step you are asked to select the new template before you create the launch.

If you select to use existing content then you can select to exclude sub pages and/or inherit source page live dataBy default sub pages are copied over as part of a launch. Check the exclude sub pages box if you do not want the sub pages to be included as part of a launch. Inheriting source page live data is a feature that allows you to treat the launch page in the same way as a Live Copy page. Checking this option allows the launch page to stay in sync with any changes made to the source/live page unless you cancel inheritance.

The References section shows you how many Launches are associated with a page. To work with the content within a Launch, select the page and click References > Launches > Launch Title > Go to the page. This will open up the Launch Page.
If you have select to inherit the source page live data, you will need to Cancel inheritance on any component you want to modify. If the page does not inherit the source page live data, you can just change the page at will.

Launches also allow you to create a Nested Launches (Launch within a Launch). This is a very powerful feature but can also become very complicated! The key thing is that inheritance works from the point where it has been cancelled or from the source page. Sub Launches are labelled as the Launch Title (Parent Launch Title).

To promote a Launchselect the page and click References > Launches > Launch Title > Promote launch. From here you can specify the Scope (to promote the full launch or just the page changes and sub pages) and you can specify the Target if this is a Nested Launch. After the promotion has run, you can publish the page changes.

To delete a Launch from the Touch UI console, navigate to Tools > Operations > Launches. This will take you back into the Classic UI console. From here you can select and delete a configured Launch.

Thursday, September 17, 2015

OOTB Forms VS AEM Forms

Adobe Experience Manager has two Forms products:
  • Default (Out Of The Box) Forms - The very basic form components to build simple forms within a page; and
  • Experience Manager Forms - Previously known as AEM Forms this is the full-blown, Lifecycle integrated Adaptive Forms suite. It's also an additional license cost!
The way the Adobe Doc's site has been reformatted makes it difficult to find any information. I'm posting this blog as an easy way for me to reference the documentation for each.

Default OOTB Forms
Experience Manager Forms (The Paid Version)

Thursday, September 10, 2015

Preparing AEM Archetype 10 for Development

Adobe Experience Manager 6.1 has a new AEM Maven archetype 10 provided to help you generate your base project structure. This new archetype adds some new modules and a lot of sample content to guide you through the development process.

The sample content is a blessing and a curse! A blessing because it shows you the simple things and a curse because you have to strip the generated project down to use it for your enterprise project. Here's a list of what I strip out.

module: core
  • /src/main/java/project-path
    Delete all folders under this project-path as each one contains a sample implementation. These core samples are removed as they are samples only and not all will be used in a project. Folders are recreated as they are needed.
  • /src/main/test
    All of the packages under the core/test folders are deleted. As the JUnit test cases are written the test package structure will be created.

module: it.launcher
  • /src/main/java
    Remove all of the packages below this project and only add code in here when it is required for JUnit server side testing
  • /src/main/test
    Remove all of the packages below this project and only add code in here when it is required for JUnit server side testing

module: it.tests
  • /src/main/java
    Remove all of the packages below this project and only add code in here when it is required for JUnit server side testing
  • /src/main/test
    Remove all of the packages below this project and only add code in here when it is required for JUnit server side testing

module: ui.apps
  • /src/main/content/jcr_root/apps/appFolderName/components
    Remove all of the sub-folders under the components folder. These components are sample components only.
  • /src/main/content/jcr_root/apps/appFolderName/config
    Remove the logger configuration from this folder. This folder will contain any configuration that is created during the project.
  • /src/main/content/jcr_root/apps/appFolderName/config.author
    Remove the mobile emulator configuration from this folder. This folder will contain any author configuration that is created during the project.
  • /src/main/content/jcr_root/apps/appFolderName/i18n
    If the project contains multilingual, remove the content of this folder and recreate it for each language. Otherwise, remove the i18n folder completely.
  • /src/main/content/jcr_root/apps/appFolderName/templates
    Remove the folders within the templates folder. These templates are sample templates only.
  • /src/main/content/jcr_root/apps/appFolderName/tests
    Remove the tests folder.
  • /src/main/content/jcr_root/etc/designs/appFolderName/*
    Remove the folders within the etc.designs.appFolderName folder and the content from this folder.. This references the deleted components and will need to be recreated with the project specific implementation.

module: ui.content
  • /src/main/content/jcr_root/content/dam/siteName
    Remove the folders (_jcr_content and asset.jpg) but leave the .content.xml node definition file.
  • /src/main/content/jcr_root/content/siteName
    • For a single site, remove the folders and only keep the .content.xml node definition file. Update the .content.xml file to use the sling:resourceType to point to the home page component that will be defined later in the project.
    • If the project has multilingual sites, then leave the en folder (or the folder of the default language) update the .content.xml node definition file and set the redirectTarget to point to the site default.

Thursday, August 27, 2015

AEM 6.1 Archetype Details

There's a new Adobe Maven Archetype 10 with Adobe Experience Manager 6.1 and a few new options that are available. This has disappeared from the Adobe Docs so here's the details.

When creating a new project from the command line, the minimum maven generate parameters are only the archetypeGroupId, archetypeArtifactId and the archetypeVersion. The rest of the required parameters are prompted for population as the script runs.
mvn archetype:generate \
 -DarchetypeGroupId=com.adobe.granite.archetypes \
 -DarchetypeArtifactId=aem-project-archetype \
 -DarchetypeVersion=10
The following table details the additional parameters that are required to generate an AEM 6.1 project using the Adobe AEM Archetype 10.

Property 
Description 
groupId
This is the standard Maven group property that uniquely represents the path to the artifact within a repository manager such as Nexus, Artifactory or Archiva.
artifactId
This is the standard Maven property that uniquely represents the artifact within the above Group.
version
This is the standard Maven property that defines the version of the artifact.
package
This is the java base package that is used within the modules of the maven project that is created.
appsFolderName
This defines the AEM Apps folder names for the project.
artifactName
This defines the description in pom.xml
componentGroupName
This defines the name that is used to group all the components in the sidekick/content finder within AEM.
contentFolderName
This defines the AEM content folder names for the project within the JCR structure.
cssId
This defines the prefix used when generating CSS.
packageGroup
This defines the name of the content package group. This value configures the group parameter for the Package goal of the Content Package Maven Plugin.
siteName
This configures the AEM site name.

The following describes how the project is generated and how each archetype parameter influences the project build.

/artifactId
├─ /core
|  ├─ /src/main/java/package.core
|  ├─ /src/test/java/package.core
|  └─ pom.xml {
|        <sling-model-packages>
|            package.core
|        </sling-model-packages>
|    }
├─ /it.launcher
|  ├─ /src/main/java/package.it.launcher
|  └─ /src/test/java/package.it.launcher
├─ /it.tests
|  ├─ /src/main/java/package.it.tests
|  └─ /src/test/java/package.it.tests
├─ /ui.apps
|  ├─ /src/main/content/jcr_root/apps/appsFolderName
|  ├─ /src/main/content/jcr_root/etc/designs/appsFolderName
|  └─ pom.xml {
|        <group>packageGroup</group>
|     }
├─ /ui.content
|  ├─ /src/main/content/jcr_root/content/contentFolderName
|  |  └─ .content.xml {
|  |        <jcr:content jcr:title="siteName" ></jcr:content>
|  |     }
|  ├─ /src/main/content/jcr_root/content/dam/contentFolderName
|  |  └─ .content.xml {
|  |        <jcr:content jcr:title="siteName" ></jcr:content>
|  |     }
|  └─ pom.xml {
|        <group>packageGroup</group>
|     }
└─ pom.xml {
       <groupid>groupId</groupid>
       <artifactId>artifactId</artifactId>
       <version>version</version>
       <artifactName>artifactName</artifactName>
   }