When using versions of TinkerPop through 3.2.4, you would have to write a wrapper around Gremlin Server where you start it with something like:
Settings settings = new Settings()
GremlinServer server = new GremlinServer(settings);
server.start().join();
Then you would manipulate the GraphManager
which you can get from the GremlinServer
instance with:
GraphManager manager = server.getServerGremlinExecutor().getGraphManager()
GraphManager.getGraphs()
returns the Map<String,Graph>
instance where you can dynamically add/remove the graphs that are being served. I would consider this method a hack/workaround to accomplish what you want, but there isn't another method.
As of 3.2.5 (as of this writing not released) and forward, GraphManager
is an interface which you can implement yourself to dynamically provide your graph list. Your implementation can be referenced in the Gremlin Server configuration file thus allowing it to be plugged into the server dynamically.