Class AbstractEvalOpProcessor
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor
- 
- org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor
 
 
- 
- All Implemented Interfaces:
- AutoCloseable,- OpProcessor
 - Direct Known Subclasses:
- SessionOpProcessor,- StandardOpProcessor
 
 public abstract class AbstractEvalOpProcessor extends AbstractOpProcessor A baseOpProcessorimplementation that helps with operations that deal with script evaluation functions.- Author:
- Stephen Mallette (http://stephen.genoprime.com)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceAbstractEvalOpProcessor.BindingSupplier
 - 
Field SummaryFields Modifier and Type Field Description static StringCONFIG_MAX_PARAMETERSThe maximum number of parameters that can be passed on a script evaluation request.static intDEFAULT_MAX_PARAMETERSDefault number of parameters allowed on a script evaluation request.static com.codahale.metrics.TimerevalOpTimerprotected static Set<String>INVALID_BINDINGS_KEYSThis may or may not be the full set of invalid binding keys.protected intmaxParameters- 
Fields inherited from class org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessormanageTransactions
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractEvalOpProcessor(boolean manageTransactions)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidevalOpInternal(Context ctx, Supplier<GremlinExecutor> gremlinExecutorSupplier, AbstractEvalOpProcessor.BindingSupplier bindingsSupplier)A generalized implementation of the "eval" operation.abstract ThrowingConsumer<Context>getEvalOp()Provides an operation for evaluating a Gremlin script.ThrowingConsumer<Context>select(Context ctx)Given the context (which contains the RequestMessage), return back a Consumer function that will be executed with the context.abstract Optional<ThrowingConsumer<Context>>selectOther(Context ctx)A sub-class may have additional "ops" that it will service.protected Optional<ThrowingConsumer<Context>>validateEvalMessage(RequestMessage message)- 
Methods inherited from class org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessorattemptCommit, attemptRollback, determineIfSpecialException, generateResultMetaData, generateStatusAttributes, handleIterator, isForceFlushed, iterateComplete, makeFrame
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface java.lang.AutoCloseableclose
 - 
Methods inherited from interface org.apache.tinkerpop.gremlin.server.OpProcessorgetName, init
 
- 
 
- 
- 
- 
Field Detail- 
evalOpTimerpublic static final com.codahale.metrics.Timer evalOpTimer 
 - 
CONFIG_MAX_PARAMETERSpublic static final String CONFIG_MAX_PARAMETERS The maximum number of parameters that can be passed on a script evaluation request.- See Also:
- Constant Field Values
 
 - 
DEFAULT_MAX_PARAMETERSpublic static final int DEFAULT_MAX_PARAMETERS Default number of parameters allowed on a script evaluation request.- See Also:
- Constant Field Values
 
 - 
maxParametersprotected int maxParameters 
 - 
INVALID_BINDINGS_KEYSprotected static final Set<String> INVALID_BINDINGS_KEYS This may or may not be the full set of invalid binding keys. It is dependent on the static imports made to Gremlin Server. This should get rid of the worst offenders though and provide a good message back to the calling client. Use oftoUpperCase()on the accessor values ofTsolves an issue where theScriptEngineignores private scope onTand imports static fields.
 
- 
 - 
Method Detail- 
getEvalOppublic abstract ThrowingConsumer<Context> getEvalOp() Provides an operation for evaluating a Gremlin script.- Returns:
 
 - 
selectOtherpublic abstract Optional<ThrowingConsumer<Context>> selectOther(Context ctx) throws OpProcessorException A sub-class may have additional "ops" that it will service. Calls toOpProcessor.select(Context)that are not handled will be passed to this method to see if the sub-class can service the requested op code.- Returns:
- Throws:
- OpProcessorException
 
 - 
selectpublic ThrowingConsumer<Context> select(Context ctx) throws OpProcessorException Description copied from interface:OpProcessorGiven the context (which contains the RequestMessage), return back a Consumer function that will be executed with the context. A typical implementation will simply check the "op" field on the RequestMessage and return the Consumer function for that particular operation.- Returns:
- Throws:
- OpProcessorException
 
 - 
validateEvalMessageprotected Optional<ThrowingConsumer<Context>> validateEvalMessage(RequestMessage message) throws OpProcessorException - Throws:
- OpProcessorException
 
 - 
evalOpInternalprotected void evalOpInternal(Context ctx, Supplier<GremlinExecutor> gremlinExecutorSupplier, AbstractEvalOpProcessor.BindingSupplier bindingsSupplier) A generalized implementation of the "eval" operation. It handles script evaluation and iteration of results so as to writeResponseMessageobjects down the Netty pipeline. It also handles script timeouts, iteration timeouts, metrics and building bindings. Note that result iteration is delegated to theAbstractOpProcessor.handleIterator(Context, Iterator)method, so those extending this class could override that method for better control over result iteration.- Parameters:
- ctx- The current Gremlin Server- Context. This handler ensures that only a single final response is sent to the client.
- gremlinExecutorSupplier- A function that returns the- GremlinExecutorto use in executing the script evaluation.
- bindingsSupplier- A function that returns the- Bindingsto provide to the- GremlinExecutor.eval(java.lang.String)method.
 
 
- 
 
-