TupleTupleKeyExtractor (Sleepycat Software, Inc. - Berkeley DB Java API)
Keywords: com.sleepycat.bdb.bind.tuple.TupleTupleKeyExtractor,TupleTupleKeyExtractor class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.2.52
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.bdb.bind.tuple
Class TupleTupleKeyExtractor

    java.lang.Object
      |
      +--com.sleepycat.bdb.bind.tuple.TupleTupleKeyExtractor

All Implemented Interfaces:
  KeyExtractor

Direct Known Subclasses:
  TupleTupleMarshalledKeyExtractor

public abstract class TupleTupleKeyExtractor
extends Object
implements KeyExtractor

An abstract key extractor that uses a tuple key and a tuple value. This class takes care of converting the key and value data to/from `TupleInput` and `TupleOutput` objects. Its two abstract methods must be implemented by a concrete subclass to extract and clear the index key using these objects.

- `extractIndexKey(TupleInput,TupleInput,TupleOutput)`
- `clearIndexKey(TupleInput,TupleOutput)`

Constructor Summary
`TupleTupleKeyExtractor(TupleFormat primaryKeyFormat, TupleFormat valueFormat, TupleFormat indexKeyFormat)` Creates a tuple-tuple key extractor.

Method Summary
`void` | `clearIndexKey(DataBuffer valueData)` Clears the index key in a value buffer.
`abstract void` | `clearIndexKey(TupleInput valueInput, TupleOutput valueOutput)` Clears the index key in the tuple value data.
`void` | `extractIndexKey(DataBuffer primaryKeyData, DataBuffer valueData, DataBuffer indexKeyData)` Extracts the index key data from primary key and value buffers.
`abstract void` | `extractIndexKey(TupleInput primaryKeyInput, TupleInput valueInput, TupleOutput indexKeyOutput)` Extracts the index key data from primary key tuple and value tuple data.
`DataFormat` | `getIndexKeyFormat()` Returns the format of the index key data.
`DataFormat` | `getPrimaryKeyFormat()` Returns the format of the primary key data or null if the index key data is not derived from the primary key data.
`DataFormat` | `getValueFormat()` Returns the format of the value data or null if the index key data is not derived from the value data.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TupleTupleKeyExtractor

    public TupleTupleKeyExtractor(TupleFormat primaryKeyFormat,
                                  TupleFormat valueFormat,
                                  TupleFormat indexKeyFormat)

  Creates a tuple-tuple key extractor.

Parameters:
  `primaryKeyFormat` - is the primary key format, or null if no primary key data is used to construct the index key.
  `valueFormat` - is the value format, or null if no value data is used to construct the index key.
  `indexKeyFormat` - is the index key format.

Method Detail

### getPrimaryKeyFormat

    public DataFormat getPrimaryKeyFormat()

  Description copied from interface: `KeyExtractor`
  Returns the format of the primary key data or null if the index key data is not derived from the primary key data. If this method returns null, then null will be passed for the `primaryKeyData` parameter of `KeyExtractor.extractIndexKey(com.sleepycat.bdb.bind.DataBuffer, com.sleepycat.bdb.bind.DataBuffer, com.sleepycat.bdb.bind.DataBuffer)`.

  Specified by:
    `getPrimaryKeyFormat` in interface `KeyExtractor`
  Returns:
    the format of the primary key data or null.

### getValueFormat

    public DataFormat getValueFormat()

  Description copied from interface: `KeyExtractor`
  Returns the format of the value data or null if the index key data is not derived from the value data. If this method returns null, then null will be passed for the `valueData` parameter of `KeyExtractor.extractIndexKey(com.sleepycat.bdb.bind.DataBuffer, com.sleepycat.bdb.bind.DataBuffer, com.sleepycat.bdb.bind.DataBuffer)`.

  Specified by:
    `getValueFormat` in interface `KeyExtractor`
  Returns:
    the format of the value data or null.

### getIndexKeyFormat

    public DataFormat getIndexKeyFormat()

  Description copied from interface: `KeyExtractor`
  Returns the format of the index key data.

  Specified by:
    `getIndexKeyFormat` in interface `KeyExtractor`
  Returns:
    the format of the index key data.

### extractIndexKey

    public void extractIndexKey(DataBuffer primaryKeyData,
                                DataBuffer valueData,
                                DataBuffer indexKeyData)
                         throws IOException

  Description copied from interface: `KeyExtractor`
  Extracts the index key data from primary key and value buffers. The index key is extracted when saving the data record identified by the primary key and value buffers, in order to add or remove an index entry in the database for that data record.

  Specified by:
    `extractIndexKey` in interface `KeyExtractor`
  Parameters:
    `primaryKeyData` - is the source primary key data, or null if no primary key data is used to construct the index key, in which case `KeyExtractor.getPrimaryKeyFormat()` should also return null.
    `valueData` - is the source value data, or null if no value data is used to construct the index key, in which case `KeyExtractor.getValueFormat()` should also return null.
    `indexKeyData` - is the destination index key buffer. For index keys which are optionally present, the buffer's length should be set to zero to indicate that the key is not present or null.
    `IOException`

### clearIndexKey

    public void clearIndexKey(DataBuffer valueData)
                       throws IOException

  Description copied from interface: `KeyExtractor`
  Clears the index key in a value buffer. The index key is cleared when the index is for a foreign key identifying a record that has been deleted. This method is called only if the `ForeignKeyIndex` is configured with `ForeignKeyIndex.ON_DELETE_CLEAR`. It is never called for index keys that are derived from primary key data, since in this case `ForeignKeyIndex.ON_DELETE_CLEAR` is not allowed.

  Specified by:
    `clearIndexKey` in interface `KeyExtractor`
  Parameters:
    `valueData` - is the source and destination value data. On entry this contains the index key to be cleared. It should be changed by this method such that `KeyExtractor.extractIndexKey(com.sleepycat.bdb.bind.DataBuffer, com.sleepycat.bdb.bind.DataBuffer, com.sleepycat.bdb.bind.DataBuffer)` will extract a null key (set the buffer length to zero). Other data in the buffer should remain unchanged.
    `IOException`

### extractIndexKey

    public abstract void extractIndexKey(TupleInput primaryKeyInput,
                                         TupleInput valueInput,
                                         TupleOutput indexKeyOutput)
                                  throws IOException

  Extracts the index key data from primary key tuple and value tuple data.

  Parameters:
    `primaryKeyInput` - is the `TupleInput` for the primary key data, or null if no primary key data is used to construct the index key.
    `valueInput` - is the `TupleInput` for the value data, or null if no value data is used to construct the index key.
    `indexKeyOutput` - is the destination index key tuple. For index keys which are optionally present, no tuple data should be output to indicate that the key is not present or null.
    `IOException`

### clearIndexKey

    public abstract void clearIndexKey(TupleInput valueInput,
                                       TupleOutput valueOutput)
                                throws IOException

  Clears the index key in the tuple value data. The valueInput should be read and then written to the valueOutput, clearing the index key in the

  Parameters:
    `valueInput` - is the `TupleInput` for the value data.
    `valueOutput` - is the destination `TupleOutput`.
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.2.52
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.