I'd like to implement a SlingRepositoryInitializer extension point for use cases like setting up service users and ACLs and creating the "base tree" of content as described in
This can also be very useful to handle content migrations or other cleanup operations in upgrades.
The scenario is that before registering the SlingRepository service, all active SlingRepositoryInitializer services are called in order of their service ranking, passing them the upcoming SlingRepository service so that they can act on it. Any exception thrown in this processing causes the SlingRepository service registration to be canceled.
The SlingRepositoryInitializer javadocs must stress that those services need to take clustered scenarios into account, and if necessary implement locking mechanisms to avoid stepping on each other's toes.