             [clojure.data.xml :as xml]
             [slingshot.slingshot :as sling])
   (:import [java.util.logging Logger]
+           java.net.URI
            [com.marklogic.xcc
             Session$TransactionMode
-            RequestOptions
+            RequestOptions SecurityOptions
             ContentCreateOptions ContentPermission ContentCapability
-            ContentSourceFactory ContentFactory
+            ContentSource ContentSourceFactory ContentFactory
             DocumentFormat DocumentRepairLevel
-            ValueFactory]
+            ValueFactory Version]
            [com.marklogic.xcc.types ValueType]
-           [com.marklogic.xcc Version]
-           java.net.URI))
+           [com.marklogic.xcc.spi ConnectionProvider]))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; Enumerations and classes.

;;;; Session management
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn- create-session*
  "Creates session, given map of database info."
  [{:keys [uri user password content-base]}]
  (let [cs (ContentSourceFactory/newContentSource (URI. uri))]
    (cond
      (and (nil? content-base)
           (or (nil? user)

  https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/Session.html
  for valid options. (Note that request options are distinct from
  session options, though *default* request options can be set for the
  session.)

  If optional `content-source` is passed, the Session is created from
  the given ContentSource rather than creating one from the database info URI."
  ([db-info]
   (create-session* db-info))
  ([db-info {:keys [default-request-options logger user-object
                    transaction-mode transaction-timeout]}]
   (create-session db-info
                   nil
                   {:default-request-options default-request-options
                    :logger logger :user-object user-object
                    :transaction-mode transaction-mode
                    :transaction-timeout transaction-timeout}))
  ([db-info content-source {:keys [default-request-options logger user-object
                                   transaction-mode transaction-timeout]}]
   (let [session (create-session* db-info content-source)]
     (when (map? default-request-options)
       (.setDefaultRequestOptions session (request-options default-request-options)))
     (when (instance? Logger logger)
