 
 (extend-type PersistentArrayMap
   IComponent
+  (initialize [component]
+    (let [default-io-buffer-size (core/get-config :components :io-buffer-size)
+          default-stream-fn #(stream/stream default-io-buffer-size)
+          input-stream-fn   (get component
+                                 :input-stream-fn
+                                 default-stream-fn)
+          output-stream-fn  (get component
+                                 :output-stream-fn
+                                 default-stream-fn)]
+      (assoc component
+             :input (input-stram-fn)
+             :outpu (output-stream-fn))))
+
+
   (start! [this context]
     (let [start-fn (::start-fn this)]
       (assoc (start-fn this context)

  (dependencies [this]
     (::depends-on this)))


;; SPECS ---------------------------------------------------
(s/def ::name qualified-keyword?)
(s/def ::start-fn

                        :fn #(= (::name (:ret %))
                                (::name (:this (:args %)))))))

(s/def ::stop-fn
  (s/fspec :args (s/cat :this map? :context map?
                        :ret map?
                        :fn #(= (::name (:ret %))
                                (::name (:this (:args %)))))))

(s/def ::stream stream/stream?)

(s/def ::input-stream-fn
  (s/fspec :args (s/cat) :ret ::stream))


(s/def ::output-stream-fn ::input-stream-fn)

(s/def ::depends-on (s/coll-of keyword? :kind vector? :distinct true))
(s/def ::component (s/keys :req [::name ::start-fn ::stop-fn]
                           :opt [::depends-on
                                 ::input-stream-fn
                                 ::output-stream-fn]))
