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 2016/12/12 12:45:14 UTC

[12/46] tinkerpop git commit: TINKERPOP-1562 Added new plugins for gremlin-groovy to replace deprecated ones.

TINKERPOP-1562 Added new plugins for gremlin-groovy to replace deprecated ones.

Specifically did SugarGremlinPlugin and CredentialsGrpahGremlinPlugin.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/bb5b47dd
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bb5b47dd
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bb5b47dd

Branch: refs/heads/tp32
Commit: bb5b47dd98aa936673b1588202dbcc378a83b718
Parents: d0c941e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 14:20:11 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 2 06:28:51 2016 -0500

----------------------------------------------------------------------
 .../jsr223/ScriptEnginePluginAcceptor.java      |  2 +
 .../groovy/jsr223/SugarGremlinPlugin.java       | 45 ++++++++++++++++
 .../groovy/plugin/SugarGremlinPlugin.java       |  2 +
 .../CredentialGraphGremlinPlugin.java           |  2 +
 .../jsr223/CredentialGraphGremlinPlugin.java    | 55 ++++++++++++++++++++
 ...pache.tinkerpop.gremlin.jsr223.GremlinPlugin |  2 +
 6 files changed, 108 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/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
index 0bd51c2..5832e0b 100644
--- 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
@@ -34,7 +34,9 @@ import java.util.Set;
  * 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;
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
new file mode 100644
index 0000000..95c610f
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/SugarGremlinPlugin.java
@@ -0,0 +1,45 @@
+/*
+ * 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.loaders.SugarLoader;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultScriptCustomizer;
+
+import java.util.Collections;
+
+/**
+ * A plugin implementation which allows for the usage of Gremlin Groovy's syntactic sugar.
+ *
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class SugarGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.sugar";
+
+    public SugarGremlinPlugin() {
+        super(NAME, new DefaultScriptCustomizer(Collections.singletonList(
+                Collections.singletonList(SugarLoader.class.getPackage().getName() + "." + SugarLoader.class.getSimpleName() + ".load()"))));
+    }
+
+    @Override
+    public String getName() {
+        return "tinkerpop.sugar";
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/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
index 845ffc6..0666d71 100644
--- 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
@@ -24,7 +24,9 @@ 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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/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
index 8550615..72ca1d5 100644
--- 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
@@ -30,7 +30,9 @@ 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.plugin.dsl.credential.CredentialGraphGremlinPlugin}.
  */
+@Deprecated
 public class CredentialGraphGremlinPlugin extends AbstractGremlinPlugin {
 
     private static final Set<String> IMPORTS = new HashSet<String>() {{

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
new file mode 100644
index 0000000..761567b
--- /dev/null
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/jsr223/CredentialGraphGremlinPlugin.java
@@ -0,0 +1,55 @@
+/*
+ * 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.jsr223;
+
+import org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.CredentialGraph;
+import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+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)
+ */
+public class CredentialGraphGremlinPlugin extends AbstractGremlinPlugin {
+
+    private static final String NAME = "tinkerpop.credentials";
+
+    private static final ImportCustomizer imports;
+
+    static {
+        try {
+            imports = DefaultImportCustomizer.build()
+                    .addClassImports(CredentialGraph.class)
+                    .addMethodImports(CredentialGraph.class.getMethod("credentials", Graph.class))
+                    .create();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public CredentialGraphGremlinPlugin() {
+        super(NAME, imports);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bb5b47dd/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin b/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
new file mode 100644
index 0000000..0004a80
--- /dev/null
+++ b/gremlin-groovy/src/main/resources/META-INF/services/org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin
@@ -0,0 +1,2 @@
+org.apache.tinkerpop.gremlin.groovy.jsr223.SugarGremlinPlugin
+org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.jsr223.CredentialGraphGremlinPlugin
\ No newline at end of file