SLING-5456 - implement SlingRepositoryInitializer extension points, with tests

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1727312 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/jcr/api/SlingRepositoryInitializer.java b/src/main/java/org/apache/sling/jcr/api/SlingRepositoryInitializer.java
new file mode 100644
index 0000000..efd3dc5
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/api/SlingRepositoryInitializer.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.api;
+
+import aQute.bnd.annotation.ConsumerType;
+
+/**
+ * All active <code>SlingRepositoryInitializer</code> services are called before 
+ * making the <code>SlingRepository</code> service available, and can perform
+ * initializations on it, like creating service users, setting up initial access
+ * control, migrating content in upgrades, etc.
+ * 
+ * The <code>SlingRepositoryInitializer</code> services need to be aware of any
+ * repository clustering scenarios as well as multiple Sling instances accessing
+ * the same repository. They might need to implement locking to avoid conflicts. 
+ */
+@ConsumerType
+public interface SlingRepositoryInitializer {
+    /** Process the content repository before it is 
+     *  registered as an OSGi service.
+     *  @param repo the repository to process
+     *  @throws Exception If anything happens that should prevent
+     *      the SlingRepository service from being registered.
+     */
+    public void processRepository(SlingRepository repo) throws Exception;
+}
diff --git a/src/main/java/org/apache/sling/jcr/api/package-info.java b/src/main/java/org/apache/sling/jcr/api/package-info.java
index 0cdd69b..6aba511 100644
--- a/src/main/java/org/apache/sling/jcr/api/package-info.java
+++ b/src/main/java/org/apache/sling/jcr/api/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.3")
+@Version("2.4.0")
 package org.apache.sling.jcr.api;
 
 import aQute.bnd.annotation.Version;