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

## com.sleepycat.bind.tuple
Class TupleTupleKeyCreator

    java.lang.Object
      com.sleepycat.bind.tuple.TupleBase
          com.sleepycat.bind.tuple.TupleTupleKeyCreator

All Implemented Interfaces:
  SecondaryKeyCreator

Direct Known Subclasses:
  TupleTupleMarshalledKeyCreator

    public abstract class TupleTupleKeyCreator

extends TupleBase
implements SecondaryKeyCreator

An abstract key creator that uses a tuple key and a tuple data entry. This class takes care of converting the key and data entry to/from `TupleInput` and `TupleOutput` objects. The following abstract method must be implemented by a concrete subclass to create the index key using these objects

- `createSecondaryKey(TupleInput,TupleInput,TupleOutput)`

Constructor Summary
`TupleTupleKeyCreator()` Creates a tuple-tuple key creator.

Method Summary
`boolean` | `createSecondaryKey(SecondaryDatabase db, DatabaseEntry primaryKeyEntry, DatabaseEntry dataEntry, DatabaseEntry indexKeyEntry)` Creates a secondary key entry, given a primary key and data entry.
`abstract boolean` | `createSecondaryKey(TupleInput primaryKeyInput, TupleInput dataInput, TupleOutput indexKeyOutput)` Creates the index key from primary key tuple and data tuple.
`boolean` | `nullifyForeignKey(SecondaryDatabase db, DatabaseEntry dataEntry)`
`boolean` | `nullifyForeignKey(TupleInput dataInput, TupleOutput dataOutput)` Clears the index key in the tuple data entry.

Methods inherited from class com.sleepycat.bind.tuple.TupleBase
`entryToInput, getTupleBufferSize, getTupleOutput, inputToEntry, newOutput, newOutput, outputToEntry, setTupleBufferSize`

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

Constructor Detail

### TupleTupleKeyCreator

    public TupleTupleKeyCreator()

  Creates a tuple-tuple key creator.

Method Detail

### createSecondaryKey

    public boolean createSecondaryKey(SecondaryDatabase db,
                                      DatabaseEntry primaryKeyEntry,
                                      DatabaseEntry dataEntry,
                                      DatabaseEntry indexKeyEntry)
                               throws DatabaseException

  Description copied from interface: `SecondaryKeyCreator`
  Creates a secondary key entry, given a primary key and data entry.

  A secondary key may be derived from the primary key, primary data, or a combination of the primary key and data. For secondary keys that are optional, the key creator method may return false and the key/data pair will not be indexed. To ensure the integrity of a secondary database the key creator method must always return the same result for a given set of input parameters.

  Specified by:
    `createSecondaryKey` in interface `SecondaryKeyCreator`
  Parameters:
    `db` - the database to which the secondary key will be added. This parameter is passed for informational purposes but is not commonly used.

    `primaryKeyEntry` - the primary key entry. This parameter must not be modified by this method.

    `dataEntry` - the primary data entry. This parameter must not be modified by this method.

    `indexKeyEntry` - the secondary key created by this method.

  Returns:
    true if a key was created, or false to indicate that the key is not present.

  Throws:
    `DatabaseException` - if an error occurs attempting to create the secondary key.

### nullifyForeignKey

    public boolean nullifyForeignKey(SecondaryDatabase db,
                                     DatabaseEntry dataEntry)
                              throws DatabaseException

  Throws:
    `DatabaseException`

### createSecondaryKey

    public abstract boolean createSecondaryKey(TupleInput primaryKeyInput,
                                               TupleInput dataInput,
                                               TupleOutput indexKeyOutput)

  Creates the index key from primary key tuple and data tuple.

  Parameters:
    `primaryKeyInput` - is the `TupleInput` for the primary key entry.
    `dataInput` - is the `TupleInput` for the data entry.
    `indexKeyOutput` - is the destination index key tuple.
  Returns:
    true if a key was created, or false to indicate that the key is not present.

### nullifyForeignKey

    public boolean nullifyForeignKey(TupleInput dataInput,
                                     TupleOutput dataOutput)

  Clears the index key in the tuple data entry. The dataInput should be read and then written to the dataOutput, clearing the index key in the process.

  The secondary key should be output or removed by this method such that `createSecondaryKey(com.sleepycat.db.SecondaryDatabase, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)` will return false. Other fields in the data object should remain unchanged.

  Parameters:
    `dataInput` - is the `TupleInput` for the data entry.
    `dataOutput` - is the destination `TupleOutput`.
  Returns:
    true if the key was cleared, or false to indicate that the key is not present and no change is necessary.

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

Copyright (c) 1996,2007 Oracle. All rights reserved.