org.modeshape.jcr.query

## Class BufferManager

- java.lang.Object
- - org.modeshape.jcr.query.BufferManager

- All Implemented Interfaces:
    AutoCloseable, MapDB.Serializers

      public class BufferManager
      extends Object
      implements MapDB.Serializers, AutoCloseable

  A manager of temporary buffers used in the query system.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `BufferManager.Buffer` A basic buffer interface.
    `protected class` | `BufferManager.CloseableBuffer`
    `protected class` | `BufferManager.CloseableDistinctBuffer<T>`
    `protected class` | `BufferManager.CloseableQueueBuffer<T>`
    `protected class` | `BufferManager.CloseableSortingBuffer<K,V>`
    `protected class` | `BufferManager.CloseableSortingBufferWithDuplicates<K extends Comparable<K>,V>`
    `protected static class` | `BufferManager.DbHolder`
    `static interface` | `BufferManager.DistinctBuffer<T>` A buffer used to determine distinct values.
    `static interface` | `BufferManager.DistinctBufferMaker<T>` An object use to create a new `BufferManager.DistinctBuffer`.
    `protected class` | `BufferManager.MakeDistinctBuffer<T>`
    `protected class` | `BufferManager.MakeOrderedBuffer<T>`
    `protected class` | `BufferManager.MakeSortingBuffer<K,V>`
    `protected class` | `BufferManager.MakeSortingWithDuplicatesBuffer<K extends Comparable<K>,V>`
    `static interface` | `BufferManager.Predicate<T>`
    `static interface` | `BufferManager.QueueBuffer<T>` A buffer that maintains the insertion order of a series of values.
    `static interface` | `BufferManager.QueueBufferMaker<T>` An object use to create a new `BufferManager.DistinctBuffer`.
    `static interface` | `BufferManager.SortingBuffer<SortType,RecordType>` A buffer used to sort values into ascending or descending order.
    `static interface` | `BufferManager.SortingBufferMaker<SortType,RecordType>` An object use to create a new `BufferManager.SortingBuffer`.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `BufferManager(ExecutionContext context)`
    `protected` | `BufferManager(ExecutionContext context, Supplier<org.mapdb.DB> offheapDbSupplier, Supplier<org.mapdb.DB> onheapDbSupplier)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.mapdb.BTreeKeySerializer<?>` | `bTreeKeySerializerFor(Class<?> type, Comparator<?> comparator, boolean pack)` Obtain a serializer for the given key type.
    `org.mapdb.BTreeKeySerializer<?>` | `bTreeKeySerializerFor(TypeSystem.TypeFactory<?> type, boolean pack)` Obtain a serializer for the given key type.
    `void` | `close()`
    `<T> BufferManager.DistinctBufferMaker<T>` | `createDistinctBuffer(org.mapdb.Serializer<T> distinctSerializer)` Obtain a maker object that can create a new `BufferManager.DistinctBuffer`.
    `<T> BufferManager.QueueBufferMaker<T>` | `createQueueBuffer(org.mapdb.Serializer<T> serializer)` Obtain a maker object that can create a new `BufferManager.QueueBuffer`.
    `<K,V> BufferManager.SortingBufferMaker<K,V>` | `createSortingBuffer(org.mapdb.BTreeKeySerializer<K> keySerializer, org.mapdb.Serializer<V> valueSerializer)` Obtain a maker object that can create a new `BufferManager.SortingBuffer` that will keep a single values for any given key.
    `<K extends Comparable<K>,V> BufferManager.SortingBufferMaker<K,V>` | `createSortingWithDuplicatesBuffer(org.mapdb.Serializer<K> keySerializer, Comparator<?> keyComparator, org.mapdb.Serializer<V> valueSerializer)` Obtain a maker object that can create a new `BufferManager.SortingBuffer` that can store multiple values for any given key.
    `protected org.mapdb.DB` | `db(boolean useHeap)`
    `protected void` | `delete(String name, boolean onHeap)`
    `org.mapdb.Serializer<?>` | `serializerFor(Class<?> type)` Obtain a serializer for the given value type.
    `org.mapdb.Serializer<?>` | `serializerFor(TypeSystem.TypeFactory<?> type)` Obtain a serializer for the given value type.

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

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

