Cole-Greer opened a new pull request, #3384:
URL: https://github.com/apache/tinkerpop/pull/3384
Gremlin Server currently relies on Groovy init scripts for server
initialization — binding traversal sources, running lifecycle hooks, and
loading data. This PR introduces a Groovy-free initialization path so that
Groovy can be disabled by default in all shipped server configs. Groovy remains
available as an
opt-in for backward compatibility.
## Changes
Three new YAML configuration mechanisms replace the Groovy init scripts:
Auto-created TraversalSources — After graphs are loaded, a default
TraversalSource is automatically created for each graph that doesn't have an
explicit traversalSources entry. A graph named graph gets g; others get
g_<name>. A minimal config with just a graphs section is now fully functional.
Declarative traversalSources — A new YAML section for explicit
TraversalSource creation with optional strategy configuration via a Gremlin
query:
yaml
traversalSources: {
g: {graph: graph},
gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)"}}
Java-based lifecycleHooks — A new YAML section for configuring LifeCycleHook
implementations via reflection, replacing Groovy-based hook creation:
yaml
lifecycleHooks:
- className:
org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader
config: {graph: graph, dataset: modern}
### Supporting changes
- TinkerFactoryDataLoader — built-in LifeCycleHook that loads TinkerFactory
sample datasets (modern, classic, crew, grateful, sink, airroutes) without
Groovy
- LifeCycleHook interface — added default void init(Map) for configuration
and GraphManager to Context
- Settings — new TraversalSourceSettings and LifeCycleHookSettings config
classes with SnakeYAML type descriptors
- ServerTestHelper — null-safe for configs without gremlin-groovy in
scriptEngines
- Deprecated the Groovy-based LifeCycleHook/TraversalSource creation path
with startup warnings
- New gremlin-server-airroutes.yaml shipped config
### Config migrations
All default configs under gremlin-server/conf/ updated to remove
gremlin-groovy from scriptEngines. All Docker integration test configs
(docker/gremlin-server/) and JVM test configs migrated to use traversalSources
+ lifecycleHooks instead of generate-all.groovy. The gremlin-console test
infrastructure
similarly migrated.
### Deleted files
- gremlin-server/src/test/scripts/generate-all.groovy — replaced by YAML
config
- gremlin-server/src/test/scripts/test-server-start.groovy — dead code
- gremlin-console/src/test/resources/.../generate.groovy — replaced by YAML
config
## Testing
- TinkerFactoryDataLoaderTest — all 6 datasets, error cases (missing graph,
non-TinkerGraph, unknown dataset, missing config)
- ServerGremlinExecutorTest — auto-creation, explicit suppression, lifecycle
hook instantiation, resolveLanguage logic
- SettingsTest — YAML parsing for traversalSources and lifecycleHooks,
defaults when absent
- GremlinServerConfigIntegrateTest — parameterized smoke test that boots
each shipped config and runs a query
- Existing JVM integration tests exercise the migrated
gremlin-server-integration.yaml
- GLV integration tests exercise the migrated Docker configs
VOTE +1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]