Architecture - bartoszWesolowski/aem-tips GitHub Wiki
AEM architecture
OSGi
- Stands for
Open Services Gateway initiative
- Standard for a modular system for java platform
- Applications are represented in form of bundles that can be dynamically installed, started, stopped, updated and uninstalled
- Bundles can detect new services (or removal of services at run time) and adjust accordingly
Bundle
Bundle is a set of classes and resources with a detailed manifest MANIFEST.MF file (a jar file with detailed manifest) that contains metadata of the bundle. Example manifest file:
Bundle-Name: Hello World - human readable name
Bundle-SymbolicName: org.company.application - id of the bundle
Bundle-Description: A Hello World bundle
Bundle-ManifestVersion: 2
Bundle-Version: 1.0.0
Bundle-Activator: org.company.Activator
Export-Package: org.company.application;version="1.0.0"
Import-Package: org.osgi.framework;version="1.3.0"
Bundle life-cycle
A Life Cycle layer adds bundles that can be dynamically installed, started, stopped, updated and uninstalled.
Bundle states
INSTALLED
- The bundle has been successfully installed.RESOLVED
- All Java classes that the bundle needs are available. This state indicates that the bundle is either ready to be started or has stopped.STARTING
- The bundle is being started, the BundleActivator.start method has been called but the start method has not yet returned. When the bundle has an activation policy, the bundle will remain in the STARTING state until the bundle is activated according to its activation policy.ACTIVE
- The bundle has been successfully activated and is running; its Bundle Activator start method has been called and returned.STOPPING
- The bundle is being stopped. The BundleActivator.stop method has been called but the stop method has not yet returned.UNINSTALLED
- The bundle has been uninstalled. It cannot move into another state.
In AEM bundles can be managed with a Web Console under: /system/console/bundles
Java Content Repository (JCR)
- Standard API to access data (separate from underlying implementation)
- Hierarchical Database that looks like a file system, Data represented in Tree structure
- Supports mechanisms like querying, full text search, permissions, transactions, versioning, event management and more
- Supports structured and unstructured content
- One of the implementation: Apache Jackrabbit Oak
- Supports file system features like: hierarchy, locking, access control, binaries
JCR visualized in CRX:
Example properties:
jcr:primaryType
- basic information about the node, determine some required properties that a node havejcr:mixinTypes
- additional property that extend functionality of primary type, similar to interface in java
Sling
- RESTful framework for web applications based on content repository (JCR) - provides REST API for JCR-based applications
- Resource oriented - most resources maps to JCR nodes
- Sling decomposes the URL, resolves the resource to be rendered from the path, locates the script to render the resource and then renders the requested resource
** Sling script resolution diagram **
** Examples **
AEM supports many scripting languages. Full list of supported script engines can be found under /system/console/slingscripting