You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/03/03 20:08:50 UTC
[37/46] tinkerpop git commit: TINKERPOP-1421 TINKERPOP-1621 Removed
deprecated GremlinPlugin/ControlOps infrastructure
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 5de06e5..0ac5582 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -18,7 +18,6 @@
*/
package org.apache.tinkerpop.gremlin.groovy.jsr223;
-import groovy.grape.Grape;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.DelegatingMetaClass;
@@ -27,17 +26,7 @@ import groovy.lang.MissingMethodException;
import groovy.lang.MissingPropertyException;
import groovy.lang.Script;
import groovy.lang.Tuple;
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.DefaultImportCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.EmptyImportCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.ImportCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.NoImportCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ConfigurationCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader;
-import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact;
-import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin;
-import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPluginException;
import org.apache.tinkerpop.gremlin.jsr223.CoreGremlinPlugin;
import org.apache.tinkerpop.gremlin.jsr223.Customizer;
import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
@@ -91,7 +80,7 @@ import java.util.stream.Collectors;
* @see org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor
*/
public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
- implements DependencyManager, AutoCloseable, GremlinScriptEngine {
+ implements AutoCloseable, GremlinScriptEngine {
/**
* An "internal" key for sandboxing the script engine - technically not for public use.
@@ -136,7 +125,7 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
/**
* Name of variable that holds local variables to be globally bound if "interpreter mode" is enabled with
- * {@link InterpreterModeCustomizerProvider}.
+ * {@link InterpreterModeGroovyCustomizer}.
*/
public static final String COLLECTED_BOUND_VARS_MAP_VARNAME = "gremlin_script_engine_collected_boundvars";
@@ -175,17 +164,13 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
private static final String DOT_GROOVY = ".groovy";
private static final String GROOVY_LANG_SCRIPT = "groovy.lang.Script";
- private ImportCustomizerProvider importCustomizerProvider;
- private final List<CompilerCustomizerProvider> customizerProviders;
-
private final ImportGroovyCustomizer importGroovyCustomizer;
private final List<GroovyCustomizer> groovyCustomizers;
- private final Set<Artifact> artifactsToUse = new HashSet<>();
private final boolean interpreterModeEnabled;
/**
- * Creates a new instance using the {@link DefaultImportCustomizerProvider}.
+ * Creates a new instance using no {@link Customizer}.
*/
public GremlinGroovyScriptEngine() {
this(new Customizer[0]);
@@ -215,138 +200,10 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
interpreterModeEnabled = groovyCustomizers.stream()
.anyMatch(p -> p.getClass().equals(InterpreterModeGroovyCustomizer.class));
- // not using the old provider model so set that to empty list so that when createClassLoader is called
- // it knows to use groovyCustomizers instead
- customizerProviders = Collections.emptyList();
-
- createClassLoader();
- }
-
- /**
- * Creates a new instance with the specified {@link CompilerCustomizerProvider} objects.
- *
- * @deprecated As of release 3.2.4, replaced by {@link #GremlinGroovyScriptEngine(Customizer...)}.
- */
- @Deprecated
- public GremlinGroovyScriptEngine(final CompilerCustomizerProvider... compilerCustomizerProviders) {
- final List<CompilerCustomizerProvider> providers = Arrays.asList(compilerCustomizerProviders);
-
- GremlinLoader.load();
-
- importCustomizerProvider = providers.stream()
- .filter(p -> p instanceof ImportCustomizerProvider)
- .map(p -> (ImportCustomizerProvider) p)
- .findFirst().orElse(NoImportCustomizerProvider.INSTANCE);
-
- // determine if interpreter mode should be enabled
- interpreterModeEnabled = providers.stream()
- .anyMatch(p -> p.getClass().equals(InterpreterModeCustomizerProvider.class));
-
- // remove used providers as the rest will be applied directly
- customizerProviders = providers.stream()
- .filter(p -> p != null && !(p instanceof ImportCustomizerProvider))
- .collect(Collectors.toList());
-
- // groovy customizers are not used here - set to empty list so that the customizerProviders get used
- // in createClassLoader
- groovyCustomizers = Collections.emptyList();
- importGroovyCustomizer = null;
-
createClassLoader();
}
/**
- * {@inheritDoc}
- * <p/>
- * This method should be called after "expected" imports have been added to the {@code DependencyManager}
- * because adding imports with {@link #addImports(java.util.Set)} will reset the classloader and flush away
- * dependencies.
- */
- @Override
- public synchronized List<GremlinPlugin> use(final String group, final String artifact, final String version) {
- final Map<String, Object> dependency = new HashMap<String, Object>() {{
- put("group", group);
- put("module", artifact);
- put("version", version);
- }};
-
- final Map<String, Object> args = new HashMap<String, Object>() {{
- put("classLoader", loader);
- }};
-
- Grape.grab(args, dependency);
-
- // note that the service loader utilized the classloader from the groovy shell as shell class are available
- // from within there given loading through Grape.
- final List<GremlinPlugin> pluginsFound = new ArrayList<>();
- ServiceLoader.load(GremlinPlugin.class, loader).forEach(pluginsFound::add);
-
- artifactsToUse.add(new Artifact(group, artifact, version));
-
- return pluginsFound;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void loadPlugins(final List<GremlinPlugin> plugins) throws GremlinPluginException {
- for (GremlinPlugin gremlinPlugin : plugins) {
- if (!loadedPlugins.contains(gremlinPlugin.getName())) {
- gremlinPlugin.pluginTo(new ScriptEnginePluginAcceptor(this));
- loadedPlugins.add(gremlinPlugin.getName());
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map[] dependencies() {
- return Grape.listDependencies(loader);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<String, Set<String>> imports() {
- final Map<String, Set<String>> m = new HashMap<>();
- m.put("imports", importCustomizerProvider.getImports());
- m.put("staticImports", importCustomizerProvider.getStaticImports());
- m.put("extraImports", importCustomizerProvider.getExtraImports());
- m.put("extraStaticImports", importCustomizerProvider.getExtraStaticImports());
- return m;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public synchronized void addImports(final Set<String> importStatements) {
- // can't use this feature because imports can't come in as String for the revised model
- if (null == importCustomizerProvider)
- throw new IllegalStateException("Imports cannot be added to a GremlinGroovyScriptEngine that uses Customizer instances");
-
- final Set<String> staticImports = new HashSet<>();
- final Set<String> imports = new HashSet<>();
-
- importStatements.forEach(s -> {
- final String trimmed = s.trim();
- if (patternImportStatic.matcher(trimmed).matches()) {
- final int pos = trimmed.indexOf(STATIC);
- staticImports.add(s.substring(pos + 6).trim());
- } else
- imports.add(s.substring(6).trim());
- });
-
- importCustomizerProvider = new EmptyImportCustomizerProvider(importCustomizerProvider, imports, staticImports);
-
- internalReset();
- }
-
- /**
* Get the list of loaded plugins.
*/
public Set getPlugins() {
@@ -376,21 +233,16 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
}
/**
- * {@inheritDoc}
+ * Resets the entire {@code GremlinGroovyScriptEngine} by clearing script caches, recreating the classloader,
+ * clearing bindings.
*/
- @Override
public void reset() {
internalReset();
-
- loadedPlugins.clear();
-
getContext().getBindings(ScriptContext.ENGINE_SCOPE).clear();
}
/**
- * Resets the {@code ScriptEngine} but does not clear the loaded plugins or bindings. Typically called by
- * {@link DependencyManager} methods that need to just force the classloader to be recreated and script caches
- * cleared.
+ * Resets the {@code ScriptEngine} but does not clear the loaded plugins or bindings.
*/
private void internalReset() {
createClassLoader();
@@ -399,9 +251,6 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
// referenced before that might not have evaluated might cleanly evaluate now.
classMap.clear();
globalClosures.clear();
-
- final Set<Artifact> toReuse = new HashSet<>(artifactsToUse);
- toReuse.forEach(this::use);
}
/**
@@ -670,36 +519,17 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
}
private synchronized void createClassLoader() {
- // check for customizerProviders temporarily until this deprecated stuff is gone
- if (groovyCustomizers.isEmpty() && null == importGroovyCustomizer) {
- final CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
- conf.addCompilationCustomizers(this.importCustomizerProvider.create());
-
- // ConfigurationCustomizerProvider is treated separately
- customizerProviders.stream().filter(cp -> !(cp instanceof ConfigurationCustomizerProvider))
- .forEach(p -> conf.addCompilationCustomizers(p.create()));
-
- customizerProviders.stream().filter(cp -> cp instanceof ConfigurationCustomizerProvider).findFirst()
- .ifPresent(cp -> ((ConfigurationCustomizerProvider) cp).applyCustomization(conf));
-
- this.loader = new GremlinGroovyClassLoader(getParentLoader(), conf);
- } else {
- final CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
- conf.addCompilationCustomizers(this.importGroovyCustomizer.create());
-
- // ConfigurationCustomizerProvider is treated separately
- groovyCustomizers.stream().filter(cp -> !(cp instanceof ConfigurationGroovyCustomizer))
- .forEach(p -> conf.addCompilationCustomizers(p.create()));
+ final CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
+ conf.addCompilationCustomizers(this.importGroovyCustomizer.create());
- groovyCustomizers.stream().filter(cp -> cp instanceof ConfigurationGroovyCustomizer).findFirst()
- .ifPresent(cp -> ((ConfigurationGroovyCustomizer) cp).applyCustomization(conf));
+ // ConfigurationCustomizerProvider is treated separately
+ groovyCustomizers.stream().filter(cp -> !(cp instanceof ConfigurationGroovyCustomizer))
+ .forEach(p -> conf.addCompilationCustomizers(p.create()));
- this.loader = new GremlinGroovyClassLoader(getParentLoader(), conf);
- }
- }
+ groovyCustomizers.stream().filter(cp -> cp instanceof ConfigurationGroovyCustomizer).findFirst()
+ .ifPresent(cp -> ((ConfigurationGroovyCustomizer) cp).applyCustomization(conf));
- private void use(final Artifact artifact) {
- use(artifact.getGroup(), artifact.getArtifact(), artifact.getVersion());
+ this.loader = new GremlinGroovyClassLoader(getParentLoader(), conf);
}
private Object callGlobal(final String name, final Object args[]) {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java
deleted file mode 100644
index 5832e0b..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptEnginePluginAcceptor.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.groovy.jsr223;
-
-import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin;
-import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor;
-
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import javax.script.SimpleBindings;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A {@link PluginAcceptor} implementation for bare {@code ScriptEngine} implementations allowing plugins to
- * interact with them on initialization.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced.
- */
-@Deprecated
-public class ScriptEnginePluginAcceptor implements PluginAcceptor {
- private final ScriptEngine scriptEngine;
-
- public ScriptEnginePluginAcceptor(final ScriptEngine scriptEngine) {
- this.scriptEngine = scriptEngine;
- }
-
- /**
- * Adds global bindings to the {@code ScriptEngine} that will be applied to every evaluated script.
- */
- @Override
- public void addBinding(final String key, final Object val) {
- // The binding was originally added to the engine scope but that proved to be "bad" as it mixed with other
- // bindings in that space.
- if (null == scriptEngine.getContext().getBindings(ScriptContext.GLOBAL_SCOPE))
- scriptEngine.getContext().setBindings(new SimpleBindings(), ScriptContext.GLOBAL_SCOPE);
- scriptEngine.getContext().setAttribute(key, val, ScriptContext.GLOBAL_SCOPE);
- }
-
- /**
- * Gets the global bindings that will be applied to every evaluated script.
- */
- @Override
- public Map<String, Object> getBindings() {
- // as these "global" bindings were added to engine scope they should be pulled from the same place
- return scriptEngine.getBindings(ScriptContext.GLOBAL_SCOPE);
- }
-
- /**
- * If the {@code ScriptEngine} implements the {@link DependencyManager} interface it will try to import the
- * specified import statements.
- */
- @Override
- public void addImports(final Set<String> importStatements) {
- if (this.scriptEngine instanceof DependencyManager)
- ((DependencyManager) this.scriptEngine).addImports(importStatements);
- }
-
- /**
- * Evaluate a script in the {@code ScriptEngine}. Typically {@code eval()} should be called after imports as
- * {@code ScriptEngine} resets may occur during import.
- */
- @Override
- public Object eval(final String script) throws ScriptException {
- return this.scriptEngine.eval(script);
- }
-
- /**
- * Defines the environment settings for the {@link GremlinPlugin}.
- */
- @Override
- public Map<String, Object> environment() {
- final Map<String, Object> env = new HashMap<>();
- env.put(GremlinPlugin.ENVIRONMENT, "scriptEngine");
- return env;
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java
index bdd49b3..5751687 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TimedInterruptTimeoutException.java
@@ -18,12 +18,10 @@
*/
package org.apache.tinkerpop.gremlin.groovy.jsr223;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider;
-
import java.util.concurrent.TimeoutException;
/**
- * An exception thrown from the {@link TimedInterruptCustomizerProvider} when the timeout is exceeded. This exception
+ * An exception thrown from the {@link TimedInterruptGroovyCustomizer} when the timeout is exceeded. This exception
* allows differentiation from other "timeout exceptions" that might occur.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java
index ac8dd1d..0dde1dc 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/TypeCheckedGroovyCustomizer.java
@@ -19,7 +19,6 @@
package org.apache.tinkerpop.gremlin.groovy.jsr223;
import groovy.transform.TypeChecked;
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
import org.codehaus.groovy.control.customizers.CompilationCustomizer;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
deleted file mode 100644
index 4371e8a..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/CompileStaticCustomizerProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.groovy.jsr223.customizer;
-
-import groovy.transform.CompileStatic;
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
-import org.codehaus.groovy.control.customizers.CompilationCustomizer;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Injects the {@code CompileStatic} transformer to enable type validation on script execution.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced by a public class.
- */
-@Deprecated
-public class CompileStaticCustomizerProvider implements CompilerCustomizerProvider {
-
- private final String extensions;
-
- public CompileStaticCustomizerProvider() {
- this(null);
- }
-
- public CompileStaticCustomizerProvider(final String extensions) {
- this.extensions = extensions;
- }
-
- @Override
- public CompilationCustomizer create() {
- final Map<String, Object> annotationParams = new HashMap<>();
- if (extensions != null && !extensions.isEmpty()) {
- if (extensions.contains(","))
- annotationParams.put("extensions", Stream.of(extensions.split(",")).collect(Collectors.toList()));
- else
- annotationParams.put("extensions", Collections.singletonList(extensions));
- }
-
- return new ASTTransformationCustomizer(annotationParams, CompileStatic.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
deleted file mode 100644
index 3c8b673..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ConfigurationCustomizerProvider.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.groovy.jsr223.customizer;
-
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
-import org.codehaus.groovy.control.CompilerConfiguration;
-import org.codehaus.groovy.control.customizers.CompilationCustomizer;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Allows configurations to be directly supplied to a groovy {@code CompilerConfiguration} when a
- * {@link org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine} is initialized, providing fine-grained
- * control over its internals.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced by a public class.
- */
-@Deprecated
-public class ConfigurationCustomizerProvider implements CompilerCustomizerProvider {
-
- private final Map<String,Object> properties;
-
- /**
- * Creates a new instance using configuration values specified
- */
- public ConfigurationCustomizerProvider(final Object... keyValues) {
- if (null == keyValues || keyValues.length == 0)
- throw new IllegalArgumentException("ConfigurationCustomizerProvider must have key/values specified");
-
- if (keyValues.length % 2 != 0)
- throw new IllegalArgumentException("The keyValues must have an even number of values");
-
- properties = ElementHelper.asMap(keyValues);
- }
-
- /**
- * Creates a new instance using configuration values specified
- */
- public ConfigurationCustomizerProvider(final Map<String,Object> keyValues) {
- properties = keyValues;
- }
-
- public CompilerConfiguration applyCustomization(final CompilerConfiguration compilerConfiguration) {
- final Class<CompilerConfiguration> clazz = CompilerConfiguration.class;
- final List<Method> methods = Arrays.asList(clazz.getMethods());
- for (Map.Entry<String,Object> entry : properties.entrySet()) {
- final Method method = methods.stream().filter(m -> m.getName().equals("set" + entry.getKey())).findFirst()
- .orElseThrow(() -> new IllegalStateException("Invalid setting [" + entry.getKey() + "] for CompilerConfiguration"));
-
- try {
- method.invoke(compilerConfiguration, entry.getValue());
- } catch (Exception ex) {
- throw new IllegalStateException(ex);
- }
- }
-
- return compilerConfiguration;
- }
-
- @Override
- public CompilationCustomizer create() {
- throw new UnsupportedOperationException("This is a marker implementation that does not create a CompilationCustomizer instance");
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
deleted file mode 100644
index 3044474..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/InterpreterModeCustomizerProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.groovy.jsr223.customizer;
-
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.ast.InterpreterMode;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
-import org.codehaus.groovy.control.customizers.CompilationCustomizer;
-
-/**
- * Places the {@code ScriptEngine} in "interpreter mode" where local variables of a script are treated as global
- * bindings. This implementation is technically not a true {@link CompilerCustomizerProvider} instance as the
- * "interpreter mode" feature does not require a {@code CompilerCustomizer}. This class merely acts as a flag that
- * tells the {@link org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine} to turn this feature on.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced by a public class.
- */
-@Deprecated
-public class InterpreterModeCustomizerProvider implements CompilerCustomizerProvider {
- @Override
- public CompilationCustomizer create() {
- return new ASTTransformationCustomizer(InterpreterMode.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
deleted file mode 100644
index c5fc60c..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/ThreadInterruptCustomizerProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.groovy.jsr223.customizer;
-
-import groovy.transform.ThreadInterrupt;
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
-import org.codehaus.groovy.control.customizers.CompilationCustomizer;
-
-/**
- * Injects checks for thread interruption into scripts.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced by a public class.
- */
-@Deprecated
-public class ThreadInterruptCustomizerProvider implements CompilerCustomizerProvider {
- @Override
- public CompilationCustomizer create() {
- return new ASTTransformationCustomizer(ThreadInterrupt.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
deleted file mode 100644
index f0e1080..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptCustomizerProvider.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.groovy.jsr223.customizer;
-
-import groovy.transform.TimedInterrupt;
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.codehaus.groovy.ast.tools.GeneralUtils;
-import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
-import org.codehaus.groovy.control.customizers.CompilationCustomizer;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Injects a check in loops and other areas of code to interrupt script execution if the run time exceeds the
- * specified time.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced by a public class.
- */
-@Deprecated
-public class TimedInterruptCustomizerProvider implements CompilerCustomizerProvider {
- public static final long DEFAULT_INTERRUPTION_TIMEOUT = 60000;
-
- private final long interruptionTimeout;
-
- public TimedInterruptCustomizerProvider() {
- this(DEFAULT_INTERRUPTION_TIMEOUT);
- }
-
- public TimedInterruptCustomizerProvider(final Long interruptionTimeout) {
- this.interruptionTimeout = interruptionTimeout;
- }
-
- public TimedInterruptCustomizerProvider(final Integer interruptionTimeout) {
- this.interruptionTimeout = interruptionTimeout.longValue();
- }
-
- @Override
- public CompilationCustomizer create() {
- final Map<String, Object> timedInterruptAnnotationParams = new HashMap<>();
- timedInterruptAnnotationParams.put("value", interruptionTimeout);
- timedInterruptAnnotationParams.put("unit", GeneralUtils.propX(GeneralUtils.classX(TimeUnit.class), TimeUnit.MILLISECONDS.toString()));
- timedInterruptAnnotationParams.put("checkOnMethodStart", false);
- timedInterruptAnnotationParams.put("thrown", GeneralUtils.classX(TimedInterruptTimeoutException.class));
- return new ASTTransformationCustomizer(timedInterruptAnnotationParams, TimedInterrupt.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java
deleted file mode 100644
index 4063d4f..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TimedInterruptTimeoutException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.groovy.jsr223.customizer;
-
-import java.util.concurrent.TimeoutException;
-
-/**
- * An exception thrown from the {@link TimedInterruptCustomizerProvider} when the timeout is exceeded. This exception
- * allows differentiation from other "timeout exceptions" that might occur.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException}.
- */
-@Deprecated
-public class TimedInterruptTimeoutException extends TimeoutException {
- public TimedInterruptTimeoutException() {
- }
-
- public TimedInterruptTimeoutException(final String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
deleted file mode 100644
index b5c2729..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/TypeCheckedCustomizerProvider.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.groovy.jsr223.customizer;
-
-import groovy.transform.TypeChecked;
-import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
-import org.apache.tinkerpop.gremlin.jsr223.Customizer;
-import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
-import org.codehaus.groovy.control.customizers.CompilationCustomizer;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Injects the {@code TypeChecked} transformer to enable type validation on script execution.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced by a public class.
- */
-@Deprecated
-public class TypeCheckedCustomizerProvider implements CompilerCustomizerProvider {
-
- private final String extensions;
-
- public TypeCheckedCustomizerProvider() {
- this(null);
- }
-
- /**
- * Configures the {@code TypeChecked} annotation to use optional extensions. The argument should be one or more
- * groovy scripts on the classpath or the fully qualified classname of a precompiled extension. If there are
- * multiple extensions then extensions should be comma separated.
- */
- public TypeCheckedCustomizerProvider(final String extensions) {
- this.extensions = extensions;
- }
-
- @Override
- public CompilationCustomizer create() {
- final Map<String, Object> annotationParams = new HashMap<>();
- if (extensions != null && !extensions.isEmpty()) {
- if (extensions.contains(","))
- annotationParams.put("extensions", Stream.of(extensions.split(",")).collect(Collectors.toList()));
- else
- annotationParams.put("extensions", Collections.singletonList(extensions));
- }
- return new ASTTransformationCustomizer(annotationParams, TypeChecked.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java
deleted file mode 100644
index 2c216d7..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/customizer/VariableIdentificationCustomizer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.groovy.jsr223.customizer;
-
-import org.codehaus.groovy.ast.ClassCodeVisitorSupport;
-import org.codehaus.groovy.ast.ClassNode;
-import org.codehaus.groovy.ast.expr.VariableExpression;
-import org.codehaus.groovy.classgen.GeneratorContext;
-import org.codehaus.groovy.control.CompilationFailedException;
-import org.codehaus.groovy.control.CompilePhase;
-import org.codehaus.groovy.control.SourceUnit;
-import org.codehaus.groovy.control.customizers.CompilationCustomizer;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced.
- */
-@Deprecated
-public class VariableIdentificationCustomizer extends CompilationCustomizer {
-
- private static final ThreadLocal<Set<String>> variables = new ThreadLocal<Set<String>>() {
- @Override
- protected Set<String> initialValue() {
- return new TreeSet<>();
- }
- };
-
- private static final List<String> variablesToIgnore = new ArrayList<>(Arrays.asList("this", "args", "context", "super"));
-
- public VariableIdentificationCustomizer() {
- super(CompilePhase.CLASS_GENERATION);
- }
-
- public Set<String> getVariables() {
- return variables.get();
- }
-
- public void clearVariables() {
- variables.get().clear();
- }
-
- @Override
- public void call(final SourceUnit sourceUnit, final GeneratorContext generatorContext,
- final ClassNode classNode) throws CompilationFailedException {
- classNode.visitContents(new Visitor(sourceUnit));
- }
-
- class Visitor extends ClassCodeVisitorSupport {
-
- private SourceUnit sourceUnit;
-
- public Visitor(final SourceUnit sourceUnit) {
- this.sourceUnit = sourceUnit;
- }
-
- @Override
- public void visitVariableExpression(final VariableExpression expression) {
- if (!variablesToIgnore.contains(expression.getName())
- && expression.getAccessedVariable().isDynamicTyped()) {
- variables.get().add(expression.getName());
- }
-
- super.visitVariableExpression(expression);
- }
-
- @Override
- protected SourceUnit getSourceUnit() {
- return sourceUnit;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java
deleted file mode 100644
index 090da6e..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/AbstractGremlinPlugin.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-import org.codehaus.groovy.tools.shell.Groovysh;
-import org.codehaus.groovy.tools.shell.IO;
-
-import java.util.Map;
-
-/**
- * A base class for a plugin that provides access to the shell and io variables. This is a good class to extend
- * from if the plugin needs to interact with the shell in some way, such as the case with those plugins that
- * want to utilize the {@link org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor} and may need access to those
- * shell and io objects.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin}.
- */
-@Deprecated
-public abstract class AbstractGremlinPlugin implements GremlinPlugin {
- public static final String ENV_CONSOLE_IO = "ConsolePluginAcceptor.io";
- public static final String ENV_CONSOLE_SHELL = "ConsolePluginAcceptor.shell";
-
- protected static final String IMPORT_SPACE = "import ";
- protected static final String IMPORT_STATIC_SPACE = "import static ";
- protected static final String DOT_STAR = ".*";
-
- protected IO io;
- protected Groovysh shell;
- protected final boolean requireConsoleEnvironment;
-
- /**
- * Creates a new instance that does not force the plugin to require the console. This will create a plugin that
- * will work in Gremlin Console and Gremlin Server.
- */
- public AbstractGremlinPlugin() {
- this(false);
- }
-
- /**
- * Creates a new instance that allows the plugin to specify whether the console is required or not. It is only
- * necessary to require the console if there are specific required calls to {@code IO} or to {@code Groovysh}
- * methods in the plugin (as those classes are Gremlin Console related and cannot be provided outside of that
- * environment). For a plugin to work in the Gremlin Console and in Gremlin Server this value must be set
- * to {@code false}.
- */
- public AbstractGremlinPlugin(final boolean requireConsoleEnvironment) {
- this.requireConsoleEnvironment = requireConsoleEnvironment;
- }
-
- /**
- * {@inheritDoc}
- * <p/>
- * Provides a base implementation for plugins by grabbing the console environment variables and assigning them
- * to the {@link #io} and {@link #shell} member variables.
- *
- * @throws IllegalEnvironmentException if {@link #requireConsoleEnvironment} is set to true and if either
- * the {@link #io} and {@link #shell} member variables are null.
- */
- @Override
- public void pluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException {
- final Map<String, Object> environment = pluginAcceptor.environment();
- io = (IO) environment.get(ENV_CONSOLE_IO);
- shell = (Groovysh) environment.get(ENV_CONSOLE_SHELL);
-
- if (requireConsoleEnvironment && (null == io || null == shell))
- throw new IllegalEnvironmentException(this, ENV_CONSOLE_SHELL, ENV_CONSOLE_IO);
-
- try {
- afterPluginTo(pluginAcceptor);
- } catch (PluginInitializationException pie) {
- throw pie;
- } catch (Exception ex) {
- throw new PluginInitializationException(ex);
- }
- }
-
- /**
- * Called after the {@link #pluginTo(PluginAcceptor)} method is executed which sets the {@link #io} and
- * {@link #shell} member variables.
- */
- public abstract void afterPluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException;
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
deleted file mode 100644
index 7fb0bd3..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-/**
- * A software artifact identified by its maven coordinates.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.util.Artifact}
- */
-@Deprecated
-public class Artifact {
- private final String group;
- private final String artifact;
- private final String version;
-
- /**
- * Create a new instance.
- *
- * @param group the {@code groupId}
- * @param artifact the {@code artifactId}
- * @param version the {@code version}
- */
- public Artifact(final String group, final String artifact, final String version) {
- if (group == null || group.isEmpty())
- throw new IllegalArgumentException("group cannot be null or empty");
-
- if (artifact == null || artifact.isEmpty())
- throw new IllegalArgumentException("artifact cannot be null or empty");
-
- if (version == null || version.isEmpty())
- throw new IllegalArgumentException("version cannot be null or empty");
-
- this.group = group;
- this.artifact = artifact;
- this.version = version;
- }
-
- public String getGroup() {
- return group;
- }
-
- public String getArtifact() {
- return artifact;
- }
-
- public String getVersion() {
- return version;
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- final Artifact a = (Artifact) o;
-
- if (group != null ? !group.equals(a.group) : a.group != null) return false;
- if (artifact != null ? !artifact.equals(a.artifact) : a.artifact != null) return false;
- if (version != null ? !version.equals(a.version) : a.version != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = group != null ? group.hashCode() : 0;
- result = 31 * result + (artifact != null ? artifact.hashCode() : 0);
- result = 31 * result + (version != null ? version.hashCode() : 0);
- return result;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java
deleted file mode 100644
index 400c003..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPlugin.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-import java.util.Optional;
-
-/**
- * Those wanting to extend Gremlin can implement this interface to provide mapper imports and extension
- * methods to the language itself. Gremlin uses {@code ServiceLoader} to install plugins. It is necessary for
- * projects to include a {@code org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin} file in
- * {@code META-INF/services} of their packaged project which includes the full class names of the implementations
- * of this interface to install.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As for 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin}
- */
-@Deprecated
-public interface GremlinPlugin {
- public static final String ENVIRONMENT = "GremlinPlugin.env";
-
- /**
- * The name of the plugin. This name should be unique (use a namespaced approach) as naming clashes will
- * prevent proper plugin operations. Plugins developed by TinkerPop will be prefixed with "tinkerpop."
- * For example, TinkerPop's implementation of Giraph would be named "tinkerpop.giraph". If Facebook were
- * to do their own implementation the implementation might be called "facebook.giraph".
- */
- public String getName();
-
- /**
- * Implementers will typically execute imports of classes within their project that they want available in the
- * console or they may use meta programming to introduce new extensions to the Gremlin.
- *
- * @throws IllegalEnvironmentException if there are missing environment properties required by the plugin as
- * provided from {@link PluginAcceptor#environment()}.
- * @throws PluginInitializationException if there is a failure in the plugin iniitalization process
- */
- public void pluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException;
-
- /**
- * Some plugins may require a restart of the plugin host for the classloader to pick up the features. This is
- * typically true of plugins that rely on {@code Class.forName()} to dynamically instantiate classes from the
- * root classloader (e.g. JDBC drivers that instantiate via @{code DriverManager}).
- */
- public default boolean requireRestart() {
- return false;
- }
-
- /**
- * Allows a plugin to utilize features of the {@code :remote} and {@code :submit} commands of the Gremlin Console.
- * This method does not need to be implemented if the plugin is not meant for the Console for some reason or
- * if it does not intend to take advantage of those commands.
- */
- public default Optional<RemoteAcceptor> remoteAcceptor() {
- return Optional.empty();
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java
deleted file mode 100644
index c8664c7..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/GremlinPluginException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-/**
- * Base exception for {@link GremlinPlugin}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced.
- */
-@Deprecated
-public abstract class GremlinPluginException extends Exception {
- public GremlinPluginException() {
- }
-
- public GremlinPluginException(final String message) {
- super(message);
- }
-
- public GremlinPluginException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public GremlinPluginException(final Throwable cause) {
- super(cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java
deleted file mode 100644
index 8d6fbe2..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/IllegalEnvironmentException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-/**
- * An exception thrown when the environment variables passed via {@link PluginAcceptor#environment()} do not meet
- * the needs of the {@link GremlinPlugin}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced.
- */
-@Deprecated
-public class IllegalEnvironmentException extends GremlinPluginException {
- public IllegalEnvironmentException(final GremlinPlugin plugin, final String... expectedKeys) {
- super(String.format("The %s plugin may not be compatible with this environment - requires the follow ScriptEngine environment keys [%s]", plugin.getName(), String.join(",", expectedKeys)));
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
deleted file mode 100644
index 9165237..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginAcceptor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-import org.apache.tinkerpop.gremlin.groovy.jsr223.DependencyManager;
-
-import javax.script.ScriptException;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A {@link GremlinPlugin} can be used in multiple environments (e.g. ScriptEngine implementation). Any environment
- * wishing to allow plugins should implement the {@code PluginAcceptor}. It acts as an adapter to those environments
- * and provides the abstractions required for a plugin to work regardless of the environmental implementations.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.console.PluginAcceptor}.
- */
-@Deprecated
-public interface PluginAcceptor {
- /**
- * If the {@code PluginAcceptor} implements the {@link DependencyManager} interface it will try to import the
- * specified import statements.
- */
- public void addImports(final Set<String> importStatements);
-
- /**
- * Add a variable binding for the plugin host.
- */
- public void addBinding(final String key, final Object val);
-
- /**
- * Gets the list of bindings from the plugin host. These bindings will represent the "global" binding list.
- */
- public Map<String, Object> getBindings();
-
- /**
- * Evaluate a script in the {@code PluginAcceptor}.
- */
- public Object eval(final String script) throws ScriptException;
-
- /**
- * Returns a map of implementation specific variables that can be referenced by the plugin. Those writing
- * plugins should examine the details of the various {@code PluginAcceptor} implementations for the variables
- * that they pass, as they may provide important information useful to the plugin itself.
- */
- public default Map<String, Object> environment() {
- return Collections.emptyMap();
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java
deleted file mode 100644
index 0dd6fc1..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/PluginInitializationException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-/**
- * An exception that occurs as a result of plugin initialization, typically triggered by a bad evaluation in the
- * {@code ScriptEngine}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, not replaced.
- */
-@Deprecated
-public class PluginInitializationException extends GremlinPluginException {
- public PluginInitializationException(final String message) {
- super(message);
- }
-
- public PluginInitializationException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public PluginInitializationException(final Throwable cause) {
- super(cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
deleted file mode 100644
index 2bb8663..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteAcceptor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-import org.codehaus.groovy.tools.shell.Groovysh;
-
-import java.io.Closeable;
-import java.util.List;
-
-/**
- * The Gremlin Console supports the {@code :remote} and {@code :submit} commands which provide standardized ways
- * for plugins to provide "remote connections" to resources and a way to "submit" a command to those resources.
- * A "remote connection" does not necessarily have to be a remote server. It simply refers to a resource that is
- * external to the console.
- * <p/>
- * By implementing this interface and returning an instance of it through {@link GremlinPlugin#remoteAcceptor()} a
- * plugin can hook into those commands and provide remoting features.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor};
- */
-@Deprecated
-public interface RemoteAcceptor extends Closeable {
-
- public static final String RESULT = "result";
-
- /**
- * Gets called when {@code :remote} is used in conjunction with the "connect" option. It is up to the
- * implementation to decide how additional arguments on the line should be treated after "connect".
- *
- * @return an object to display as output to the user
- * @throws org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException if there is a problem with connecting
- */
- public Object connect(final List<String> args) throws RemoteException;
-
- /**
- * Gets called when {@code :remote} is used in conjunction with the {@code config} option. It is up to the
- * implementation to decide how additional arguments on the line should be treated after {@code config}.
- *
- * @return an object to display as output to the user
- * @throws org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException if there is a problem with configuration
- */
- public Object configure(final List<String> args) throws RemoteException;
-
- /**
- * Gets called when {@code :submit} is executed. It is up to the implementation to decide how additional
- * arguments on the line should be treated after {@code :submit}.
- *
- * @return an object to display as output to the user
- * @throws org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException if there is a problem with submission
- */
- public Object submit(final List<String> args) throws RemoteException;
-
- /**
- * If the {@code RemoteAcceptor} is used in the Gremlin Console, then this method might be called to determine
- * if it can be used in a fashion that supports the {@code :remote console} command. By default, this value is
- * set to {@code false}.
- * <p/>
- * A {@code RemoteAcceptor} should only return {@code true} for this method if it expects that all activities it
- * supports are executed through the {@code :sumbit} command. If the users interaction with the remote requires
- * working with both local and remote evaluation at the same time, it is likely best to keep this method return
- * {@code false}. A good example of this type of plugin would be the Gephi Plugin which uses {@code :remote config}
- * to configure a local {@code TraversalSource} to be used and expects calls to {@code :submit} for the same body
- * of analysis.
- */
- public default boolean allowRemoteConsole() {
- return false;
- }
-
- /**
- * Retrieve a script as defined in the shell context. This allows for multi-line scripts to be submitted.
- */
- public static String getScript(final String submittedScript, final Groovysh shell) {
- return submittedScript.startsWith("@") ? shell.getInterp().getContext().getProperty(submittedScript.substring(1)).toString() : submittedScript;
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java
deleted file mode 100644
index 3eb5f69..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/RemoteException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-/**
- * A mapper {@link Exception} to be thrown when there are problems with processing a command given to a
- * {@link org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor}. The message provided to the exception will
- * be displayed to the user in the Console.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.jsr223.console.RemoteException};
- */
-@Deprecated
-public class RemoteException extends Exception {
- public RemoteException(final String message) {
- super(message);
- }
-
- public RemoteException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public RemoteException(final Throwable cause) {
- super(cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java
deleted file mode 100644
index 0666d71..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/SugarGremlinPlugin.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.groovy.plugin;
-
-import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
-
-/**
- * A plugin implementation which allows for the usage of Gremlin Groovy's syntactic sugar.
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.jsr223.SugarGremlinPlugin}.
- */
-@Deprecated
-public class SugarGremlinPlugin extends AbstractGremlinPlugin {
-
- @Override
- public String getName() {
- return "tinkerpop.sugar";
- }
-
- /**
- * {@inheritDoc}
- * <p/>
- * Executes the {@link SugarLoader#load()} method in the {@link PluginAcceptor}.
- */
- @Override
- public void afterPluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException {
- try {
- pluginAcceptor.eval(SugarLoader.class.getPackage().getName() + "." + SugarLoader.class.getSimpleName() + ".load()");
- } catch (Exception ex) {
- if (io != null)
- io.out.println("Error loading the 'tinkerpop.sugar' plugin - " + ex.getMessage());
- else
- throw new PluginInitializationException("Error loading the 'tinkerpop.sugar' plugin - " + ex.getMessage(), ex);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java
deleted file mode 100644
index 564c573..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraph.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.groovy.plugin.dsl.credential;
-
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.T;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.mindrot.jbcrypt.BCrypt;
-
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.drop;
-
-/**
- * A DSL for managing a "credentials graph" used by Gremlin Server for simple authentication functions. If the
- * {@link Graph} is transactional, new transactions will be started for each method call.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraph}.
- */
-@Deprecated
-public class CredentialGraph {
-
- private final int BCRYPT_ROUNDS = 4;
- private final Graph graph;
- private final GraphTraversalSource g;
- private final boolean supportsTransactions;
-
- public CredentialGraph(final Graph graph) {
- this.graph = graph;
- g = graph.traversal();
- supportsTransactions = graph.features().graph().supportsTransactions();
- }
-
- /**
- * Finds a user by username and return {@code null} if one could not be found.
- *
- * @throws IllegalStateException if there is more than one user with a particular username.
- */
- public Vertex findUser(final String username) {
- if (supportsTransactions) g.tx().rollback();
- final GraphTraversal<Vertex,Vertex> t = g.V().has(CredentialGraphTokens.PROPERTY_USERNAME, username);
- final Vertex v = t.hasNext() ? t.next() : null;
- if (t.hasNext()) throw new IllegalStateException(String.format("Multiple users with username %s", username));
- return v;
- }
-
- /**
- * Creates a new user.
- *
- * @return the newly created user vertex
- */
- public Vertex createUser(final String username, final String password) {
- if (findUser(username) != null) throw new IllegalStateException("User with this name already exists");
- if (supportsTransactions) graph.tx().rollback();
-
- try {
- final Vertex v = graph.addVertex(T.label, CredentialGraphTokens.VERTEX_LABEL_USER,
- CredentialGraphTokens.PROPERTY_USERNAME, username,
- CredentialGraphTokens.PROPERTY_PASSWORD, BCrypt.hashpw(password, BCrypt.gensalt(BCRYPT_ROUNDS)));
- if (supportsTransactions) graph.tx().commit();
- return v;
- } catch (Exception ex) {
- if (supportsTransactions) graph.tx().rollback();
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * Removes a user by name.
- *
- * @return the number of users removed (which should be one or zero)
- */
- public long removeUser(final String username) {
- if (supportsTransactions) graph.tx().rollback();
- try {
- final long count = g.V().has(CredentialGraphTokens.PROPERTY_USERNAME, username).sideEffect(drop()).count().next();
- if (supportsTransactions) graph.tx().commit();
- return count;
- } catch (Exception ex) {
- if (supportsTransactions) graph.tx().rollback();
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * Get a count of the number of users in the database.
- */
- public long countUsers() {
- if (supportsTransactions) graph.tx().rollback();
- return g.V().hasLabel(CredentialGraphTokens.VERTEX_LABEL_USER).count().next();
- }
-
- @Override
- public String toString() {
- return "CredentialGraph{" +
- "graph=" + graph +
- '}';
- }
-
- /**
- * Wrap up any {@link Graph} instance in the {@code CredentialGraph} DSL.
- */
- public static CredentialGraph credentials(final Graph graph) {
- return new CredentialGraph(graph);
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f0b8504/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java
deleted file mode 100644
index 50ee346..0000000
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphGremlinPlugin.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.groovy.plugin.dsl.credential;
-
-import org.apache.tinkerpop.gremlin.groovy.plugin.AbstractGremlinPlugin;
-import org.apache.tinkerpop.gremlin.groovy.plugin.IllegalEnvironmentException;
-import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor;
-import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Plugin for the "credentials graph". This plugin imports the {@link CredentialGraph} to its environment.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @deprecated As of release 3.2.4, replaced by {@link org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraphGremlinPlugin}.
- */
-@Deprecated
-public class CredentialGraphGremlinPlugin extends AbstractGremlinPlugin {
-
- private static final Set<String> IMPORTS = new HashSet<String>() {{
- add(IMPORT_SPACE + CredentialGraph.class.getName());
- add(IMPORT_STATIC_SPACE + CredentialGraph.class.getName() + DOT_STAR);
- }};
-
- @Override
- public String getName() {
- return "tinkerpop.credentials";
- }
-
- /**
- * {@inheritDoc}
- * <p/>
- * Adds imports for the {@link CredentialGraph}.
- */
- @Override
- public void afterPluginTo(final PluginAcceptor pluginAcceptor) throws IllegalEnvironmentException, PluginInitializationException {
- pluginAcceptor.addImports(IMPORTS);
- }
-}
\ No newline at end of file