package com.thinkaurelius.titan.graphdb.tinkerpop.plugin;

import com.thinkaurelius.titan.core.TitanGraph;
import com.thinkaurelius.titan.graphdb.configuration.TitanConstants;
import com.thinkaurelius.titan.graphdb.tinkerpop.computer.bulkloader.BulkLoaderVertexProgram;
import com.tinkerpop.gremlin.groovy.plugin.Artifact;
import com.tinkerpop.gremlin.groovy.plugin.GremlinPlugin;
import com.tinkerpop.gremlin.groovy.plugin.PluginAcceptor;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class TitanGremlinPlugin implements GremlinPlugin {

    private static final String IMPORT = "import ";
    private static final String DOT_STAR = ".*";

    private static final Set<String> IMPORTS = new HashSet<String>() {{
        add(IMPORT + TitanGraph.class.getPackage().getName() + DOT_STAR);
        add(IMPORT + BulkLoaderVertexProgram.class.getPackage().getName() + DOT_STAR);
    }};

    @Override
    public String getName() {
        return "aurelius.titan"; // TODO: call this thinkaurelius.titan?
    }

    @Override
    public void pluginTo(final PluginAcceptor pluginAcceptor) {
        pluginAcceptor.addImports(IMPORTS);
    }

    @Override
    public boolean requireRestart() {
        return true;
    }

    @Override
    public Optional<Set<Artifact>> additionalDependencies() {
        return Optional.of(new HashSet<>(Arrays.asList(new Artifact("com.thinkaurelius.titan", "titan-cassandra", TitanConstants.VERSION))));
    }
}

@@ -52,16 +52,63 @@
 lugin;%0A%0A
+import com.google.common.collect.ImmutableSet;%0A
 import c
@@ -1492,36 +1492,141 @@
 .of(
-new HashSet%3C%3E(Arrays.asList(
+ImmutableSet.of(%0A                new Artifact(%22com.thinkaurelius.titan%22, %22titan-cassandra%22, TitanConstants.VERSION),%0A                
 new 
@@ -1664,33 +1664,30 @@
 an%22, %22titan-
-cassandra
+hadoop
 %22, TitanCons
@@ -1702,17 +1702,16 @@
 RSION)))
-)
 ;%0A    %7D%0A

Add titan-hadoop as a TitanGremlinPlugin dep