TupleSerialDbFactory (Sleepycat Software, Inc. - Berkeley DB Java API)
Keywords: com.sleepycat.bdb.factory.TupleSerialDbFactory,TupleSerialDbFactory 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.factory
Class TupleSerialDbFactory

    java.lang.Object
      |
      +--com.sleepycat.bdb.factory.TupleSerialDbFactory

public class TupleSerialDbFactory
extends Object

Creates stored collections having tuple keys and serialized entity values. The entity classes must implement the java.io.Serializable and MarshalledTupleKeyEntity interfaces. The key classes must either implement the MarshalledTupleData interface or be one of the Java primitive type classes.

This factory object is used to create DataStore, DataIndex, ForeignKeyIndex and Map objects. The underlying DataFormat, DataBinding and KeyExtractor objects are created automatically.

Constructor Summary
`TupleSerialDbFactory(ClassCatalog catalog)` Creates a tuple-serial factory for given environment and class catalog.

Method Summary
`ClassCatalog` | `getCatalog()` Returns the class catalog associated with this factory.
`DataIndex` | `newDataIndex(DataStore store, Db db, String keyName, boolean usePrimaryKey, boolean useValue)` Creates an index from a previously opened Db object.
`DataStore` | `newDataStore(Db db, Class baseClass, PrimaryKeyAssigner keyAssigner)` Creates a store from a previously opened Db object.
`ForeignKeyIndex` | `newForeignKeyIndex(DataStore store, Db db, String keyName, boolean usePrimaryKey, boolean useValue, DataStore foreignStore, int deleteAction)` Creates a foreign key index from a previously opened Db object.
`StoredMap` | `newMap(DataIndex index, Class keyClass, boolean writeAllowed)` Creates a map for a given index that was obtained from this factory.
`StoredMap` | `newMap(DataStore store, Class keyClass, boolean writeAllowed)` Creates a map for a given store that was obtained from this factory.
`StoredSortedMap` | `newSortedMap(DataIndex index, Class keyClass, boolean writeAllowed)` Creates a sorted map for a given index that was obtained from this factory.
`StoredSortedMap` | `newSortedMap(DataStore store, Class keyClass, boolean writeAllowed)` Creates a sorted map for a given store that was obtained from this factory.

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

Constructor Detail

### TupleSerialDbFactory

    public TupleSerialDbFactory(ClassCatalog catalog)

  Creates a tuple-serial factory for given environment and class catalog.

Method Detail

### getCatalog

    public final ClassCatalog getCatalog()

  Returns the class catalog associated with this factory.

### newDataStore

    public DataStore newDataStore(Db db,
                                  Class baseClass,
                                  PrimaryKeyAssigner keyAssigner)

  Creates a store from a previously opened Db object.

  Parameters:
    `db` - the previously opened Db object.
    `baseClass` - the base class of the entity values for this store. It must implement the `MarshalledTupleKeyEntity` interface.
    `keyAssigner` - an object for assigning keys or null if no automatic key assignment is used.

### newDataIndex

    public DataIndex newDataIndex(DataStore store,
                                  Db db,
                                  String keyName,
                                  boolean usePrimaryKey,
                                  boolean useValue)

  Creates an index from a previously opened Db object.

  Parameters:
    `db` - the previously opened Db object.
    `store` - the store to be indexed and also specifies the environment that was used to create the Db object.
    `keyName` - is the key name passed to the `MarshalledTupleKeyEntity.marshalIndexKey(java.lang.String, com.sleepycat.bdb.bind.tuple.TupleOutput)` method to identify the index key.
    `usePrimaryKey` - is true if the primary key data is used to construct the index key.
    `useValue` - is true if the value data is used to construct the index key.
  Throws:
    `IllegalArgumentException` - if a format mismatch is detected between the index and the store, or if unsorted duplicates were specified for the index Db.

### newForeignKeyIndex

    public ForeignKeyIndex newForeignKeyIndex(DataStore store,
                                              Db db,
                                              String keyName,
                                              boolean usePrimaryKey,
                                              boolean useValue,
                                              DataStore foreignStore,
                                              int deleteAction)

  Creates a foreign key index from a previously opened Db object.

  Parameters:
    `store` - the store to be indexed and also specifies the environment that was used to create the Db object.
    `db` - the previously opened Db object.
    `keyName` - is the key name passed to the `MarshalledTupleKeyEntity.marshalIndexKey(java.lang.String, com.sleepycat.bdb.bind.tuple.TupleOutput)` method to identify the index key.
    `usePrimaryKey` - is true if the primary key data is used to construct the index key.
    `useValue` - is true if the value data is used to construct the index key.
    `foreignStore` - is the store in which the index key for this store is a primary key.
    `deleteAction` - determines what action occurs when the foreign key is deleted. It must be one of the `ForeignKeyIndex` ON_DELETE_ constants.
  Throws:
    `IllegalArgumentException` - if a format mismatch is detected between the index and the store, or if unsorted duplicates were specified for the index Db.

### newMap

    public StoredMap newMap(DataStore store,
                            Class keyClass,
                            boolean writeAllowed)

  Creates a map for a given store that was obtained from this factory.

  Parameters:
    `store` - a store obtained from this factory.
    `keyClass` - is the class used for map keys. It must implement the `MarshalledTupleData` interface or be one of the Java primitive type classes.
    `writeAllowed` - is true to create a read-write collection or false to create a read-only collection.

### newMap

    public StoredMap newMap(DataIndex index,
                            Class keyClass,
                            boolean writeAllowed)

  Creates a map for a given index that was obtained from this factory.

  Parameters:
    `index` - a index obtained from this factory.
    `keyClass` - is the class used for map keys. It must implement the `MarshalledTupleData` interface or be one of the Java primitive type classes.
    `writeAllowed` - is true to create a read-write collection or false to create a read-only collection.

### newSortedMap

    public StoredSortedMap newSortedMap(DataStore store,
                                        Class keyClass,
                                        boolean writeAllowed)

  Creates a sorted map for a given store that was obtained from this factory.

  Parameters:
    `store` - a store obtained from this factory.
    `keyClass` - is the class used for map keys. It must implement the `MarshalledTupleData` interface or be one of the Java primitive type classes.
    `writeAllowed` - is true to create a read-write collection or false to create a read-only collection.

### newSortedMap

    public StoredSortedMap newSortedMap(DataIndex index,
                                        Class keyClass,
                                        boolean writeAllowed)

  Creates a sorted map for a given index that was obtained from this factory.

  Parameters:
    `index` - an index obtained from this factory.
    `keyClass` - is the class used for map keys. It must implement the `MarshalledTupleData` interface or be one of the Java primitive type classes.
    `writeAllowed` - is true to create a read-write collection or false to create a read-only collection.

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.