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 2015/08/21 16:37:52 UTC

incubator-tinkerpop git commit: Update javadocs for plugin infrastructure.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/tp30 1df2012f2 -> 649442c43


Update javadocs for plugin infrastructure.


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

Branch: refs/heads/tp30
Commit: 649442c43e0e2d293c2c50c63f127dc9114dde4f
Parents: 1df2012
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Aug 21 10:37:34 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Aug 21 10:37:34 2015 -0400

----------------------------------------------------------------------
 .../gremlin/groovy/plugin/Artifact.java         |  9 +++++++++
 .../gremlin/groovy/plugin/GremlinPlugin.java    |  7 ++++---
 .../gremlin/groovy/plugin/PluginAcceptor.java   | 10 ++++++++--
 .../gremlin/groovy/plugin/RemoteAcceptor.java   | 20 ++++++++++++++------
 .../groovy/plugin/SugarGremlinPlugin.java       |  7 +++++++
 .../CredentialGraphGremlinPlugin.java           | 14 ++++++++------
 6 files changed, 50 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/649442c4/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
index 1614461..8f1cafe 100644
--- 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
@@ -19,6 +19,8 @@
 package org.apache.tinkerpop.gremlin.groovy.plugin;
 
 /**
+ * A software artifact identified by its maven coordinates.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class Artifact {
@@ -26,6 +28,13 @@ public class Artifact {
     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");

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/649442c4/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
index daeedee..9e2b94e 100644
--- 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
@@ -22,9 +22,10 @@ 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 ServiceLoader to install plugins.  It is necessary for
- * projects to include a org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin file in META-INF/services of their
- * packaged project which includes the full class names of the implementations of this interface to install.
+ * 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)
  */

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/649442c4/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
index 06453bb..292ba35 100644
--- 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
@@ -18,18 +18,24 @@
  */
 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)
  */
 public interface PluginAcceptor {
     /**
-     * If the {@code PluginAcceptor} implements the DependencyManager interface it will try to import the specified
-     * import statements.
+     * 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);
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/649442c4/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
index 5106641..4fee2b8 100644
--- 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
@@ -24,6 +24,14 @@ 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)
  */
 public interface RemoteAcceptor extends Closeable {
@@ -31,8 +39,8 @@ public interface RemoteAcceptor extends Closeable {
     public static final String RESULT = "result";
 
     /**
-     * Gets called when :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".
+     * 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
@@ -40,8 +48,8 @@ public interface RemoteAcceptor extends Closeable {
     public Object connect(final List<String> args) throws RemoteException;
 
     /**
-     * Gets called when :remote is used in conjunction with the "config" option.  It is up to the implementation
-     * to decide how additional arguments on the line should be treated after "config".
+     * 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
@@ -49,8 +57,8 @@ public interface RemoteAcceptor extends Closeable {
     public Object configure(final List<String> args) throws RemoteException;
 
     /**
-     * Gets called when :submit is executed.  It is up to the implementation to decide how additional arguments on
-     * the line should be treated after "submit".
+     * 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

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/649442c4/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 912670d..845ffc6 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
@@ -21,6 +21,8 @@ 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)
  */
 public class SugarGremlinPlugin extends AbstractGremlinPlugin {
@@ -30,6 +32,11 @@ public class SugarGremlinPlugin extends AbstractGremlinPlugin {
         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 {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/649442c4/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 9bf7880..8550615 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
@@ -27,6 +27,8 @@ 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 {
@@ -41,13 +43,13 @@ public class CredentialGraphGremlinPlugin extends AbstractGremlinPlugin {
         return "tinkerpop.credentials";
     }
 
-    @Override
-    public void pluginTo(final PluginAcceptor pluginAcceptor) throws PluginInitializationException, IllegalEnvironmentException {
-        pluginAcceptor.addImports(IMPORTS);
-    }
-
+    /**
+     * {@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