jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1513064 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: RepositoryImpl.java SessionContext.java
Date Mon, 12 Aug 2013 07:42:06 GMT
Author: jukka
Date: Mon Aug 12 07:42:06 2013
New Revision: 1513064

URL: http://svn.apache.org/r1513064
Log:
OAK-953: Allow sub-classing of SessionImpl

Add a factory method for creating SessionContext instances

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1513064&r1=1513063&r2=1513064&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
Mon Aug 12 07:42:06 2013
@@ -68,7 +68,7 @@ public class RepositoryImpl implements J
 
     private final Descriptors descriptors = new Descriptors(new SimpleValueFactory());
     private final ContentRepository contentRepository;
-    private final Whiteboard whiteboard;
+    protected final Whiteboard whiteboard;
     private final SecurityProvider securityProvider;
 
     public RepositoryImpl(@Nonnull ContentRepository contentRepository,
@@ -203,7 +203,7 @@ public class RepositoryImpl implements J
             }
 
             ContentSession contentSession = contentRepository.login(credentials, workspaceName);
-            SessionContext context = new SessionContext(this, whiteboard,
+            SessionContext context = createSessionContext(
                     Collections.<String, Object>singletonMap(REFRESH_INTERVAL, refreshInterval),
                     new SessionDelegate(contentSession, refreshInterval));
             return context.getSession();
@@ -219,6 +219,18 @@ public class RepositoryImpl implements J
 
     //------------------------------------------------------------< internal >---
 
+    /**
+     * Factory method for creating a {@link SessionContext} instance for
+     * a new session. Called by {@link #login()}. Can be overridden by
+     * subclasses to customize the session implementation.
+     *
+     * @return session context
+     */
+    protected SessionContext createSessionContext(
+            Map<String, Object> attributes, SessionDelegate delegate) {
+        return new SessionContext(this, whiteboard, attributes, delegate);
+    }
+
     SecurityProvider getSecurityProvider() {
         return securityProvider;
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java?rev=1513064&r1=1513063&r2=1513064&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
Mon Aug 12 07:42:06 2013
@@ -93,7 +93,7 @@ public class SessionContext implements N
     private PrivilegeManager privilegeManager;
     private ObservationManagerImpl observationManager;
 
-    SessionContext(
+    public SessionContext(
             @Nonnull RepositoryImpl repository, @Nonnull Whiteboard whiteboard,
             Map<String, Object> attributes, @Nonnull final SessionDelegate delegate)
{
         this.repository = checkNotNull(repository);



Mime
View raw message