|
|
|
@ -1,7 +1,5 @@
|
|
|
|
|
(ns leiningen.neo4j
|
|
|
|
|
(:import org.neo4j.graphdb.factory.GraphDatabaseFactory
|
|
|
|
|
org.neo4j.server.CommunityBootstrapper
|
|
|
|
|
java.lang.Runtime
|
|
|
|
|
(:import org.neo4j.server.CommunityBootstrapper
|
|
|
|
|
java.lang.Thread
|
|
|
|
|
java.util.Optional)
|
|
|
|
|
(:require [clojure.java.io :as io]))
|
|
|
|
@ -13,3 +11,11 @@
|
|
|
|
|
server (CommunityBootstrapper.)]
|
|
|
|
|
(.start server path (Optional/empty) config)
|
|
|
|
|
(while true (Thread/sleep 5000))))
|
|
|
|
|
|
|
|
|
|
(defn with-db [& {:keys [path config do-with-db]
|
|
|
|
|
:or {:path "target/neo4j"
|
|
|
|
|
:config {}}}]
|
|
|
|
|
(let [server (CommunityBootstrapper.)]
|
|
|
|
|
(.start server path (Optional/empty) config)
|
|
|
|
|
(do-with-db)
|
|
|
|
|
(.stop server)))
|
|
|
|
|