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/04/22 17:31:37 UTC
incubator-tinkerpop git commit: Add helpers for the core Io.Builder
implementations.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 457e26ca4 -> aa0a8ea76
Add helpers for the core Io.Builder implementations.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/aa0a8ea7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/aa0a8ea7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/aa0a8ea7
Branch: refs/heads/master
Commit: aa0a8ea76f071db9310ca917ddc04509c3e44aa0
Parents: 457e26c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 22 11:31:01 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 22 11:31:01 2015 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/structure/io/IoCore.java | 43 ++++++++++++++++++++
.../AbstractImportCustomizerProvider.java | 22 +++++-----
.../tinkerpop/gremlin/structure/IoTest.java | 9 ++--
3 files changed, 60 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/aa0a8ea7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java
new file mode 100644
index 0000000..e3a7680
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCore.java
@@ -0,0 +1,43 @@
+/*
+ * 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.structure.io;
+
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
+
+/**
+ * Constructs the core {@link Io.Builder} implementations enabling a bit of shorthand syntax by importing these
+ * methods statically.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IoCore {
+ public static Io.Builder<GraphMLIo> graphml() {
+ return GraphMLIo.build();
+ }
+
+ public static Io.Builder<GraphSONIo> graphson() {
+ return GraphSONIo.build();
+ }
+
+ public static Io.Builder<GryoIo> gryo() {
+ return GryoIo.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/aa0a8ea7/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
index deb1dae..19f5537 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
@@ -47,6 +47,7 @@ import org.apache.tinkerpop.gremlin.structure.Operator;
import org.apache.tinkerpop.gremlin.structure.Order;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.IoCore;
import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
@@ -82,6 +83,9 @@ public abstract class AbstractImportCustomizerProvider implements ImportCustomiz
imports.add(GraphFactory.class.getPackage().getName() + DOT_STAR);
imports.add(BatchGraph.class.getPackage().getName() + DOT_STAR);
imports.add(DetachedElement.class.getPackage().getName() + DOT_STAR);
+ staticImports.add(T.class.getCanonicalName() + DOT_STAR);
+ staticImports.add(Direction.class.getCanonicalName() + DOT_STAR);
+ staticImports.add(VertexProperty.Cardinality.class.getCanonicalName() + DOT_STAR);
// graph process
imports.add(Traversal.class.getPackage().getName() + DOT_STAR);
@@ -94,7 +98,11 @@ public abstract class AbstractImportCustomizerProvider implements ImportCustomiz
staticImports.add(__.class.getCanonicalName() + DOT_STAR);
staticImports.add(TraversalOptionParent.Pick.class.getCanonicalName() + DOT_STAR);
staticImports.add(GraphTraversalSource.class.getCanonicalName() + DOT_STAR);
-
+ staticImports.add(Compare.class.getCanonicalName() + DOT_STAR);
+ staticImports.add(Contains.class.getCanonicalName() + DOT_STAR);
+ staticImports.add(Order.class.getCanonicalName() + DOT_STAR);
+ staticImports.add(Operator.class.getCanonicalName() + DOT_STAR);
+ staticImports.add(Scope.class.getCanonicalName() + DOT_STAR);
// utils
imports.add(Gremlin.class.getPackage().getName() + DOT_STAR);
@@ -102,12 +110,14 @@ public abstract class AbstractImportCustomizerProvider implements ImportCustomiz
imports.add(FunctionUtils.class.getPackage().getName() + DOT_STAR);
imports.add(GFunction.class.getPackage().getName() + DOT_STAR);
imports.add(TraversalMetrics.class.getPackage().getName() + DOT_STAR);
+ staticImports.add(TimeUtil.class.getCanonicalName() + DOT_STAR);
// IO packages
imports.add(GraphReader.class.getPackage().getName() + DOT_STAR);
imports.add(GraphMLReader.class.getPackage().getName() + DOT_STAR);
imports.add(GraphSONReader.class.getPackage().getName() + DOT_STAR);
imports.add(GryoReader.class.getPackage().getName() + DOT_STAR);
+ staticImports.add(IoCore.class.getCanonicalName() + DOT_STAR);
// algorithms
imports.add(PeerPressureVertexProgram.class.getPackage().getName() + DOT_STAR);
@@ -120,16 +130,6 @@ public abstract class AbstractImportCustomizerProvider implements ImportCustomiz
// external
imports.add(Configuration.class.getPackage().getName() + DOT_STAR);
-
- staticImports.add(T.class.getCanonicalName() + DOT_STAR);
- staticImports.add(Direction.class.getCanonicalName() + DOT_STAR);
- staticImports.add(Compare.class.getCanonicalName() + DOT_STAR);
- staticImports.add(Contains.class.getCanonicalName() + DOT_STAR);
- staticImports.add(Order.class.getCanonicalName() + DOT_STAR);
- staticImports.add(Operator.class.getCanonicalName() + DOT_STAR);
- staticImports.add(Scope.class.getCanonicalName() + DOT_STAR);
- staticImports.add(TimeUtil.class.getCanonicalName() + DOT_STAR);
- staticImports.add(VertexProperty.Cardinality.class.getCanonicalName() + DOT_STAR);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/aa0a8ea7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index f118d15..99df876 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -90,6 +90,9 @@ import static org.apache.tinkerpop.gremlin.structure.Graph.Features.ElementFeatu
import static org.apache.tinkerpop.gremlin.structure.Graph.Features.VariableFeatures.FEATURE_VARIABLES;
import static org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS;
import static org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexPropertyFeatures.*;
+import static org.apache.tinkerpop.gremlin.structure.io.IoCore.graphml;
+import static org.apache.tinkerpop.gremlin.structure.io.IoCore.graphson;
+import static org.apache.tinkerpop.gremlin.structure.io.IoCore.gryo;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
@@ -122,9 +125,9 @@ public class IoTest extends AbstractGremlinTest {
@Before
public void setupBeforeEachTest() {
- graphml = GraphMLIo.build();
- graphson = GraphSONIo.build();
- gryo = GryoIo.build();
+ graphml = graphml();
+ graphson = graphson();
+ gryo = gryo();
}
@Test