SLING-1363 - adding SessionConfigurer interface

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@908232 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/jcr/api/SessionConfigurer.java b/src/main/java/org/apache/sling/jcr/api/SessionConfigurer.java
new file mode 100644
index 0000000..cb60a3a
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/api/SessionConfigurer.java
@@ -0,0 +1,35 @@
+/*
+ * 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 javax.jcr.Session;
+
+/**
+ * Service interface which allows for the JCR Sessions produced by
+ * SlingRepository instances to be configured programmatically.
+ */
+public interface SessionConfigurer {
+
+    static final String SERVICE_NAME = "org.apache.sling.jcr.api.SessionConfigurer";
+
+    /**
+     * Configure the Session instance as necessary.
+     *
+     * @param session the JCR Session
+     */
+    void configure(Session session);
+}
diff --git a/src/main/java/org/apache/sling/jcr/api/SlingRepository.java b/src/main/java/org/apache/sling/jcr/api/SlingRepository.java
index 711d59a..e732d71 100644
--- a/src/main/java/org/apache/sling/jcr/api/SlingRepository.java
+++ b/src/main/java/org/apache/sling/jcr/api/SlingRepository.java
@@ -34,6 +34,12 @@
  * Implementations of this interface will generally provide configurability of
  * the default workspace name as well as the access details for the
  * administrative session.
+ * <p>
+ * Implementations of SlingRepository are expected to invoke any available
+ * implementations of the {@link SessionConfigurer} interface <b>before</b>
+ * returning <b>any</b> {@link Session} to callers. This includes the methods
+ * defined in the {@link Repository} interface.
+ *
  */
 public interface SlingRepository extends Repository {