use of org.apache.jackrabbit.oak.jcr.session.RefreshStrategy in project jackrabbit-oak by apache.
the class RepositoryImpl method login.
// ------------------------------------------------------------< JackrabbitRepository >---
@Override
public Session login(@CheckForNull Credentials credentials, @CheckForNull String workspaceName, @CheckForNull Map<String, Object> attributes) throws RepositoryException {
try {
if (attributes == null) {
attributes = emptyMap();
}
Long refreshInterval = getRefreshInterval(credentials);
if (refreshInterval == null) {
refreshInterval = getRefreshInterval(attributes);
} else if (attributes.containsKey(REFRESH_INTERVAL)) {
throw new RepositoryException("Duplicate attribute '" + REFRESH_INTERVAL + "'.");
}
boolean relaxedLocking = getRelaxedLocking(attributes);
RefreshPredicate predicate = new RefreshPredicate();
RefreshStrategy refreshStrategy = refreshInterval == null ? new RefreshStrategy.ConditionalRefreshStrategy(new RefreshStrategy.LogOnce(60), predicate) : new RefreshStrategy.Timed(refreshInterval);
ContentSession contentSession = contentRepository.login(credentials, workspaceName);
SessionDelegate sessionDelegate = createSessionDelegate(refreshStrategy, contentSession);
SessionContext context = createSessionContext(statisticManager, securityProvider, createAttributes(refreshInterval, relaxedLocking), sessionDelegate, observationQueueLength, commitRateLimiter);
predicate.setSessionContext(context);
return context.getSession();
} catch (LoginException e) {
throw new javax.jcr.LoginException(e.getMessage(), e);
}
}
Aggregations