- - ### Constructor Detail

    - #### BufferManager

          public BufferManager(ExecutionContext context)

    - #### BufferManager

          protected BufferManager(ExecutionContext context,
                       Supplier<org.mapdb.DB> offheapDbSupplier,
                       Supplier<org.mapdb.DB> onheapDbSupplier)

  - ### Method Detail

    - #### close

          public void close()

      Specified by:
        `close` in interface `AutoCloseable`

    - #### createQueueBuffer

          public <T> BufferManager.QueueBufferMaker<T> createQueueBuffer(org.mapdb.Serializer<T> serializer)

      Obtain a maker object that can create a new `BufferManager.QueueBuffer`.
      Parameters:
        `serializer` - the serializer for the value
      Returns:
        the maker; never null

    - #### createDistinctBuffer

          public <T> BufferManager.DistinctBufferMaker<T> createDistinctBuffer(org.mapdb.Serializer<T> distinctSerializer)

      Obtain a maker object that can create a new `BufferManager.DistinctBuffer`.
      Parameters:
        `distinctSerializer` - the serializer for the distinct value
      Returns:
        the maker; never null

    - #### createSortingBuffer

          public <K,V> BufferManager.SortingBufferMaker<K,V> createSortingBuffer(org.mapdb.BTreeKeySerializer<K> keySerializer,
                                                                        org.mapdb.Serializer<V> valueSerializer)

      Obtain a maker object that can create a new `BufferManager.SortingBuffer` that will keep a single values for any given key.
      Parameters:
        `keySerializer` - the serializer for the keys
        `valueSerializer` - the serializer for the values
      Returns:
        the maker; never null

    - #### createSortingWithDuplicatesBuffer

          public <K extends Comparable<K>,V> BufferManager.SortingBufferMaker<K,V> createSortingWithDuplicatesBuffer(org.mapdb.Serializer<K> keySerializer,
                                                                                                            Comparator<?> keyComparator,
                                                                                                            org.mapdb.Serializer<V> valueSerializer)

      Obtain a maker object that can create a new `BufferManager.SortingBuffer` that can store multiple values for any given key.
      Parameters:
        `keySerializer` - the serializer for the keys
        `keyComparator` - the comparator for the keys, or null if natural ordering should be used
        `valueSerializer` - the serializer for the values
      Returns:
        the maker; never null

    - #### serializerFor

          public org.mapdb.Serializer<?> serializerFor(Class<?> type)

      Description copied from interface: `MapDB.Serializers`
      Obtain a serializer for the given value type.
      Specified by:
        `serializerFor` in interface `MapDB.Serializers`
      Parameters:
        `type` - the type; may not be null
      Returns:
        the serializer

    - #### bTreeKeySerializerFor

          public org.mapdb.BTreeKeySerializer<?> bTreeKeySerializerFor(Class<?> type,
                                                              Comparator<?> comparator,
                                                              boolean pack)

      Description copied from interface: `MapDB.Serializers`
      Obtain a serializer for the given key type.
      Specified by:
        `bTreeKeySerializerFor` in interface `MapDB.Serializers`
      Parameters:
        `type` - the type; may not be null
        `comparator` - the comparator; may not be null
        `pack` - true if the serializer can/should pack keys together when possible, or false otherwise
      Returns:
        the serializer

    - #### serializerFor

          public org.mapdb.Serializer<?> serializerFor(TypeSystem.TypeFactory<?> type)

      Obtain a serializer for the given value type.
      Parameters:
        `type` - the type; may not be null
      Returns:
        the serializer

    - #### bTreeKeySerializerFor

          public org.mapdb.BTreeKeySerializer<?> bTreeKeySerializerFor(TypeSystem.TypeFactory<?> type,
                                                              boolean pack)

      Obtain a serializer for the given key type.
      Parameters:
        `type` - the type; may not be null
        `pack` - true if the serializer can/should pack keys together when possible, or false otherwise
      Returns:
        the serializer

    - #### db

          protected final org.mapdb.DB db(boolean useHeap)

    - #### delete

          protected final void delete(String name,
                    boolean onHeap)

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