On Tue, Jul 26, 2011 at 12:43 PM, mmwaikar <[email protected]> wrote:
> Hi,
>
> I am using the Lobos library - https://github.com/budu/lobos
> In it there's a function create, which is called like this - (create db
> (table :some-name)), where db is earlier defined as - (def db
> {:classname "org.postgresql.Driver"
> :subprotocol "postgresql"
> :user "postgres"
> :password ""
> :subname "//localhost:5432/flyway"})
>
> If I have to call the above function from Java, how do I -
> 1) define the def (do I have to load some variable)?
> 2) I am loading the reqd. lobos libraries using [ RT.load("lobos/core",
> true); ] and then getting the reference to the create function like - [ Var
> foo = RT.var("lobos.core", "create"); ]
> But how do I pass the required arguments to this function. Do I need to
> create an array?
You might look at examples here
http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Invoking_Clojure_from_Java
If i were doing same thing I would put all necessary initalization
into a Clojure script and wrapped necessary functions to have less
arguments to pass from Java.
This way later you'll need to load single script only. Say
(ns
(use lobos.core))
(def db {.....})
(defn create2 [table-name] (create db (table table-name)))
This might not be convenient in your case however.
--
Petr Gladkikh
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en