Github user okram commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/510#discussion_r91200131 --- Diff: hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/jsr223/HadoopGremlinPlugin.java --- @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tinkerpop.gremlin.hadoop.jsr223; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.io.IOUtils; +import org.apache.hadoop.io.compress.CodecPool; +import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat; +import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat; +import org.apache.hadoop.util.ToolRunner; +import org.apache.tinkerpop.gremlin.hadoop.Constants; +import org.apache.tinkerpop.gremlin.hadoop.process.computer.mapreduce.MapReduceGraphComputer; +import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopConfiguration; +import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopEdge; +import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopElement; +import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph; +import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopProperty; +import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertex; +import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertexProperty; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.FileSystemStorage; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONInputFormat; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONOutputFormat; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONRecordReader; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONRecordWriter; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoRecordReader; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoRecordWriter; +import org.apache.tinkerpop.gremlin.hadoop.structure.io.script.ScriptInputFormat; +import org.apache.tinkerpop.gremlin.hadoop.structure.util.ConfUtil; +import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin; +import org.apache.tinkerpop.gremlin.jsr223.BindingsCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.Customizer; +import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.LazyBindingsCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer; +import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment; +import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor; + +import javax.script.Bindings; +import javax.script.SimpleBindings; +import java.util.Collections; +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; + +/** + * @author Marko A. Rodriguez (http://markorodriguez.com) + */ +public final class HadoopGremlinPlugin extends AbstractGremlinPlugin { + + protected static String NAME = "tinkerpop.hadoop"; + + private static final BindingsCustomizer bindings; + + private static final ImportCustomizer imports; + + private static final Set<String> appliesTo = new HashSet<>(Collections.singletonList("gremlin-groovy")); + + static { + try { + // TODO: most of the imports here were wildcarded, but we dont' allow that anymore - needs review + imports = DefaultImportCustomizer.build() + .addClassImports( + Configuration.class, + org.apache.hadoop.hdfs.DFSClient.class, + FileSystem.class, + ToolRunner.class, + IOUtils.class, + CodecPool.class, + SequenceFileInputFormat.class, + SequenceFileOutputFormat.class, + Constants.class, + HadoopConfiguration.class, + HadoopEdge.class, + HadoopElement.class, + HadoopGraph.class, + HadoopProperty.class, + HadoopVertex.class, + HadoopVertexProperty.class, + ConfUtil.class, + VertexWritable.class, + GraphSONInputFormat.class, + GraphSONOutputFormat.class, + GraphSONRecordReader.class, + GraphSONRecordWriter.class, + GryoInputFormat.class, + GryoOutputFormat.class, + GryoRecordReader.class, + GryoRecordWriter.class, + ScriptInputFormat.class, --- End diff -- We also need `ScriptOutputFormat.class`. And for safety, `ScriptRecordReader` and `ScriptRecordWriter`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---