From fd835f0ec7f182fb7281771eae90f44b78071baf Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Sun, 17 Apr 2011 07:58:36 +0000 Subject: [PATCH] JCR system session NEW - bug 17: Generalize agent management and registration beyond JMS https://bugzilla.argeo.org/show_bug.cgi?id=17 git-svn-id: https://svn.argeo.org/commons/trunk@4443 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org/argeo/security/jcr/SystemSession.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/SystemSession.java diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/SystemSession.java b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/SystemSession.java new file mode 100644 index 000000000..62b0f91aa --- /dev/null +++ b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/SystemSession.java @@ -0,0 +1,34 @@ +package org.argeo.security.jcr; + +import java.util.concurrent.Callable; + +import javax.jcr.Session; + +import org.argeo.ArgeoException; +import org.argeo.jcr.spring.ThreadBoundSession; +import org.argeo.security.SystemExecutionService; + +/** Thread bounded JCR session which logins as system authentication. */ +public class SystemSession extends ThreadBoundSession { + private SystemExecutionService systemExecutionService; + + @Override + protected Session login() { + try { + return systemExecutionService.submit(new Callable() { + public Session call() throws Exception { + return SystemSession.super.login(); + } + }).get(); + } catch (Exception e) { + throw new ArgeoException( + "Cannot login to JCR with system authentication", e); + } + } + + public void setSystemExecutionService( + SystemExecutionService systemExecutionService) { + this.systemExecutionService = systemExecutionService; + } + +} -- 2.30.2