RepoInit in AEM (Part I)
RepoInit is the recommended way of doing users, groups and roles migration to AEMaaCS.
SlingRepositoryInitializer is a simple interface that allows running code before SlingRepository is initialized. Services that implement this interface are called when setting up the JCR-based SlingRepository service, before registering it as an OSGi service. These services follow the rule of service.ranking.
In order to successfully register the SlingRepository service, is is required that these services run successfully, if any of those fails, SlingRepository is not registered.
There are two modules — Parser and the adapter.
The parser implements mini-language meant to create paths, service users and manage access control in a content repository, as well as registering JCR namespaces, node types and privileges.
Generally repoinit instructions are defined in a .config file.
The repoinit statements can be maintained inside a separate file configured as references. For example,
org.apache.sling.jcr.repoinit.impl.RepositoryInitializer
references=[“model:context:/resources/provisioning/model.txt”,”model@repoinitTwo:context:/resources/provisioning/model.txt”]
Or statements can be provided as part of script in OSGI configuration
Scripts is a multi-value field with each value providing repoinit statements as plain text in a String.
Next in Part II, will demonstrate some example statements for various configurations.