]> git.argeo.org Git - lgpl/argeo-commons.git/blob - SystemSession.java
62b0f91aadca291c62a1c3ef2f0a479fa5ef9f4e
[lgpl/argeo-commons.git] / SystemSession.java
1 package org.argeo.security.jcr;
2
3 import java.util.concurrent.Callable;
4
5 import javax.jcr.Session;
6
7 import org.argeo.ArgeoException;
8 import org.argeo.jcr.spring.ThreadBoundSession;
9 import org.argeo.security.SystemExecutionService;
10
11 /** Thread bounded JCR session which logins as system authentication. */
12 public class SystemSession extends ThreadBoundSession {
13 private SystemExecutionService systemExecutionService;
14
15 @Override
16 protected Session login() {
17 try {
18 return systemExecutionService.submit(new Callable<Session>() {
19 public Session call() throws Exception {
20 return SystemSession.super.login();
21 }
22 }).get();
23 } catch (Exception e) {
24 throw new ArgeoException(
25 "Cannot login to JCR with system authentication", e);
26 }
27 }
28
29 public void setSystemExecutionService(
30 SystemExecutionService systemExecutionService) {
31 this.systemExecutionService = systemExecutionService;
32 }
33
34 }