May 13, 2020
Estimated Post Reading Time ~

AEM Concepts

The following sections are a few concepts that are very important in AEM, while some are not used regularly they should be understood when designing and building AEM sites
Run modes
Every server has a set of run modes, the basic ones of author and publish tell AEM if it is in authoring or publishing mode, and hence which systems to run.
A default installation of AEM will come with a few run modes which setup default content. While removing these via the nosamplecontent run mode will take away the content they also put the server in production mode which will mean that certain systems that you would need as a developer won't run.
These are the changed that occur in production mode:
  1. The CRXDE Support bundle (com.adobe.granite.crxde-support) is disabled by default in production ready mode. It can be installed at any time from the Adobe public Maven repository. Version 3.0.0 is required for AEM 6.1.
  2. The Apache Sling Simple WebDAV Access to repositories (org.apache.sling.jcr.webdav) bundle will only be available on author instances.
  3. Newly created users will be required to change the password on the first login. This does not apply to the admin user.
  4. Generate debug info is disabled for the Apache Java Script Handler.
  5. Mapped content and Generate debug info are disabled for the Apache Sling JSP Script Handler.
  6. The Day CQ WCM Filter is set to edit on author and disabled on publish instances.
  7. The Adobe Granite HTML Library Manager is configured with the following settings:
    1. Minify: enabled
    2. Debug: disabled
    3. Gzip: enabled
    4. Timing: disabled
  8. The Apache Sling GET Servlet is set to support secure configurations by default, as follows:

MSM
MSM or multi-site manager is the function that allows you to replicate content. This is generally used when you want to have a base site and extend it to another language/country sites.
MSM Example
As you can see in the diagram above you can use a base site that using the "Rollout" function in AEM you can extend to country sites and then to language sites. This allows an editor the ability to change the content at the base site and roll that out to all child sites. A child site always has the ability to disconnect from the inheritance of either the page or a component on the page so that they will always have their own content
Replication
Replication is the process of sending content from the author to all of the publishers in the stack, reverse replication is the reverse when content is sent to the publisher from the user and needs to be sent to the author, usually so that it can be replicated across all of the publishers.
While most content will forward replicate, users and groups cannot be reverse replicated. There is a sling tunnel tool that will allow you to replicate user data between the publishers. This is not covered in this document.
In the menu replication will open with the following options where you will be able to configure the appropriate agents:
  • Agents on Author
    • Configure any of the authoring agents.
    • Only relevant to the author server
    • Setup forward replication to publishers
    • Setup reverse replication to pull from the publishers
  • Agents on Publish
    • Configure any of the publishing agents
    • Only relevant to the publish server
    • Setup Reverse replication to fill the queue for the author(s)
    • Set up Dispatcher flush
  • Activate Tree
    • In general, in the site manager, you can only replicate a single page, this allows you to replicate the page and all subpages
    • It is very intensive on the platform and should only be used when really necessary.
    • Has options to how the replication is done
      • Only Modified
        • Only sends the content that has changed since it's last modification
      • Only Activated
        • Only sends the content that has at some time been activated
      • Ignore Deactivated
        • Doesn't send content that was deactivated
Workflows
Workflows are a powerful way of adding editorial control over the content, or for putting in a coded structure when events occur. For more information view the documentation
AEM provides a visual editor so you can drag and drop components into the workflow. Workflows can become very complex and as a developer, you can add additional steps to the workflow via code. This will be discussed later in the code section.

The main items in the workflow toolbox that you need to understand are:
  • Participant step
    • Used to add the workflow into a user's inbox so they can decide on the next step.
    • There are 3 types of participant steps
      • Dialog Participant Step
        • Opens a dialog to pick who needs to interact with the workflow next
      • Dynamic Participant Step
        • Uses a piece of code to pick who needs to interact with the workflow next. This code will need to be written
      • Form Participant Step
        • Allows the user to enter more information before the workflow is redirected to the selected user/group
  • Flow steps
    • A workflow can have and or flows
    • And Split
      • Allows the flow to move down multiple tracks
      • Supports up to 5 routes
      • Each route works independently But will come back to a single point in the flow
    • Or Split
      • Allows the flow to move down one of the flows based on programmatic decision making or from user interaction
      • Supports up to 5 branches
  • Process Step
    • The process step runs a piece of java code that will have access to the metadata of the workflow and be able to get and set data.
Sling Mapping
Sling mapping is the way of mapping content to different URLs. i.e. in the jcr:content you have your site on /content/site/language/index however you don't want that url structure to be shown to the end-user so you use sling mappings to map both forward and reverse mappings
  • Forward mappings
    • Changes a url entered by the end-user into a location in the jcr:repository i.e /index.html → /content/site/language/index
    • Is constrained to the domain that it is configured in
  • Reverse mappings
    • Changes a link or reference on the page to the new external url. i.e. /content/site/language/index → http://domain1/index.hml
    • The first content mapping of the internal reference is the one used.
      • If you have 2 domains using the same content i.e. domain1 and domain2 and both have the same reverse mapping, the first one would be used no matter what the inbound domain that is being used.
    •  If you use regex for reverse mappings, AEM will log errors, the error means that the mapping cannot be used for forwarding mapping
Sling mappings by default are installed in /etc/map and will run on both the author and publisher. It is not recommended to have them run on the author as it sometimes affects how the content editors work.
In the examples I show in the coding section I will show you how to change the location of the mapping for the publisher so that it gets it maps from /etc/map.publish
In the mapping folder, the next level down is the protocol level, either http or https dependant on how your application is running. Please note that if you are running through a load balancer and dispatcher it is possible that the https side of the mapping will be lost and you will need to add your mappings into the http folder.
Link Checker
AEM uses the link checker functionality when you put a reference to anchor or image tag in sightly it will use the link checker to determine if the url is a valid url, and if not it turns the item into a paragraph tag instead.
This can be quite problematic when you are using sling mappings as it quite often determines that your link is invalid, I will show you a small utility that gets around this issue.
Parsys
In AEM the parsys is an area in the UI layout that other components can be dropped into. It is a container that an editor has the ability to fill with either your application components or the stock AEM components. 



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.