Created
April 6, 2010 11:04
-
-
Save skuro/357476 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns skuro.alfresco.clojure | |
:import (org.alfresco.util ApplicationContextHelper ApplicationContextHelper$RunAsWork) | |
(org.alfresco.repo.transaction RetryingTransactionHelper RetryingTransactionHelper$RetryingTransactionCallback)) | |
;; this is problematic: it looks like swank is launched in a separated class loader! | |
;; this usually results in the spring ctx to be recreated | |
(def ctx (. ApplicationContextHelper getApplicationContext)) | |
(defn run-as [user work] | |
(. AuthenticationUtil runAs | |
(proxy [AuthenticationUtil$RunAsWork] [] | |
(doWork [] | |
(work))) user)) | |
(defn get-root-node [store] | |
(let [nodeService (. ctx getBean "nodeService")] | |
(. nodeService getRootNode store))) | |
(defn in-transaction [callback] | |
(let [callback-impl (proxy [RetryingTransactionHelper$RetryingTransactionCallback] [] | |
(execute [] | |
(callback)))] | |
(. RetryingTransactionHelper doInTransaction callback-impl))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment