org.apache.tinkerpop.gremlin.server.op.traversal

## Class TraversalOpProcessor

- java.lang.Object
- - org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor
  - - org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor

- All Implemented Interfaces:
    AutoCloseable, OpProcessor

      public class TraversalOpProcessor
      extends AbstractOpProcessor

  Simple `OpProcessor` implementation that iterates remotely submitted serialized `Traversal` objects.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static <any>` | `cache`
    `static String` | `CONFIG_CACHE_EXPIRATION_TIME` Configuration setting for how long a cached side-effect will be available before it is evicted from the cache.
    `static String` | `CONFIG_CACHE_MAX_SIZE` Configuration setting for the maximum number of entries the cache will have.
    `static long` | `DEFAULT_CACHE_EXPIRATION_TIME` Default timeout for a cached side-effect is ten minutes.
    `static long` | `DEFAULT_CACHE_MAX_SIZE` Default size of the max size of the cache.
    `static Settings.ProcessorSettings` | `DEFAULT_SETTINGS`
    `static String` | `OP_PROCESSOR_NAME`
    `static Timer` | `traversalOpTimer`

    - ### Fields inherited from class org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor

      `manageTransactions`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TraversalOpProcessor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `beforeProcessing(Graph graph, Context ctx)`
    `void` | `close()`
    `protected Map<String,Object>` | `generateMetaData(ChannelHandlerContext ctx, RequestMessage msg, ResponseStatusCode code, Iterator itty)` Generates meta-data to put on a `ResponseMessage`.
    `String` | `getName()` The name of the processor which requests must refer to "processor" field on a request.
    `protected void` | `handleIterator(Context context, Iterator itty, Graph graph)`
    `void` | `init(Settings settings)` Initialize the `OpProcessor` with settings from the server.
    `protected void` | `iterateComplete(ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)` Called when iteration within `AbstractOpProcessor.handleIterator(Context, Iterator)` is on its final pass and the final frame is about to be sent back to the client.
    `protected void` | `onError(Graph graph, Context ctx)`
    `protected void` | `onSideEffectSuccess(Graph graph, Context ctx)`
    `protected void` | `onTraversalSuccess(Graph graph, Context ctx)`
    `ThrowingConsumer<Context>` | `select(Context ctx)` Given the context (which contains the RequestMessage), return back a Consumer function that will be executed with the context.

    - ### Methods inherited from class org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor

      `attemptCommit, attemptRollback, handleIterator, isForceFlushed, makeFrame, makeFrame`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### OP_PROCESSOR_NAME

          public static final String OP_PROCESSOR_NAME

      See Also:
        Constant Field Values

    - #### traversalOpTimer

          public static final Timer traversalOpTimer

    - #### DEFAULT_SETTINGS

          public static final Settings.ProcessorSettings DEFAULT_SETTINGS

    - #### CONFIG_CACHE_EXPIRATION_TIME

          public static final String CONFIG_CACHE_EXPIRATION_TIME

      Configuration setting for how long a cached side-effect will be available before it is evicted from the cache.
      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_EXPIRATION_TIME

          public static final long DEFAULT_CACHE_EXPIRATION_TIME

      Default timeout for a cached side-effect is ten minutes.
      See Also:
        Constant Field Values

    - #### CONFIG_CACHE_MAX_SIZE

          public static final String CONFIG_CACHE_MAX_SIZE

      Configuration setting for the maximum number of entries the cache will have.
      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_MAX_SIZE

          public static final long DEFAULT_CACHE_MAX_SIZE

      Default size of the max size of the cache.
      See Also:
        Constant Field Values

    - #### cache

          protected static <any> cache

  - ### Constructor Detail

    - #### TraversalOpProcessor

          public TraversalOpProcessor()

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `OpProcessor`
      The name of the processor which requests must refer to "processor" field on a request.

    - #### close

          public void close()
                     throws Exception

      Throws:
        `Exception`

    - #### init

          public void init(Settings settings)

      Description copied from interface: `OpProcessor`
      Initialize the `OpProcessor` with settings from the server. This method should only be called once at server startup by a single thread.

    - #### select

          public ThrowingConsumer<Context> select(Context ctx)
                                           throws OpProcessorException

      Description copied from interface: `OpProcessor`
      Given 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.
      Throws:
        `OpProcessorException`

    - #### iterateComplete

          protected void iterateComplete(ChannelHandlerContext ctx,
                                         RequestMessage msg,
                                         Iterator itty)

      Description copied from class: `AbstractOpProcessor`
      Called when iteration within `AbstractOpProcessor.handleIterator(Context, Iterator)` is on its final pass and the final frame is about to be sent back to the client. This method only gets called on successful iteration of the entire result.
      Overrides:
        `iterateComplete` in class `AbstractOpProcessor`

    - #### beforeProcessing

          protected void beforeProcessing(Graph graph,
                                          Context ctx)

    - #### onError

          protected void onError(Graph graph,
                                 Context ctx)

    - #### onTraversalSuccess

          protected void onTraversalSuccess(Graph graph,
                                            Context ctx)

    - #### onSideEffectSuccess

          protected void onSideEffectSuccess(Graph graph,
                                             Context ctx)

    - #### generateMetaData

          protected Map<String,Object> generateMetaData(ChannelHandlerContext ctx,
                                                        RequestMessage msg,
                                                        ResponseStatusCode code,
                                                        Iterator itty)

      Description copied from class: `AbstractOpProcessor`
      Generates meta-data to put on a `ResponseMessage`.
      Overrides:
        `generateMetaData` in class `AbstractOpProcessor`
        `itty` - a reference to the current `Iterator` of results - it is not meant to be forwarded in this method

    - #### handleIterator

          protected void handleIterator(Context context,
                                        Iterator itty,
                                        Graph graph)
                                 throws InterruptedException

      Throws:
        `InterruptedException`

Copyright © 2013–2018 Apache Software Foundation. All rights reserved.