org.modeshape.jcr.spi.index.provider

## Interface Index.Operation

- All Superinterfaces:
    AutoCloseable
  Enclosing interface:
    Index

      public static interface Index.Operation
      extends AutoCloseable

  A potentially executable stateful operation that returns the set of nodes that satisfies the constraints supplied when the operation is `created`.

  `Index` implementations should create their own implementations of this interface, and ModeShape will then periodically call `getNextBatch(ResultWriter, int)` as (additional) results are needed to answer the query. Generally, each `Index.Operation` instance will have enough state to execute the filtering steps.

  ModeShape may call this method zero or more times, based upon whether results are actually needed and in specific batch sizes. And every time this method is called, implementations should read the next batch of nodes that satisfies the criteria, where the number of nodes in the batch should be roughly equal to `batchSize`. If the index implementation is interacting with a remote system, then each method invocation may correspond to a single remote request.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close any and all resources for the operation.
    `boolean` | `getNextBatch(ResultWriter writer, int batchSize)` Obtain the next batch of results for the query.

- - ### Method Detail

    - #### getNextBatch

          boolean getNextBatch(ResultWriter writer,
                             int batchSize)

      Obtain the next batch of results for the query.
      Parameters:
        `writer` - the writer that this method should use to register results in the batch; never null
        `batchSize` - the ideal number of node keys that are to be included in this batch; always positive
      Returns:
        true if there are additional results after this batch is completed, or false if this batch contains the final results of the query

    - #### close

          void close()

      Close any and all resources for the operation. This will always be called by ModeShape when the operation is no longer needed, even if `getNextBatch(ResultWriter, int)` was never called.
      Specified by:
        `close` in interface `AutoCloseable`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.