org.apache.tinkerpop.gremlin.server.op

## Class AbstractOpProcessor

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

- All Implemented Interfaces:
    AutoCloseable, OpProcessor
  Direct Known Subclasses:
    AbstractEvalOpProcessor, TraversalOpProcessor

      public abstract class AbstractOpProcessor
      extends Object
      implements OpProcessor

  A base `OpProcessor` implementation that processes an `Iterator` of results in a generalized way while ensuring that graph transactions are properly managed.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `manageTransactions` When set to `true`, transactions are always managed otherwise they can be overridden by the request.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractOpProcessor(boolean manageTransactions)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static void` | `attemptCommit(RequestMessage msg, GraphManager graphManager, boolean strict)`
    `protected static void` | `attemptRollback(RequestMessage msg, GraphManager graphManager, boolean strict)`
    `protected Map<String,Object>` | `generateMetaData(ChannelHandlerContext ctx, RequestMessage msg, ResponseStatusCode code, Iterator itty)` Deprecated. As of release 3.4.0, replaced by `generateResultMetaData(ChannelHandlerContext, RequestMessage, ResponseStatusCode, Iterator, Settings)`
    `protected Map<String,Object>` | `generateResultMetaData(ChannelHandlerContext ctx, RequestMessage msg, ResponseStatusCode code, Iterator itty, Settings settings)` Generates response result meta-data to put on a `ResponseMessage`.
    `protected Map<String,Object>` | `generateStatusAttributes(ChannelHandlerContext ctx, RequestMessage msg, ResponseStatusCode code, Iterator itty, Settings settings)` Generates response status meta-data to put on a `ResponseMessage`.
    `protected void` | `handleIterator(Context context, Iterator itty)` Provides a generic way of iterating a result set back to the client.
    `protected void` | `handleIterator(ResponseHandlerContext rhc, Iterator itty)` Deprecated. As of release 3.3.8, not replaced.
    `protected boolean` | `isForceFlushed(ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)` Determines if a `Frame` should be force flushed outside of the `resultIterationBatchSize` and the termination of the iterator.
    `protected void` | `iterateComplete(ChannelHandlerContext ctx, RequestMessage msg, Iterator itty)` Called when iteration within `handleIterator(Context, Iterator)` is on its final pass and the final frame is about to be sent back to the client.
    `protected static Frame` | `makeFrame(ChannelHandlerContext ctx, RequestMessage msg, MessageSerializer serializer, boolean useBinary, List<Object> aggregate, ResponseStatusCode code, Map<String,Object> responseMetaData, Map<String,Object> statusAttributes)` Deprecated. As of release 3.3.8, replaced by `makeFrame(Context, RequestMessage, MessageSerializer, boolean, List, ResponseStatusCode, Map)`.
    `protected static Frame` | `makeFrame(Context ctx, RequestMessage msg, MessageSerializer serializer, boolean useBinary, List<Object> aggregate, ResponseStatusCode code, Map<String,Object> responseMetaData)` Deprecated. As of release 3.4.3, replaced by `makeFrame(Context, RequestMessage, MessageSerializer, boolean, List, ResponseStatusCode, Map)`.
    `protected static Frame` | `makeFrame(ResponseHandlerContext rhc, RequestMessage msg, MessageSerializer serializer, boolean useBinary, List<Object> aggregate, ResponseStatusCode code, Map<String,Object> responseMetaData)` Deprecated. As of release 3.3.8, replaced by `makeFrame(Context, RequestMessage, MessageSerializer, boolean, List, ResponseStatusCode, Map)`.

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

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

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.server.OpProcessor

      `getName, init, select`

    - ### Methods inherited from interface java.lang.AutoCloseable

      `close`

- - ### Field Detail

    - #### manageTransactions

          protected final boolean manageTransactions

      When set to `true`, transactions are always managed otherwise they can be overridden by the request.

  - ### Constructor Detail

    - #### AbstractOpProcessor

          protected AbstractOpProcessor(boolean manageTransactions)

  - ### Method Detail

    - #### handleIterator

          @Deprecated
          protected void handleIterator(ResponseHandlerContext rhc,
                                                    Iterator itty)
                                             throws InterruptedException

      Deprecated. As of release 3.3.8, not replaced.
      Throws:
        `InterruptedException`

    - #### handleIterator

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

      Provides a generic way of iterating a result set back to the client.
      Parameters:
        `context` - The Gremlin Server `Context` object containing settings, request message, etc.
        `itty` - The result to iterator
      Throws:
        `InterruptedException`

    - #### iterateComplete

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

      Called when iteration within `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.

    - #### isForceFlushed

          protected boolean isForceFlushed(ChannelHandlerContext ctx,
                                           RequestMessage msg,
                                           Iterator itty)

      Determines if a `Frame` should be force flushed outside of the `resultIterationBatchSize` and the termination of the iterator. By default this method return `false`.
      Parameters:
        `itty` - a reference to the current `Iterator` of results - it is not meant to be forwarded in this method

    - #### generateMetaData

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

      Deprecated. As of release 3.4.0, replaced by `generateResultMetaData(ChannelHandlerContext, RequestMessage, ResponseStatusCode, Iterator, Settings)`
      Generates response result meta-data to put on a `ResponseMessage`.
      Parameters:
        `itty` - a reference to the current `Iterator` of results - it is not meant to be forwarded in this method

    - #### generateResultMetaData

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

      Generates response result meta-data to put on a `ResponseMessage`.
      Parameters:
        `itty` - a reference to the current `Iterator` of results - it is not meant to be forwarded in this method

    - #### generateStatusAttributes

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

      Generates response status meta-data to put on a `ResponseMessage`.
      Parameters:
        `itty` - a reference to the current `Iterator` of results - it is not meant to be forwarded in this method

    - #### makeFrame

          @Deprecated
          protected static Frame makeFrame(ChannelHandlerContext ctx,
                                                       RequestMessage msg,
                                                       MessageSerializer serializer,
                                                       boolean useBinary,
                                                       List<Object> aggregate,
                                                       ResponseStatusCode code,
                                                       Map<String,Object> responseMetaData,
                                                       Map<String,Object> statusAttributes)
                                                throws Exception

      Deprecated. As of release 3.3.8, replaced by `makeFrame(Context, RequestMessage, MessageSerializer, boolean, List, ResponseStatusCode, Map)`.
      Throws:
        `Exception`

    - #### makeFrame

          @Deprecated
          protected static Frame makeFrame(ResponseHandlerContext rhc,
                                                       RequestMessage msg,
                                                       MessageSerializer serializer,
                                                       boolean useBinary,
                                                       List<Object> aggregate,
                                                       ResponseStatusCode code,
                                                       Map<String,Object> responseMetaData)
                                                throws Exception

      Deprecated. As of release 3.3.8, replaced by `makeFrame(Context, RequestMessage, MessageSerializer, boolean, List, ResponseStatusCode, Map)`.
      Throws:
        `Exception`

    - #### makeFrame

          @Deprecated
          protected static Frame makeFrame(Context ctx,
                                                       RequestMessage msg,
                                                       MessageSerializer serializer,
                                                       boolean useBinary,
                                                       List<Object> aggregate,
                                                       ResponseStatusCode code,
                                                       Map<String,Object> responseMetaData)
                                                throws Exception

      Deprecated. As of release 3.4.3, replaced by `makeFrame(Context, RequestMessage, MessageSerializer, boolean, List, ResponseStatusCode, Map)`.
      Throws:
        `Exception`

    - #### attemptCommit

          protected static void attemptCommit(RequestMessage msg,
                                              GraphManager graphManager,
                                              boolean strict)

    - #### attemptRollback

          protected static void attemptRollback(RequestMessage msg,
                                                GraphManager graphManager,
                                                boolean strict)

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