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/04/17 15:32:23 UTC
[3/8] tinkerpop git commit: Cleanup some javadoc in GraphManger
related classes CTR
Cleanup some javadoc in GraphManger related classes CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b5373050
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b5373050
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b5373050
Branch: refs/heads/master
Commit: b537305082c593f498e87216df47f9bff46c3460
Parents: 91a9201
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Apr 17 10:25:27 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Apr 17 10:25:27 2017 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/server/GraphManager.java | 64 +++++++++-----------
.../server/util/DefaultGraphManager.java | 23 ++++---
2 files changed, 41 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b5373050/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java
index 23c019b..8e3198f 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java
@@ -20,7 +20,6 @@ package org.apache.tinkerpop.gremlin.server;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Transaction;
import javax.script.Bindings;
import java.util.Map;
@@ -29,7 +28,7 @@ import java.util.function.Function;
/**
* The {@link GraphManager} interface allows for reference tracking of Graph references through
- * a {@link Map<String, Graph>}; the interface plugs into the lifeline of gremlin script
+ * a {@code Map<String, Graph>}; the interface plugs into the lifeline of gremlin script
* executions, meaning that commit() and rollback() will be called on all graphs stored in the
* graph reference tracker at the end of the script executions; you may want to implement
* this interface if you want to define a custom graph instantiation/closing mechanism; note that
@@ -37,12 +36,12 @@ import java.util.function.Function;
*/
public interface GraphManager {
/**
- * @Deprecated This returns a {@link Map} that should be immutable. Please refer to
- * getGraphNames() for replacement.
+ * Get a list of the {@link Graph} instances and their binding names.
*
- * Get a list of the {@link Graph} instances and their binding names
- *
- * @return a {@link Map} where the key is the name of the {@link Graph} and the value is the {@link Graph} itself
+ * @return a {@code Map} where the key is the name of the {@link Graph} and the value is the {@link Graph} itself
+ * @deprecated As of release 3.2.5, replaced by a combination of {@link #getGraphNames()} and
+ * {@link #getGraph(String)} - note that the expectation is this method return an immutable {@code Map} which was
+ * not the expectation prior to 3.2.5.
*/
@Deprecated
public Map<String, Graph> getGraphs();
@@ -52,58 +51,56 @@ public interface GraphManager {
* reference tracker.
*/
public Set<String> getGraphNames();
+
/**
- * Get {@link Graph} instance whose name matches {@link gName}
+ * Get {@link Graph} instance whose name matches {@code graphName}.
*
* @return {@link Graph} if exists, else null
*/
- public Graph getGraph(final String gName);
+ public Graph getGraph(final String graphName);
/**
- * Add or update {@link Graph} g with name {@link String} gName to
- * {@link Map<String, Graph>}
+ * Add or update the specified {@link Graph} with the specified name to {@code Map<String, Graph>} .
*/
- public void putGraph(final String gName, final Graph g);
+ public void putGraph(final String graphName, final Graph g);
/**
- * @Deprecated Please treat as immutable {@link Map} and refer to getTraversalSourceNames()
- *
* Get a list of the {@link TraversalSource} instances and their binding names
*
* @return a {@link Map} where the key is the name of the {@link TraversalSource} and the value is the
* {@link TraversalSource} itself
+ * @deprecated As of release 3.2.5, replaced by a combination of {@link #getTraversalSource(String)} ()} and
+ * {@link #getTraversalSource(String)} (String)} - note that the expectation is this method return an immutable
+ * {@code Map} which was not the expectation prior to 3.2.5.
*/
@Deprecated
public Map<String, TraversalSource> getTraversalSources();
/**
- * Get {@link TraversalSource} instance whose name matches {@link tsName}
- *
- * @return {@link TraversalSource} if exists, else null
- */
-
- /**
- * Get a {@link Set} of {@link String} traversalSourceNames to names stored in the
- * traversalSources's reference tracker.
+ * Get a {@code Set} of the names of the the stored {@link TraversalSource} instances.
*/
public Set<String> getTraversalSourceNames();
- public TraversalSource getTraversalSource(final String tsName);
/**
- * Get the {@link Graph} and {@link TraversalSource} list as a set of bindings.
+ * Get {@link TraversalSource} instance whose name matches {@code traversalSourceName}
+ *
+ * @return {@link TraversalSource} if exists, else null
*/
+ public TraversalSource getTraversalSource(final String traversalSourceName);
/**
- * Add or update {@link TraversalSource} ts with name {@link String} tsName to
- * {@link Map<String, TraversalSource>} returned by call to getTraversalSources()
+ * Add or update the specified {@link TraversalSource} with the specified name.
*/
public void putTraversalSource(final String tsName, final TraversalSource ts);
/**
- * Remove {@link TraversalSource} with tsName from {@link Map<String, TraversalSource}.
+ * Remove {@link TraversalSource} by name.
*/
public TraversalSource removeTraversalSource(final String tsName);
+ /**
+ * Get the {@link Graph} and {@link TraversalSource} list as a set of bindings.
+ */
public Bindings getAsBindings();
/**
@@ -127,17 +124,16 @@ public interface GraphManager {
public void commit(final Set<String> graphSourceNamesToCloseTxOn);
/**
- * Implementation that allows for custom graph-opening implementations; if the {@link Map}
- * tracking graph references has a {@link Graph} object corresponding to the {@link String} graphName,
- * then we return that {@link Graph}-- otherwise, we use the custom {@link Supplier} to instantiate a
- * a new {@link Graph}, add it to the {@link Map} tracking graph references, and return said {@link Graph}.
+ * Implementation that allows for custom graph-opening implementations; if the {@code Map}
+ * tracking graph references has a {@link Graph} object corresponding to the graph name, then we return that
+ * {@link Graph}-- otherwise, we use the custom {@code Function} to instantiate a new {@link Graph}, add it to
+ * the {@link Map} tracking graph references, and return said {@link Graph}.
*/
public Graph openGraph(final String graphName, final Function<String, Graph> supplier);
/**
- * Implementation that allows for custom graph-closing implementations;
- * this method should remove the {@link Graph} graph from the {@link Object}
- * tracking {@link Graph} references.
+ * Implementation that allows for custom graph closing implementations; this method should remove the {@link Graph}
+ * from the {@code GraphManager}.
*/
public Graph removeGraph(final String graphName) throws Exception;
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b5373050/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/DefaultGraphManager.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/DefaultGraphManager.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/DefaultGraphManager.java
index 54f424c..71c4b98 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/DefaultGraphManager.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/DefaultGraphManager.java
@@ -25,7 +25,6 @@ import org.apache.tinkerpop.gremlin.server.Settings;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Transaction;
import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,7 +34,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Predicate;
import java.util.function.Function;
/**
@@ -68,13 +66,12 @@ public final class DefaultGraphManager implements GraphManager {
}
/**
- * @Deprecated The {@link Map} returned should be immutable. Please refer to
- * getGraphNames().
- *
* Get a list of the {@link Graph} instances and their binding names as defined in the Gremlin Server
* configuration file.
*
* @return a {@link Map} where the key is the name of the {@link Graph} and the value is the {@link Graph} itself
+ * @deprecated As of release 3.2.5, replaced by a combination of {@link #getGraphNames()} and
+ * {@link #getGraph(String)}
*/
@Deprecated
public final Map<String, Graph> getGraphs() {
@@ -85,12 +82,12 @@ public final class DefaultGraphManager implements GraphManager {
return graphs.keySet();
}
- public final Graph getGraph(final String gName) {
- return graphs.get(gName);
+ public final Graph getGraph(final String graphName) {
+ return graphs.get(graphName);
}
- public final void putGraph(final String gName, final Graph g) {
- graphs.put(gName, g);
+ public final void putGraph(final String graphName, final Graph g) {
+ graphs.put(graphName, g);
}
/**
@@ -100,7 +97,9 @@ public final class DefaultGraphManager implements GraphManager {
* initialization scripts.
*
* @return a {@link Map} where the key is the name of the {@link TraversalSource} and the value is the
- * {@link TraversalSource} itself
+ * {@link TraversalSource} itself
+ * @deprecated As of release 3.2.5, replaced by a combination of {@link #getTraversalSource(String)} ()} and
+ * {@link #getTraversalSource(String)} (String)}
*/
@Deprecated
public final Map<String, TraversalSource> getTraversalSources() {
@@ -111,8 +110,8 @@ public final class DefaultGraphManager implements GraphManager {
return traversalSources.keySet();
}
- public final TraversalSource getTraversalSource(final String tsName) {
- return traversalSources.get(tsName);
+ public final TraversalSource getTraversalSource(final String traversalSourceName) {
+ return traversalSources.get(traversalSourceName);
}
public final void putTraversalSource(final String tsName, final TraversalSource ts) {