public class SSecondaryConfig extends SDatabaseConfig
SEnvironment.openSecondaryDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabase, com.sleepycat.client.SSecondaryConfig)
.
To create a configuration object with default attributes:
SecondaryConfig config = new SecondaryConfig();To set custom attributes:
SSecondaryConfig config = new SSecondaryConfig(); config.setAllowCreate(true); config.setSortedDuplicates(true); config.setKeyCreator(new MyKeyCreator());
Constructor and Description |
---|
SSecondaryConfig()
Creates an instance with the system's default settings.
|
Modifier and Type | Method and Description |
---|---|
SSecondaryConfig |
cloneConfig()
Create a deep copy of this configuration object.
|
boolean |
getAllowPopulate()
Returns whether automatic population of the secondary is allowed.
|
protected java.lang.Object |
getField(F field)
Return the value set on a specified field.
|
SDatabase |
getForeignKeyDatabase()
Return the database used to check the foreign key integrity constraint,
or null if no foreign key constraint will be checked.
|
SForeignKeyDeleteAction |
getForeignKeyDeleteAction()
Return the action taken when a referenced record in the foreign key
database is deleted.
|
SForeignKeyNullifier |
getForeignKeyNullifier()
Returns the user-supplied object used for setting single-valued foreign
keys to null.
|
SForeignMultiKeyNullifier |
getForeignMultiKeyNullifier()
Returns the user-supplied object used for setting multi-valued foreign
keys to null.
|
boolean |
getImmutableSecondaryKey()
Return whether the secondary key is immutable.
|
SSecondaryKeyCreator |
getKeyCreator()
Return the user-supplied object used for creating single-valued
secondary keys.
|
SSecondaryMultiKeyCreator |
getMultiKeyCreator()
Return the user-supplied object used for creating multi-valued
secondary keys.
|
protected T |
getThriftObj() |
SSecondaryConfig |
setAllowPopulate(boolean allowPopulate)
Specifies whether automatic population of the secondary is allowed.
|
SSecondaryConfig |
setForeignKeyDatabase(SDatabase foreignDb)
Define a foreign key integrity constraint for a given foreign key
database.
|
SSecondaryConfig |
setForeignKeyDeleteAction(SForeignKeyDeleteAction action)
Specify the action taken when a referenced record in the foreign key
database is deleted.
|
void |
setForeignKeyNullifier(SForeignKeyNullifier keyNullifier)
Specifies the user-supplied object used for setting single-valued
foreign keys to null.
|
void |
setForeignMultiKeyNullifier(SForeignMultiKeyNullifier multiKeyNullifier)
Specifies the user-supplied object used for setting multi-valued foreign
keys to null.
|
SSecondaryConfig |
setImmutableSecondaryKey(boolean immutableSecondaryKey)
Specify whether the secondary key is immutable.
|
SSecondaryConfig |
setKeyCreator(SSecondaryKeyCreator keyCreator)
Specify the user-supplied object used for creating single-valued
secondary keys.
|
void |
setMultiKeyCreator(SSecondaryMultiKeyCreator multiKeyCreator)
Specify the user-supplied object used for creating multi-valued
secondary keys.
|
getAllowCreate, getBlobThreshold, getBtreeComparator, getBtreeMinKey, getBtreeRecordNumbers, getChecksum, getExclusiveCreate, getHashFillFactor, getHashNumElements, getHeapRegionSize, getHeapsize, getMultiversion, getNoWaitDbExclusiveLock, getPageSize, getPriority, getQueueExtentSize, getReadOnly, getReadUncommitted, getRecordLength, getRecordPad, getRenumbering, getReverseSplitOff, getSortedDuplicates, getTransactional, getTransactionNotDurable, getType, getUnsortedDuplicates, setAllowCreate, setBlobThreshold, setBtreeMinKey, setBtreeRecordNumbers, setChecksum, setExclusiveCreate, setHashFillFactor, setHashNumElements, setHeapRegionSize, setHeapsize, setMultiversion, setNoWaitDbExclusiveLock, setPageSize, setPriority, setQueueExtentSize, setReadOnly, setReadUncommitted, setRecordLength, setRecordPad, setRenumbering, setReverseSplitOff, setSortedDuplicates, setTransactionNotDurable, setType, setUnsortedDuplicates
public SSecondaryConfig()
public SSecondaryConfig cloneConfig()
SDatabaseConfig
cloneConfig
in class SDatabaseConfig
public boolean getAllowPopulate()
setAllowPopulate(boolean)
has not been called, this method
returns false.setAllowPopulate(boolean)
public SSecondaryConfig setAllowPopulate(boolean allowPopulate)
If automatic population is allowed, when the secondary database is opened it is checked to see if it is empty. If it is empty, the primary database is read in its entirety and keys are added to the secondary database using the information read from the primary.
If this property is set to true, the population of the secondary will be done within the explicit or auto-commit transaction that is used to open the database.
allowPopulate
- whether automatic population of the secondary is
allowed.public boolean getImmutableSecondaryKey()
setImmutableSecondaryKey(boolean)
public SSecondaryConfig setImmutableSecondaryKey(boolean immutableSecondaryKey)
Specifying that a secondary key is immutable can be used to optimize updates when the secondary key in a primary record will never be changed after that primary record is inserted.
Be sure to set this property to true only if the secondary key in the primary record is never changed. If this rule is violated, the secondary index will become corrupted, that is, it will become out of sync with the primary.
immutableSecondaryKey
- whether the secondary key is immutablepublic SDatabase getForeignKeyDatabase()
setForeignKeyDatabase(com.sleepycat.client.SDatabase)
public SSecondaryConfig setForeignKeyDatabase(SDatabase foreignDb)
If this property is non-null, a record must be present in the specified foreign database for every record in the secondary database, where the secondary key value is equal to the foreign database key value. Whenever a record is to be added to the secondary database, the secondary key is used as a lookup key in the foreign database.
The foreign database must not have duplicates allowed.
foreignDb
- the database used to check the foreign key
integrity constraint, or null if no foreign key constraint should be
checked.public SForeignKeyDeleteAction getForeignKeyDeleteAction()
setForeignKeyDeleteAction(com.sleepycat.client.SForeignKeyDeleteAction)
public SSecondaryConfig setForeignKeyDeleteAction(SForeignKeyDeleteAction action)
This property is ignored if the foreign key database property is null.
action
- the action taken when a referenced record in the foreign
key database is deleted.SForeignKeyDeleteAction
public SSecondaryKeyCreator getKeyCreator()
setKeyCreator(com.sleepycat.client.SSecondaryKeyCreator)
public SSecondaryConfig setKeyCreator(SSecondaryKeyCreator keyCreator)
Unless the primary database is read-only, a key creator is required when opening a secondary database. Either a SKeyCreator or SMultiKeyCreator must be specified, but both may not be specified.
keyCreator
- the user-supplied object used for creating
single-valued secondary keys.public SSecondaryMultiKeyCreator getMultiKeyCreator()
setMultiKeyCreator(com.sleepycat.client.SSecondaryMultiKeyCreator)
public void setMultiKeyCreator(SSecondaryMultiKeyCreator multiKeyCreator)
Unless the primary database is read-only, a key creator is required when opening a secondary database. Either a SKeyCreator or SMultiKeyCreator must be specified, but both may not be specified.
multiKeyCreator
- the user-supplied object used for creating
multi-valued secondary keyspublic SForeignKeyNullifier getForeignKeyNullifier()
setForeignKeyNullifier(com.sleepycat.client.SForeignKeyNullifier)
public void setForeignKeyNullifier(SForeignKeyNullifier keyNullifier)
This method may not be used along with setMultiKeyCreator(com.sleepycat.client.SSecondaryMultiKeyCreator)
. When using a multi-key creator, use setForeignMultiKeyNullifier(com.sleepycat.client.SForeignMultiKeyNullifier)
instead.
If the foreign key database property is non-null and the foreign key
delete action is NULLIFY
, this property is required to be
non-null; otherwise, this property is ignored.
WARNING: Key nullifier instances are shared by multiple threads and key nullifier methods are called without any special synchronization. Therefore, key creators must be thread safe. In general no shared state should be used and any caching of computed values must be done with proper synchronization.
keyNullifier
- the user-supplied object used for setting
single-valued foreign keys to null.SForeignKeyNullifier
,
SForeignKeyDeleteAction.NULLIFY
,
setForeignKeyDatabase(com.sleepycat.client.SDatabase)
public SForeignMultiKeyNullifier getForeignMultiKeyNullifier()
setForeignMultiKeyNullifier(com.sleepycat.client.SForeignMultiKeyNullifier)
public void setForeignMultiKeyNullifier(SForeignMultiKeyNullifier multiKeyNullifier)
If the foreign key database property is non-null and the foreign key
delete action is NULLIFY
, this property is required to be
non-null; otherwise, this property is ignored.
WARNING: Key nullifier instances are shared by multiple threads and key nullifier methods are called without any special synchronization. Therefore, key creators must be thread safe. In general no shared state should be used and any caching of computed values must be done with proper synchronization.
multiKeyNullifier
- the user-supplied object used for
setting multi-valued foreign keys to null.SForeignMultiKeyNullifier
,
SForeignKeyDeleteAction.NULLIFY
,
setForeignKeyDatabase(com.sleepycat.client.SDatabase)
protected T getThriftObj()
protected java.lang.Object getField(F field) throws java.lang.IllegalStateException
field
- the fieldjava.lang.IllegalStateException
- if the field is not setCopyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.