 (ns puppetlabs.trapperkeeper.bootstrap
   (:import (java.io Reader FileNotFoundException)
            (java.net URI))
-  (:require [clojure.java.io :refer [IOFactory]]
-            [clojure.string :as string]
-            [clojure.java.io :refer [reader resource file input-stream]]
+  (:require [clojure.string :as string]
+            [clojure.java.io :as io]
             [clojure.tools.logging :as log]
             [puppetlabs.trapperkeeper.plugins :as plugins]
-            [puppetlabs.trapperkeeper.config :refer [parse-config-data
-                                                     initialize-logging!]]
-            [puppetlabs.trapperkeeper.internal :as i]
-            [puppetlabs.trapperkeeper.services :as s]))
+            [puppetlabs.trapperkeeper.internal :as internal]
+            [puppetlabs.trapperkeeper.services :as services]))
 
 (def bootstrap-config-file-name "bootstrap.cfg")
 

  [resolve-ns service-name]
  {:pre  [(string? resolve-ns)
          (string? service-name)]
   :post [(satisfies? s/ServiceDefinition %)]}
  (try (require (symbol resolve-ns))
       (catch FileNotFoundException e
         (throw (IllegalArgumentException.
                  (str "Unable to load service: " resolve-ns "/" service-name)
                  e))))
  (if-let [service-def (ns-resolve (symbol resolve-ns) (symbol service-name))]
    (i/validate-service-graph! (var-get service-def))
    (throw (IllegalArgumentException.
             (str "Unable to load service: " resolve-ns "/" service-name)))))


  [cli-data]
  {:pre  [(map? cli-data)]
   :post [(or (nil? %)
              (satisfies? io/IOFactory %))]}
  (if-let [bootstrap-config (or (config-from-cli cli-data)
                                (config-from-cwd)
                                (config-from-classpath))]
