StoreConfig (Oracle - Berkeley DB Java Edition API)
Date: 2014-12-16

com.sleepycat.persist

## Class StoreConfig

- java.lang.Object
- - com.sleepycat.persist.StoreConfig

- All Implemented Interfaces:
    Cloneable

      public class StoreConfig
      extends Object
      implements Cloneable

  Configuration properties used with an `EntityStore` or `RawStore`.

  `StoreConfig` objects are thread-safe. Multiple threads may safely call the methods of a shared `StoreConfig` object.

  See the package summary example for an example of using a `StoreConfig`.

  Author:
    Mark Hayes

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static StoreConfig` | `DEFAULT` The default store configuration containing properties as if the configuration were constructed and not modified.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StoreConfig()` Creates an entity store configuration object with default properties.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `StoreConfig` | `clone()` Returns a shallow copy of the configuration.
    `StoreConfig` | `cloneConfig()` Deprecated. As of JE 4.0.13, replaced by `clone()`.
    `boolean` | `getAllowCreate()` Returns whether creation of a new store is allowed.
    `boolean` | `getDeferredWrite()` Returns the deferred-write configuration property.
    `boolean` | `getExclusiveCreate()` Returns whether opening an existing store is prohibited.
    `EntityModel` | `getModel()` Returns the entity model that defines entity classes and index keys.
    `Mutations` | `getMutations()` Returns the configured mutations for performing lazy evolution of stored instances.
    `boolean` | `getReadOnly()` Returns the read-only configuration property.
    `boolean` | `getReplicated()` Returns the replicated property for the store.
    `boolean` | `getSecondaryBulkLoad()` Returns the bulk-load-secondaries configuration property.
    `boolean` | `getTemporary()` Returns the temporary configuration property.
    `boolean` | `getTransactional()` Returns the transactional configuration property.
    `StoreConfig` | `setAllowCreate(boolean allowCreate)` Specifies whether creation of a new store is allowed.
    `StoreConfig` | `setDeferredWrite(boolean deferredWrite)` Sets the deferred-write configuration property.
    `StoreConfig` | `setExclusiveCreate(boolean exclusiveCreate)` Specifies whether opening an existing store is prohibited.
    `StoreConfig` | `setModel(EntityModel model)` Sets the entity model that defines entity classes and index keys.
    `StoreConfig` | `setMutations(Mutations mutations)` Configures mutations for performing lazy evolution of stored instances.
    `StoreConfig` | `setReadOnly(boolean readOnly)` Sets the read-only configuration property.
    `StoreConfig` | `setReplicated(boolean replicated)` Configures a store to be replicated or non-replicated, in a replicated Environment.
    `StoreConfig` | `setSecondaryBulkLoad(boolean secondaryBulkLoad)` Sets the bulk-load-secondaries configuration property.
    `StoreConfig` | `setTemporary(boolean temporary)` Sets the temporary configuration property.
    `StoreConfig` | `setTransactional(boolean transactional)` Sets the transactional configuration property.

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

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

