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

    java.lang.Object
      |
      +--com.sleepycat.bdb.collection.StoredContainer

All Implemented Interfaces:
  Cloneable

Direct Known Subclasses:
  StoredCollection, StoredMap

public abstract class StoredContainer
extends Object
implements Cloneable

A abstract base class for all stored collections and maps. This class provides implementations of methods that are common to the `Collection` and the `Map` interfaces, namely `clear()`, `isEmpty()` and `size()`.

In addition, this class provides the following methods for stored collections only. Note that the use of these methods is not compatible with the standard Java collections interface.

- `isWriteAllowed()`
- `isIndexed()`
- `isOrdered()`
- `areDuplicatesAllowed()`
- `areDuplicatesOrdered()`
- `areKeysRenumbered()`
- `isDirtyReadAllowed()`
- `isDirtyReadEnabled()`
- `isAutoCommit()`
- `isTransactional()`

Method Summary
`boolean` | `areDuplicatesAllowed()` Returns whether duplicate keys are allowed in this container.
`boolean` | `areDuplicatesOrdered()` Returns whether duplicate keys are allowed and sorted by element value.
`boolean` | `areKeysRenumbered()` Returns whether keys are renumbered when insertions and deletions occur.
`void` | `clear()` Removes all mappings or elements from this map or collection (optional operation).
`boolean` | `isAutoCommit()` Returns whether auto-commit is enabled for this container or for its associated `DbEnv`.
`boolean` | `isDirtyReadAllowed()` Returns whether dirty-read is allowed for this container.
`boolean` | `isDirtyReadEnabled()` Returns whether dirty-read is enabled for this container.
`boolean` | `isEmpty()` Returns true if this map or collection contains no mappings or elements.
`boolean` | `isIndexed()` Returns whether this container is a view on a `DataIndex` rather than directly on a `DataStore`.
`boolean` | `isOrdered()` Returns whether keys are ordered in this container.
`boolean` | `isTransactional()` Returns whether the databases underlying this container are transactional.
`boolean` | `isWriteAllowed()` Returns true if this is a read-write container or false if this is a read-only container.
`int` | `size()` Always throws UnsupportedOperationException.

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

Method Detail

### isWriteAllowed

    public final boolean isWriteAllowed()

  Returns true if this is a read-write container or false if this is a read-only container. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether write is allowed.

### isDirtyReadAllowed

    public final boolean isDirtyReadAllowed()

  Returns whether dirty-read is allowed for this container. Dirty-read is allowed if Db.DB_DIRTY_READ was specified when opening the database of the underlying Store and Index (if any) for this container. Even when dirty-read is allowed it must specifically be enabled by calling one of the `StoredCollections` methods. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether dirty-read is allowed.

### isDirtyReadEnabled

    public final boolean isDirtyReadEnabled()

  Returns whether dirty-read is enabled for this container. If dirty-read is enabled, data will be read that is modified but not committed. Dirty-read is disabled by default. This method always returns false if `isDirtyReadAllowed()` returns false. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether dirty-read is enabled.

### isAutoCommit

    public final boolean isAutoCommit()

  Returns whether auto-commit is enabled for this container or for its associated `DbEnv`. If auto-commit is enabled, a transaction will be started and committed automatically for each write operation when no transaction is active. Auto-commit only applies to container methods. It does not apply to iterator methods and these always require an explict transaction. Auto-commit is disabled by default for a container but may be enabled for an entire environment using `DbEnv.setFlags(int, boolean)`. This method always returns false if `isTransactional()` returns false. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether auto-commit is enabled.

### isTransactional

    public final boolean isTransactional()

  Returns whether the databases underlying this container are transactional. Even in a transactional environment, a database will be transactional only if it was opened within a transaction or if the auto-commit option was specified when it was opened. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether the database is transactional.

### areDuplicatesAllowed

    public final boolean areDuplicatesAllowed()

  Returns whether duplicate keys are allowed in this container. Duplicates are optionally allowed for HASH and BTREE databases. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether duplicates are allowed.

### areDuplicatesOrdered

    public final boolean areDuplicatesOrdered()

  Returns whether duplicate keys are allowed and sorted by element value. Duplicates are optionally sorted for HASH and BTREE databases. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether duplicates are ordered.

### areKeysRenumbered

    public final boolean areKeysRenumbered()

  Returns whether keys are renumbered when insertions and deletions occur. Keys are optionally renumbered for RECNO databases. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether keys are renumbered.

### isOrdered

    public final boolean isOrdered()

  Returns whether keys are ordered in this container. Keys are ordered for BTREE, RECNO and QUEUE database. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether keys are ordered.

### isIndexed

    public final boolean isIndexed()

  Returns whether this container is a view on a `DataIndex` rather than directly on a `DataStore`. This method does not exist in the standard `Map` or `Collection` interfaces.

  Returns:
    whether the view is indexed.

### size

    public int size()

  Always throws UnsupportedOperationException. The size of a database cannot be obtained reliably or inexpensively. This method therefore violates the `Collection.size()` and `Map.size()` interfaces.

  Returns:
    always throws an exception.
  Throws:
    `UnsupportedOperationException` - unconditionally.

### isEmpty

    public boolean isEmpty()

  Returns true if this map or collection contains no mappings or elements. This method conforms to the `Collection.isEmpty()` and `Map.isEmpty()` interfaces.

  Returns:
    whether the container is empty.
  Throws:
    `RuntimeExceptionWrapper` - if a `DbException` is thrown.

### clear

    public void clear()

  Removes all mappings or elements from this map or collection (optional operation). This method conforms to the `Collection.clear()` and `Map.clear()` interfaces.

  Throws:
    `UnsupportedOperationException` - if the container is read-only.
    `RuntimeExceptionWrapper` - if a `DbException` is thrown.

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.