use of com.baidu.hugegraph.loader.executor.GroovyExecutor in project incubator-hugegraph-toolchain by apache.
the class HugeGraphLoader method createSchema.
private void createSchema() {
LoadOptions options = this.context.options();
if (!StringUtils.isEmpty(options.schema)) {
File file = FileUtils.getFile(options.schema);
HugeClient client = this.context.client();
GroovyExecutor groovyExecutor = new GroovyExecutor();
groovyExecutor.bind(Constants.GROOVY_SCHEMA, client.schema());
String script;
try {
script = FileUtils.readFileToString(file, Constants.CHARSET);
} catch (IOException e) {
throw new LoadException("Failed to read schema file '%s'", e, options.schema);
}
groovyExecutor.execute(script, client);
}
this.context.updateSchemaCache();
}
Aggregations