- - ### Field Detail

    - #### DEFAULT

          public static final StoreConfig DEFAULT

      The default store configuration containing properties as if the configuration were constructed and not modified.

  - ### Constructor Detail

    - #### StoreConfig

          public StoreConfig()

      Creates an entity store configuration object with default properties.

  - ### Method Detail

    - #### cloneConfig

          public StoreConfig cloneConfig()

      Deprecated. As of JE 4.0.13, replaced by `clone()`.
      Returns a shallow copy of the configuration.

    - #### clone

          public StoreConfig clone()

      Returns a shallow copy of the configuration.
      Overrides:
        `clone` in class `Object`

    - #### setAllowCreate

          public StoreConfig setAllowCreate(boolean allowCreate)

      Specifies whether creation of a new store is allowed. By default this property is false.

      If this property is false and the internal store metadata database does not exist, `DatabaseException` will be thrown when the store is opened.

    - #### getAllowCreate

          public boolean getAllowCreate()

      Returns whether creation of a new store is allowed.

    - #### setExclusiveCreate

          public StoreConfig setExclusiveCreate(boolean exclusiveCreate)

      Specifies whether opening an existing store is prohibited. By default this property is false.

      If this property is true and the internal store metadata database already exists, `DatabaseException` will be thrown when the store is opened.

    - #### getExclusiveCreate

          public boolean getExclusiveCreate()

      Returns whether opening an existing store is prohibited.

    - #### setTransactional

          public StoreConfig setTransactional(boolean transactional)

      Sets the transactional configuration property. By default this property is false.

      This property is true to open all store indices for transactional access. True may not be specified if the environment is not also transactional.

    - #### getTransactional

          public boolean getTransactional()

      Returns the transactional configuration property.

    - #### setReadOnly

          public StoreConfig setReadOnly(boolean readOnly)

      Sets the read-only configuration property. By default this property is false.

      This property is true to open all store indices for read-only access, or false to open them for read-write access. False may not be specified if the environment is read-only.

    - #### getReadOnly

          public boolean getReadOnly()

      Returns the read-only configuration property.

    - #### setReplicated

          public StoreConfig setReplicated(boolean replicated)

      Configures a store to be replicated or non-replicated, in a replicated Environment. By default this property is true, meaning that by default a store is replicated in a replicated Environment.

      In a non-replicated Environment, this property is ignored. All stores are non-replicated in a non-replicated Environment.

      See Also:
        Non-replicated Databases in a Replicated Environment

    - #### getReplicated

          public boolean getReplicated()

      Returns the replicated property for the store.

      This method returns true by default. However, in a non-replicated Environment, this property is ignored. All stores are non-replicated in a non-replicated Environment.

      See Also:
        `setReplicated(boolean)`

    - #### setDeferredWrite

          public StoreConfig setDeferredWrite(boolean deferredWrite)

      Sets the deferred-write configuration property. By default this property is false.

      This property is true to open all store index databases for deferred-write access. True may not be specified if the store is transactional.

      Deferred write stores avoid disk I/O and are not guaranteed to be persistent until `EntityStore.sync()` or `Environment.sync()` is called or the store is closed normally. This mode is particularly geared toward stores that frequently modify and delete data records. See the Getting Started Guide, Database chapter for a full description of the mode.

      See Also:
        `setTransactional(boolean)`

    - #### getDeferredWrite

          public boolean getDeferredWrite()

      Returns the deferred-write configuration property.

    - #### setTemporary

          public StoreConfig setTemporary(boolean temporary)

      Sets the temporary configuration property. By default this property is false.

      This property is true to open all store databases as temporary databases. True may not be specified if the store is transactional.

      Temporary stores avoid disk I/O and are not persistent -- they are deleted when the store is closed or after a crash. This mode is particularly geared toward in-memory stores. See the Getting Started Guide, Database chapter for a full description of the mode.

      See Also:
        `setTransactional(boolean)`

    - #### getTemporary

          public boolean getTemporary()

      Returns the temporary configuration property.

    - #### setSecondaryBulkLoad

          public StoreConfig setSecondaryBulkLoad(boolean secondaryBulkLoad)

      Sets the bulk-load-secondaries configuration property. By default this property is false.

      This property is true to cause the initial creation of secondary indices to be performed as a bulk load. If this property is true and `EntityStore.getSecondaryIndex` has never been called for a secondary index, that secondary index will not be created or written as records are written to the primary index. In addition, if that secondary index defines a foreign key constraint, the constraint will not be enforced.

      The secondary index will be populated later when the `getSecondaryIndex` method is called for the first time for that index, or when the store is closed and re-opened with this property set to false and the primary index is obtained. In either case, the secondary index is populated by reading through the entire primary index and adding records to the secondary index as needed. While populating the secondary, foreign key constraints will be enforced and an exception is thrown if a constraint is violated.

      When loading a primary index along with secondary indexes from a large input data set, configuring a bulk load of the secondary indexes is sometimes more performant than updating the secondary indexes each time the primary index is updated. The absence of foreign key constraints during the load also provides more flexibility.

    - #### getSecondaryBulkLoad

          public boolean getSecondaryBulkLoad()

      Returns the bulk-load-secondaries configuration property.

    - #### setModel

          public StoreConfig setModel(EntityModel model)

      Sets the entity model that defines entity classes and index keys.

      If null is specified or this method is not called, an `AnnotationModel` instance is used by default.

    - #### getModel

          public EntityModel getModel()

      Returns the entity model that defines entity classes and index keys.

    - #### setMutations

          public StoreConfig setMutations(Mutations mutations)

      Configures mutations for performing lazy evolution of stored instances. Existing mutations for this store are not cleared, so the mutations required are only those changes that have been made since the store was last opened. Some new mutations may override existing specifications, and some may be supplemental.

      If null is specified and the store already exists, the previously specified mutations are used. The mutations are stored persistently in serialized form.

      Mutations must be available to handle all changes to classes that are incompatible with the class definitions known to this store. See `Mutations` and `Class Evolution` for more information.

      If an incompatible class change has been made and mutations are not available for handling the change, `IncompatibleClassException` will be thrown when creating an `EntityStore`.

    - #### getMutations

          public Mutations getMutations()

      Returns the configured mutations for performing lazy evolution of stored instances.

Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved.