spmallette commented on a change in pull request #1574: URL: https://github.com/apache/tinkerpop/pull/1574#discussion_r821067800
########## File path: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CallStep.java ########## @@ -0,0 +1,338 @@ +/* + * 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.process.traversal.step.map; + +import org.apache.tinkerpop.gremlin.process.traversal.Step; +import org.apache.tinkerpop.gremlin.process.traversal.Traversal; +import org.apache.tinkerpop.gremlin.process.traversal.Traverser; +import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring; +import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent; +import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep; +import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters; +import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement; +import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.DummyTraverser; +import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet; +import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; +import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.service.Service; +import org.apache.tinkerpop.gremlin.structure.service.ServiceRegistry; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; +import org.apache.tinkerpop.gremlin.structure.util.StringFactory; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static org.apache.tinkerpop.gremlin.structure.util.CloseableIterator.EmptyCloseableIterator; +import static org.apache.tinkerpop.gremlin.structure.service.Service.ServiceCallContext; + +/** + * Reference implementation for service calls via the {@link ServiceRegistry} and {@link Service} APIs. This step + * can be used to start a traversal or it can be used mid-traversal with one at a time or barrier execution. + * + * @author Mike Personick (http://github.com/mikepersonick) + */ +public final class CallStep<S, E> extends AbstractStep<S, E> implements TraversalParent, AutoCloseable, Configuring { + + private final boolean isStart; + private boolean first = true; + + private ServiceCallContext ctx; + private String serviceName; + private Service<S, E> service; + private Map params; + private Traversal.Admin<S,Map> mapTraversal; + private Parameters parameters; + + private transient Traverser.Admin<S> head = null; + private transient CloseableIterator iterator = EmptyCloseableIterator.instance(); + + public CallStep(final Traversal.Admin traversal, final boolean isStart) { + this(traversal, isStart, null); + } + + public CallStep(final Traversal.Admin traversal, final boolean isStart, final String service) { + this(traversal, isStart, service, null); + } + + public CallStep(final Traversal.Admin traversal, final boolean isStart, final String service, final Map params) { + this(traversal, isStart, service, params, null); + } + + public CallStep(final Traversal.Admin traversal, final boolean isStart, final String service, final Map params, + final Traversal.Admin<S, Map> mapTraversal) { + super(traversal); + + this.isStart = isStart; + this.serviceName = service; + this.params = params == null ? new LinkedHashMap() : params; Review comment: minor thing i suppose, but while digging through this class, i sorta kept confusing `params` with our typical usage of `parameters` - maybe we could rename `params` to something else that's more descriptive in relation to `call()`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
