Re: Dynamic Loading of Other Groovy Functions

Guillaume Laforge <[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <CAJ2HCd8B35q2BiGhxvLEN1kK-cKyWs-mQDURgUffOEKX2WYLvw@mail.gmail.com>
Hi Fred,

You might want to have a look at the documentation, in particular this
section:
https://docs.groovy-lang.org/docs/latest/html/documentation/#_integrating_groovy_in_a_java_application

It covers the various ways of integrating Groovy.
There are different mechanisms available, you should find one that suit
your needs.

Guillaume


On Mon, Jan 31, 2022 at 7:20 PM Fred Eisele <[email protected]>
wrote:

> I have a driver class (currently written in python) that
>
> ·       reads a csv file of command records which describe functions, the
> driver
>
> ·       loads groovy functions (as text strings)
>
> ·       the driver edits (textually) the groovy functions to add
> parameters
>
> ·       passes that groovy command to a database server (gremlin-server)
> which
>
> ·       processes the request and
>
> ·       returns the result.
>
> I would like to make a few changes to this process.
>
>    - replace python driver with a groovy script (python gremlin driver is
>    missing some features)
>    - dynamically load the groovy functions (not as text strings)
>    - communicate with the database server in the binary format (not as
>    text)
>
>
>
> To do this I need to know…
>
> Is possible to dynamically load groovy scripts?
>
> e.g. if I have a groovy script ‘foo.groovy’ and a variable `x = ‘foo’` can
> I use the variable `x` to invoke a function in `foo.groovy`?
> I know I can run `foo.groovy`.execute() as a separate process but I need
> to capture the result, plus I do not want to incur the added computational
> cost.
>
>
>
>
>

-- 
Guillaume Laforge
Apache Groovy committer
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Twitter: @glaforge <http://twitter.com/glaforge>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.