I made some good progress on this late yesterday and today - other than
that it has been miserable. Basically - gremlin-core now holds
GremlinPlugin infrastructure now. Libraries that have plugin infrastructure
no longer need to depend on gremlin-groovy - they just need gremlin-core.
What's nice is that I have been able to do all this without any breaking
changes (the path to doing continued to elude me until late yesterday)
which means GremlinPlugin from gremlin-groovy works with the GremlinPlugin
from gremlin-core. Note that the notion of a GremlinModule went away in
favor of just keeping the concept of GremlinPlugin around. GremlinModule
mostly existed because I couldn't figure out how to get both things to work
together in the same space.

I like that they work together because that means that this change can go
to tp32 and all the gremlin-groovy GremlinPlugin stuff will just appear as
deprecated and users can begin to migrate their code without the whole
house coming down when they upgrade.

There is one trick - they "work together" meaning they can exist in the
same JVM together, but you really use one or the other (not both at the
same time). In Gremlin Server this "switch" is determined by whether or not
you use the new yaml file settings that let you configure Gremlin Plugins
per script engine (in which case it uses gremlin-core GremlinPlugin). If
you use the old style yaml file settings you get the old plugin system.
With Gremlin Console I decided to control which you load by way of an
system property. I think that for 3.2.4 we will use continue to use the
gremlin-groovy GremlinPlugin so that if people already have plugins written
they will still work out of the box. If you want to upgrade you'll have to
do so manually.

The code for the individual plugins (e.g. SugarPlugin) is somewhat
duplicated (one for gremlin-core and one for gremlin-groovy) which is kinda
bad, but I didn't see the point in extracting the logic to some central
location for re-use as when we get to 3.3.0 shortly we will just delete the
deprecated gremlin-groovy file leaving just one again. It just means that
if we change a plugin in one place we will need to change it in the other
for 3.2.x.

I've tested the "new" gremlin-core plugins by hand and they all seem to
work nicely so I feel like the hardest work is done. I have a range of
notes to go through for things to fix up and cleanup and I still have more
tests and docs to write, but I don't think there are "hard" problems left
to solve.  You can see the state the branch is in here:

https://github.com/apache/tinkerpop/compare/tp32...TINKERPOP-1562

in case you'd like to get an idea of how the work was done. Once i get this
complete, I will move on to the areas of work that this change opens the
doors for in 3.3.0:

1. removing gremlin-groovy-test (tinkergraph-gremlin won't need to depend
on gremlin-groovy anymore so gremlin-groovy can use tinkergraph in tests
like gremlin-python does)
2. getting GremlinPythonScriptEngine legit with all the gremlin-core stuff
(e.g. plugin support)
3. killing all this deprecated GremlinPlugin code from gremlin-groovy (some
of that will have to happen as part of 1 anyway)

Please yell if there are any concerns. I should have a pull request for
full review in the coming days.





On Fri, Nov 18, 2016 at 6:25 AM, Stephen Mallette <spmalle...@gmail.com>
wrote:

> We've relied on ScriptEngine since the early days of TinkerPop and it has
> always been just a construct for usage with Groovy. We now find in a world
> of GLVs that other ScriptEngine implementations are important and require
> similar attention that we've given to GremlinGroovyScriptEngine.
> Unfortunately, so much of the logic and code that is tied to ScriptEngines,
> like the Plugin system,Gremlin Server, Gremlin Console is trapped inside
> the gremlin-groovy module. Ultimately that stuff needs to move to
> gremlin-core so that other GLVs that are JVM-based can take advantage of
> that.
>
> If you recall, I started this work on 3.2.2 and 3.2.3 but then got blocked
> for a number of reasons and decided to hang up the effort for a while to
> clear my head. Anyway, I'm trying to get back into it again so that a
> number of different dominoes can fall (all things we've discussed on this
> list - like getting rid of gremlin-groovy-test. Yes, even doing that isn't
> possible without these changes). I'm not completely sure where this work
> will take me but expect some big changes in 3.3.0 - specifically I can see
> where:
>
> 1. GremlinModule will be the new thing that configures ScriptEngines -
> they are quite similar to GremlinPlugins but are not bound to groovy.
> 2. Not sure what will happen to GremlinPlugins - they may stay a groovy
> construct and remain bound to Gremlin Console for now. Though we've had
> other discussions here about a more generalized Gremlin Console not bound
> just to groovy sooooo......
> 3. Gremlin Server yaml configuration file will change format around how
> ScriptEngines are configured.
>
> So far, I have the beginnings of this work all happening without any
> breaking changes - meaning lots of deprecation and adapter code that allows
> new stuff to work with old stuff. I prefer this approach as it allows the
> code base to continue to work and I don't have to blast it back to the
> stone age to get the new changes in (though it is more frustrating and
> slower).
>
> Anyway, please let me know if there are any questions.
>

Reply via email to