java.security.PrivilegedExceptionAction<java.lang.Object>
, ModuleControl
, ModuleSupportable
, Corruptable
, RawStoreFactory
public final class RawStore extends java.lang.Object implements RawStoreFactory, ModuleControl, ModuleSupportable, java.security.PrivilegedExceptionAction<java.lang.Object>
String TransactionFactoryId=
Class is final as it has methods with privilege blocks and implements PrivilegedExceptionAction.
CONTAINER_CACHE_SIZE_DEFAULT, CONTAINER_CACHE_SIZE_MAXIMUM, CONTAINER_CACHE_SIZE_MINIMUM, CONTAINER_CACHE_SIZE_PARAMETER, CONTAINER_INITIAL_PAGES, CRYPTO_OLD_EXTERNAL_KEY_VERIFY_FILE, DATA_ENCRYPT_ALGORITHM_VERSION, DB_ENCRYPTION_IN_CLEANUP, DB_ENCRYPTION_IN_PROGRESS, DB_ENCRYPTION_IN_UNDO, DB_ENCRYPTION_STATUS, DEFAULT_ENCRYPTION_BLOCKSIZE, DERBY_STORE_MAJOR_VERSION_10, DERBY_STORE_MINOR_VERSION_1, DERBY_STORE_MINOR_VERSION_10, DERBY_STORE_MINOR_VERSION_2, DERBY_STORE_MINOR_VERSION_3, DERBY_STORE_MINOR_VERSION_4, ENCRYPTED_KEY, ENCRYPTION_ALIGNMENT, ENCRYPTION_BLOCKSIZE, KEEP_TRANSACTION_LOG, LOG_ENCRYPT_ALGORITHM_VERSION, MAX_CONTAINER_INITIAL_PAGES, MINIMUM_RECORD_SIZE_DEFAULT, MINIMUM_RECORD_SIZE_MINIMUM, MINIMUM_RECORD_SIZE_PARAMETER, MODULE, OLD_ENCRYPTED_KEY, PAGE_CACHE_SIZE_DEFAULT, PAGE_CACHE_SIZE_MAXIMUM, PAGE_CACHE_SIZE_MINIMUM, PAGE_CACHE_SIZE_PARAMETER, PAGE_RESERVED_SPACE_PARAMETER, PAGE_RESERVED_ZERO_SPACE_STRING, PAGE_REUSABLE_RECORD_ID, PAGE_SIZE_DEFAULT, PAGE_SIZE_MINIMUM, PAGE_SIZE_STRING, PATCH_INITPAGE_RECOVER_ERROR, PRE_ALLOCATE_PAGE, STREAM_FILE_BUFFER_SIZE_DEFAULT, STREAM_FILE_BUFFER_SIZE_MAXIMUM, STREAM_FILE_BUFFER_SIZE_MINIMUM, STREAM_FILE_BUFFER_SIZE_PARAMETER
Constructor | Description |
---|---|
RawStore() |
Modifier and Type | Method | Description |
---|---|---|
private void |
applyBulkCryptoOperation(java.util.Properties properties,
CipherFactory newCipherFactory) |
|
void |
backup(java.lang.String backupDir,
boolean wait) |
Backup the database to a backup directory.
|
void |
backup(Transaction t,
java.io.File backupDir) |
|
void |
backupAndEnableLogArchiveMode(java.lang.String backupDir,
boolean deleteOnlineArchivedLogFiles,
boolean wait) |
Backup the database to a backup directory and enable the log archive
mode that will keep the archived log files required for roll-forward
from this version backup.
|
void |
boot(boolean create,
java.util.Properties properties) |
Boot this module with the given properties.
|
private static java.lang.Object |
bootServiceModule(boolean create,
java.lang.Object serviceModule,
java.lang.String factoryInterface,
java.util.Properties properties) |
Privileged startup.
|
boolean |
canSupport(java.util.Properties startParams) |
We use this RawStore for all databases.
|
java.io.Serializable |
changeBootPassword(java.util.Properties properties,
java.io.Serializable changePassword) |
Change the boot password.
|
void |
checkpoint() |
Checkpoint the database.
|
boolean |
checkVersion(int requiredMajorVersion,
int requiredMinorVersion,
java.lang.String feature) |
Check to see if a database has been upgraded to the required
level in order to use a store feature.
|
private void |
crashOnDebugFlag(java.lang.String debugFlag,
boolean reEncrypt) |
when the input debug flag is set, an expception
is throw when run in the debug mode.
|
private void |
createBackupDirectory(java.io.File dir) |
Create a directory for backup.
|
void |
createDataWarningFile() |
Use the available storage factory handle to create a readme
file in "seg0" directory warning users to not edit/delete
any files in the directory to avoid database corruption.
|
void |
createFinished() |
|
private void |
cryptoOperationAllowed(boolean reEncrypt,
boolean decrypt) |
checks if the database is in the right state to (re)encrypt it.
|
int |
decrypt(byte[] ciphertext,
int offset,
int length,
byte[] cleartext,
int outputOffset) |
Decrypt cleartext from ciphertext.
|
void |
disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles) |
disables the log archival process, i.e No old log files
will be kept around for a roll-forward recovery.
|
int |
encrypt(byte[] cleartext,
int offset,
int length,
byte[] ciphertext,
int outputOffset,
boolean newEngine) |
Encrypt cleartext into ciphertext.
|
void |
failover(java.lang.String dbname) |
Start failover for this database.
|
private static java.lang.Object |
findServiceModule(java.lang.Object serviceModule,
java.lang.String factoryInterface) |
Privileged startup.
|
Transaction |
findUserTransaction(ContextManager contextMgr,
java.lang.String transName) |
Find a user transaction in the context manager, which must be the
current context manager.
|
void |
freeze() |
Freeze the database temporarily so a backup can be taken.
|
void |
freezePersistentStore() |
Freeze persistent store.
|
private static Context |
getContextOrNull(java.lang.String contextID) |
Privileged lookup of a Context.
|
private static ContextService |
getContextService() |
Privileged lookup of the ContextService.
|
DaemonService |
getDaemon() |
If this raw store has a daemon that services its need, return the
daemon.
|
java.lang.String |
getDataFactoryModule() |
|
int |
getEncryptionBlockSize() |
Returns the encryption block size used by the algorithm at time of
creation of an encrypted database
|
private java.lang.String |
getFilePath(java.io.File file) |
|
private java.lang.String |
getFilePath(StorageFile file) |
|
LockFactory |
getLockFactory() |
Get the LockFactory to use with this store.
|
java.lang.String |
getLogFactoryModule() |
|
java.lang.String |
getMasterFactoryModule() |
|
long |
getMaxContainerId() |
Return an id which can be used to create a container.
|
private static ModuleFactory |
getMonitor() |
Privileged Monitor lookup.
|
void |
getRawStoreProperties(PersistentSet set) |
Get JBMS properties relevant to raw store
|
private static java.lang.String |
getServiceName(java.lang.Object serviceModule) |
Privileged service name lookup.
|
java.lang.String |
getSlaveFactoryModule() |
|
java.lang.String |
getTransactionFactoryModule() |
|
TransactionInfo[] |
getTransactionInfo() |
|
TransactionFactory |
getXactFactory() |
Get the Transaction Factory to use with this store.
|
java.lang.Object |
getXAResourceManager() |
|
void |
handleIncompleteDbCryptoOperation(java.util.Properties properties) |
Engine might have crashed during encryption of un-encrypted datbase
or while re-encryptin an already encrypted database with a new key
after all the containers or (re) encrypted.
|
void |
idle() |
Idle the raw store as much as possible.
|
boolean |
isReadOnly() |
Is the store read-only.
|
private static boolean |
isSet(java.util.Properties p,
java.lang.String attribute) |
Tells if the attribute/property has been specified.
|
private static boolean |
isTrue(java.util.Properties p,
java.lang.String attribute) |
Tells if the attribute/property has been set to
true . |
private void |
logHistory(java.io.OutputStreamWriter historyFile,
java.lang.String msg) |
|
StandardException |
markCorrupt(StandardException originalError) |
Mark the module as corrupt.
|
ScanHandle |
openFlushedScan(DatabaseInstant start,
int groupsIWant) |
Get a flushed scan.
|
protected boolean |
privCopyDirectory(java.io.File from,
StorageFile to) |
|
private boolean |
privCopyDirectory(java.io.File from,
StorageFile to,
byte[] buffer,
java.lang.String[] filter) |
|
protected boolean |
privCopyDirectory(StorageFile from,
java.io.File to) |
|
private boolean |
privCopyDirectory(StorageFile from,
java.io.File to,
byte[] buffer,
java.lang.String[] filter,
boolean copySubdirs) |
|
private boolean |
privCopyFile(java.io.File from,
StorageFile to) |
|
private boolean |
privCopyFile(StorageFile from,
java.io.File to) |
|
private boolean |
privCopyFile(StorageFile from,
StorageFile to) |
|
private boolean |
privDelete(java.io.File file) |
|
private boolean |
privDelete(StorageFile file) |
|
private boolean |
privExists(java.io.File file) |
|
private boolean |
privExists(StorageFile file) |
|
private java.io.OutputStreamWriter |
privFileWriter(StorageFile fileName,
boolean append) |
|
private java.lang.String |
privGetCanonicalPath(java.io.File file) |
|
private java.lang.String |
privGetCanonicalPath(StorageFile file) |
|
private java.io.OutputStreamWriter |
privGetOutputStreamWriter(StorageFile file) |
|
private boolean |
privIsDirectory(java.io.File file) |
|
private java.lang.String[] |
privList(StorageFile file) |
|
private boolean |
privMkdirs(java.io.File file) |
|
private boolean |
privRemoveDirectory(java.io.File file) |
|
private boolean |
privRenameTo(java.io.File file1,
java.io.File file2) |
|
int |
random() |
Returns a secure random number for this raw store - if database is not
encrypted, returns 0.
|
private void |
removeCryptoProperties(java.util.Properties properties) |
Removes properties related to encrypted databases.
|
private void |
restoreRemainingFromBackup(java.lang.String backupPath) |
|
java.lang.Object |
run() |
|
void |
setUndoInsertEventHandler(UndoHandler input_undo_handle) |
Register a handler class for insert undo events.
|
private boolean |
setupEncryptionEngines(boolean create,
java.util.Properties properties) |
Setup encryption engines according to the user properties and the
current database state.
|
Transaction |
startGlobalTransaction(ContextManager contextMgr,
int format_id,
byte[] global_id,
byte[] branch_id) |
Create a global user transaction, almost all work within the raw store
is performed in the context of a transaction.
|
Transaction |
startInternalTransaction(ContextManager contextMgr) |
Create an internal transaction.
|
Transaction |
startNestedReadOnlyUserTransaction(Transaction parentTransaction,
CompatibilitySpace compatibilitySpace,
ContextManager contextMgr,
java.lang.String transName) |
Create a nested user transaction, almost all work within the raw store
is performed in the context of a transaction.
|
Transaction |
startNestedUpdateUserTransaction(Transaction parentTransaction,
ContextManager contextMgr,
java.lang.String transName,
boolean flush_log_on_xact_end) |
Create a nested user transaction, almost all work within the raw store
is performed in the context of a transaction.
|
void |
startReplicationMaster(java.lang.String dbmaster,
java.lang.String host,
int port,
java.lang.String replicationMode) |
Start the replication master role for this database
|
private static java.lang.Object |
startSystemModule(java.lang.String factoryInterface) |
Privileged startup.
|
Transaction |
startTransaction(ContextManager contextMgr,
java.lang.String transName) |
Create a user transaction, almost all work within the raw store is
performed in the context of a transaction.
|
void |
stop() |
Stop the module.
|
void |
stopReplicationMaster() |
Stop the replication master role for this database.
|
void |
unfreeze() |
Unfreeze the database after a backup has been taken.
|
void |
unfreezePersistentStore() |
Freeze persistent store.
|
private static final java.lang.String BACKUP_HISTORY
protected TransactionFactory xactFactory
protected DataFactory dataFactory
protected LogFactory logFactory
private SlaveFactory slaveFactory
private StorageFactory storageFactory
private java.security.SecureRandom random
private boolean isEncryptedDatabase
private CipherProvider encryptionEngine
private CipherProvider decryptionEngine
private CipherProvider newEncryptionEngine
private CipherProvider newDecryptionEngine
private CipherFactory currentCipherFactory
private CipherFactory newCipherFactory
private int counter_encrypt
private int counter_decrypt
private int encryptionBlockSize
protected DaemonService rawStoreDaemon
private int actionCode
private static final int FILE_WRITER_ACTION
private StorageFile actionStorageFile
private StorageFile actionToStorageFile
private boolean actionAppend
private static final int REGULAR_FILE_EXISTS_ACTION
private java.io.File actionRegularFile
private static final int STORAGE_FILE_EXISTS_ACTION
private static final int REGULAR_FILE_DELETE_ACTION
private static final int REGULAR_FILE_MKDIRS_ACTION
private static final int REGULAR_FILE_IS_DIRECTORY_ACTION
private static final int REGULAR_FILE_REMOVE_DIRECTORY_ACTION
private static final int REGULAR_FILE_RENAME_TO_ACTION
private java.io.File actionRegularFile2
private static final int COPY_STORAGE_DIRECTORY_TO_REGULAR_ACTION
private byte[] actionBuffer
private java.lang.String[] actionFilter
private boolean actionCopySubDirs
private static final int COPY_REGULAR_DIRECTORY_TO_STORAGE_ACTION
private static final int COPY_REGULAR_FILE_TO_STORAGE_ACTION
private static final int REGULAR_FILE_LIST_DIRECTORY_ACTION
private static final int STORAGE_FILE_LIST_DIRECTORY_ACTION
private static final int COPY_STORAGE_FILE_TO_REGULAR_ACTION
private static final int REGULAR_FILE_GET_CANONICALPATH_ACTION
private static final int STORAGE_FILE_GET_CANONICALPATH_ACTION
private static final int COPY_STORAGE_FILE_TO_STORAGE_ACTION
private static final int STORAGE_FILE_DELETE_ACTION
private static final int README_FILE_OUTPUTSTREAM_WRITER_ACTION
public static final java.lang.String TEST_REENCRYPT_CRASH_BEFORE_COMMT
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_COMMT
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_SWITCH_TO_NEWKEY
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_CHECKPOINT
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_RECOVERY_UNDO_LOGFILE_DELETE
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_RECOVERY_UNDO_REVERTING_KEY
public static final java.lang.String TEST_REENCRYPT_CRASH_BEFORE_RECOVERY_FINAL_CLEANUP
public boolean canSupport(java.util.Properties startParams)
canSupport
in interface ModuleSupportable
public void boot(boolean create, java.util.Properties properties) throws StandardException
ModuleControl
An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.
When create is true the contents of the properties object
will be written to the service.properties of the persistent
service. Thus any code that requires an entry in service.properties
must explicitly place the value in this properties set
using the put method.
Typically the properties object contains one or more default
properties sets, which are not written out to service.properties.
These default sets are how callers modify the create process. In a
JDBC connection database create the first set of defaults is a properties
object that contains the attributes that were set on the jdbc:derby: URL.
This attributes properties set has the second default properties set as
its default. This set (which could be null) contains the properties
that the user set on their DriverManager.getConnection() call, and are thus
not owned by Derby code, and thus must not be modified by Derby
code.
When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases.
Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.
boot
in interface ModuleControl
StandardException
- Module cannot be started.Monitor
,
ModuleFactory
public void stop()
ModuleControl
stop
in interface ModuleControl
Monitor
,
ModuleFactory
public boolean isReadOnly()
isReadOnly
in interface RawStoreFactory
RawStoreFactory.isReadOnly()
public LockFactory getLockFactory()
RawStoreFactory
getLockFactory
in interface RawStoreFactory
public TransactionFactory getXactFactory()
getXactFactory
in interface RawStoreFactory
public void setUndoInsertEventHandler(UndoHandler input_undo_handle) throws StandardException
Register a class to be called when an undo of an insert is executed. When an undo of an event is executed by the raw store UndoHandler.insertUndoNotify() will be called, allowing upper level callers to execute code as necessary. The initial need is for the access layer to be able to queue post commit reclaim space in the case of inserts which are aborted (including the normal case of inserts failed for duplicate key violations) (see DERBY-4057)
setUndoInsertEventHandler
in interface RawStoreFactory
input_undo_handle
- Class to use to notify callers of an undo of
an insert.StandardException
- Standard exception policy.public java.lang.Object getXAResourceManager() throws StandardException
getXAResourceManager
in interface RawStoreFactory
StandardException
public Transaction startGlobalTransaction(ContextManager contextMgr, int format_id, byte[] global_id, byte[] branch_id) throws StandardException
RawStoreFactory
The (format_id, global_id, branch_id) triplet is meant to come exactly from a javax.transaction.xa.Xid. We don't use Xid so that the system can be delivered on a non-1.2 vm system and not require the javax classes in the path.
Starting a transaction always performs the following steps.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
startGlobalTransaction
in interface RawStoreFactory
contextMgr
- is the context manager to use. An exception will be
thrown if context is not the current context.format_id
- the format id part of the Xid - ie. Xid.getFormatId().global_id
- the global transaction identifier part of XID - ie.
Xid.getGlobalTransactionId().branch_id
- The branch qualifier of the Xid - ie.
Xid.getBranchQaulifier()StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
public Transaction startTransaction(ContextManager contextMgr, java.lang.String transName) throws StandardException
RawStoreFactory
Starting a transaction always performs the following steps.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
startTransaction
in interface RawStoreFactory
contextMgr
- is the context manager to use. An exception will be
thrown if context is not the current context.transName
- is the name of the transaction. Thsi name will be displayed
by the transactiontable VTI.StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
public Transaction startNestedReadOnlyUserTransaction(Transaction parentTransaction, CompatibilitySpace compatibilitySpace, ContextManager contextMgr, java.lang.String transName) throws StandardException
RawStoreFactory
A nested user transaction is exactly the same as a user transaction, except that one can specify a compatibility space to associate with the transaction. Starting a transaction always performs the following steps.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
startNestedReadOnlyUserTransaction
in interface RawStoreFactory
parentTransaction
- parent transactioncompatibilitySpace
- compatibility space to use for locks.contextMgr
- is the context manager to use. An exception will be
thrown if context is not the current context.transName
- is the name of the transaction. This name will be
displayed by the transactiontable VTI.StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
public Transaction startNestedUpdateUserTransaction(Transaction parentTransaction, ContextManager contextMgr, java.lang.String transName, boolean flush_log_on_xact_end) throws StandardException
RawStoreFactory
A nested user transaction is exactly the same as a user transaction, except that one can specify a compatibility space to associate with the transaction. Starting a transaction always performs the following steps.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
startNestedUpdateUserTransaction
in interface RawStoreFactory
parentTransaction
- parent transactioncontextMgr
- is the context manager to use. An exception will be
thrown if context is not the current context.transName
- is the name of the transaction. This name will be
displayed by the transactiontable VTI.flush_log_on_xact_end
- By default should the transaction
commit and abort be synced to the log. Normal usage should pick true,
unless there is specific performance need and usage works correctly if
a commit can be lost on system crash.StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
public Transaction findUserTransaction(ContextManager contextMgr, java.lang.String transName) throws StandardException
RawStoreFactory
findUserTransaction
in interface RawStoreFactory
contextMgr
- the context manager to use. An exception will be
thrown if context is not the current context.transName
- If a new transaction is started, it will be given
this name.
The name is displayed in the transactiontable VTI.StandardException
- Standard Derby error policyRawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)
public Transaction startInternalTransaction(ContextManager contextMgr) throws StandardException
RawStoreFactory
Starting an internal transaction always performs the following steps.
AN internal transaction is identical to a user transaction with the exception that
Raw Store Internal Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
startInternalTransaction
in interface RawStoreFactory
StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
public void checkpoint() throws StandardException
RawStoreFactory
checkpoint
in interface RawStoreFactory
StandardException
- Standard Derby error policypublic void startReplicationMaster(java.lang.String dbmaster, java.lang.String host, int port, java.lang.String replicationMode) throws StandardException
startReplicationMaster
in interface RawStoreFactory
dbmaster
- The master database that is being replicated.host
- The hostname for the slaveport
- The port the slave is listening onreplicationMode
- The type of replication contract.
Currently only asynchronous replication is supported, but
1-safe/2-safe/very-safe modes may be added later.StandardException
- 1) If replication is started on a read-only
database
2) If replication is started when unlogged
operations are running
3) If an error occurs while trying to boot
the master.public void stopReplicationMaster() throws StandardException
stopReplicationMaster
in interface RawStoreFactory
StandardException
- Standard Derby exception policy,
thrown on error.public void failover(java.lang.String dbname) throws StandardException
RawStoreFactory
failover
in interface RawStoreFactory
dbname
- the replication database that is being failed over.StandardException
- Standard Derby exception policy,
1) If the failover succeeds, an exception is
thrown to indicate that the master database
was shutdown after a successful failover
2) If a failure occurs during network
communication with slave.public void freeze() throws StandardException
RawStoreFactory
Please see Derby on line documentation on backup and restore.
freeze
in interface RawStoreFactory
StandardException
- Thrown on errorpublic void unfreeze() throws StandardException
RawStoreFactory
Please see Derby on line documentation on backup and restore.
unfreeze
in interface RawStoreFactory
StandardException
- Thrown on errorpublic void backup(java.lang.String backupDir, boolean wait) throws StandardException
backup
in interface RawStoreFactory
backupDir
- the name of the directory where the backup should be
stored. This directory will be created if it
does not exist.wait
- if true, waits for all the backup blocking
operations in progress to finish.StandardException
- thrown on errorpublic void backup(Transaction t, java.io.File backupDir) throws StandardException
StandardException
private void createBackupDirectory(java.io.File dir) throws StandardException
dir
- the directory to createStandardException
- if the directory could not be createdpublic void backupAndEnableLogArchiveMode(java.lang.String backupDir, boolean deleteOnlineArchivedLogFiles, boolean wait) throws StandardException
backupAndEnableLogArchiveMode
in interface RawStoreFactory
backupDir
- the name of the directory where the backup should be
stored. This directory will be created if it
does not exist.deleteOnlineArchivedLogFiles
- If true deletes online archived
log files that exist before this backup, delete
will occur only after the backup is complete.wait
- if true, waits for all the backup blocking
operations in progress to finish.StandardException
- thrown on error.public void disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles) throws StandardException
RawStoreFactory
disableLogArchiveMode
in interface RawStoreFactory
deleteOnlineArchivedLogFiles
- If true deletes all online archived
log files that exist before this
call immediately; Only restore that
can be performed after disabling
log archive mode is version
recovery.StandardException
- Thrown on errorprivate void restoreRemainingFromBackup(java.lang.String backupPath) throws StandardException
StandardException
public void idle() throws StandardException
RawStoreFactory
idle
in interface RawStoreFactory
StandardException
- Standard Derby error policypublic TransactionInfo[] getTransactionInfo()
getTransactionInfo
in interface RawStoreFactory
AccessFactory.getTransactionInfo()
public ScanHandle openFlushedScan(DatabaseInstant start, int groupsIWant) throws StandardException
RawStoreFactory
openFlushedScan
in interface RawStoreFactory
start
- The instant for the beginning of the scan.groupsIWant
- log record groups the caller wants to scan.StandardException
- StandardDerby error policypublic DaemonService getDaemon()
RawStoreFactory
getDaemon
in interface RawStoreFactory
public void createFinished() throws StandardException
createFinished
in interface RawStoreFactory
StandardException
public void getRawStoreProperties(PersistentSet set) throws StandardException
getRawStoreProperties
in interface RawStoreFactory
StandardException
- Standard Derby Error Policypublic void freezePersistentStore() throws StandardException
freezePersistentStore
in interface RawStoreFactory
StandardException
- Standard Derby Error Policypublic void unfreezePersistentStore() throws StandardException
unfreezePersistentStore
in interface RawStoreFactory
StandardException
- Standard Derby Error Policyprivate boolean setupEncryptionEngines(boolean create, java.util.Properties properties) throws StandardException
create
- whether a new database is being created, or if this is
an existing databaseproperties
- database properties, including connection attributestrue
if the existing data in the database should be
transformed by applying a cryptographic operation.StandardException
- if the properties are conflicting, if the
requested configuration is denied, or if something else goes wrongpublic int encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset, boolean newEngine) throws StandardException
encrypt
in interface RawStoreFactory
StandardException
- Standard Derby Error PolicyCipherProvider.encrypt(byte[], int, int, byte[], int)
public int decrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset) throws StandardException
decrypt
in interface RawStoreFactory
StandardException
- Standard Derby Error PolicyCipherProvider.decrypt(byte[], int, int, byte[], int)
public int getEncryptionBlockSize()
getEncryptionBlockSize
in interface RawStoreFactory
public int random()
RawStoreFactory
random
in interface RawStoreFactory
public java.io.Serializable changeBootPassword(java.util.Properties properties, java.io.Serializable changePassword) throws StandardException
RawStoreFactory
changeBootPassword
in interface RawStoreFactory
StandardException
- Standard Derby Error Policyprivate void crashOnDebugFlag(java.lang.String debugFlag, boolean reEncrypt) throws StandardException
StandardException
private void applyBulkCryptoOperation(java.util.Properties properties, CipherFactory newCipherFactory) throws StandardException
StandardException
public void handleIncompleteDbCryptoOperation(java.util.Properties properties) throws StandardException
properties
- properties related to this database.StandardException
- Standard Derby Error Policyprivate void cryptoOperationAllowed(boolean reEncrypt, boolean decrypt) throws StandardException
reEncrypt
- true
if the database is getting encrypted with
a new password/keydecrypt
- true
if the database is getting decryptedStandardException
- if there is global transaction in the prepared state or
if the database is not at the required version or above,
this feature is not supported or
if the log is archived for the database.public StandardException markCorrupt(StandardException originalError)
Corruptable
markCorrupt
in interface Corruptable
public java.lang.String getTransactionFactoryModule()
getTransactionFactoryModule
in interface RawStoreFactory
public java.lang.String getSlaveFactoryModule()
public java.lang.String getMasterFactoryModule()
public java.lang.String getDataFactoryModule()
getDataFactoryModule
in interface RawStoreFactory
public java.lang.String getLogFactoryModule()
getLogFactoryModule
in interface RawStoreFactory
private void logHistory(java.io.OutputStreamWriter historyFile, java.lang.String msg) throws java.io.IOException
java.io.IOException
private java.lang.String getFilePath(StorageFile file)
private java.lang.String getFilePath(java.io.File file)
protected boolean privCopyDirectory(StorageFile from, java.io.File to) throws StandardException
StandardException
protected boolean privCopyDirectory(java.io.File from, StorageFile to)
public long getMaxContainerId() throws StandardException
Return an id number with is greater than any existing container in the current database. Caller will use this to allocate future container numbers - most likely caching the value and then incrementing it as it is used.
getMaxContainerId
in interface RawStoreFactory
StandardException
- Standard exception policy.public boolean checkVersion(int requiredMajorVersion, int requiredMinorVersion, java.lang.String feature) throws StandardException
checkVersion
in interface RawStoreFactory
requiredMajorVersion
- required database Engine major versionrequiredMinorVersion
- required database Engine minor versionfeature
- Non-null to throw an exception, null to
return the state of the version match. true
if the database has been upgraded to
the required level, false
otherwise.StandardException
- if the database is not at the require version
when feature
feature is
not null
.private void removeCryptoProperties(java.util.Properties properties)
properties
- property set to remove fromprivate java.io.OutputStreamWriter privFileWriter(StorageFile fileName, boolean append) throws java.io.IOException
java.io.IOException
private boolean privExists(java.io.File file)
private boolean privExists(StorageFile file)
private java.io.OutputStreamWriter privGetOutputStreamWriter(StorageFile file) throws java.io.IOException
java.io.IOException
private boolean privDelete(java.io.File file)
private boolean privDelete(StorageFile file)
private boolean privMkdirs(java.io.File file) throws java.io.IOException
java.io.IOException
private boolean privIsDirectory(java.io.File file)
private boolean privRemoveDirectory(java.io.File file)
private boolean privRenameTo(java.io.File file1, java.io.File file2)
private boolean privCopyDirectory(StorageFile from, java.io.File to, byte[] buffer, java.lang.String[] filter, boolean copySubdirs) throws StandardException
StandardException
private boolean privCopyDirectory(java.io.File from, StorageFile to, byte[] buffer, java.lang.String[] filter)
private boolean privCopyFile(java.io.File from, StorageFile to)
private boolean privCopyFile(StorageFile from, java.io.File to) throws StandardException
StandardException
private boolean privCopyFile(StorageFile from, StorageFile to)
private java.lang.String[] privList(StorageFile file)
private java.lang.String privGetCanonicalPath(StorageFile file)
private java.lang.String privGetCanonicalPath(java.io.File file)
public final java.lang.Object run() throws java.io.IOException, StandardException
run
in interface java.security.PrivilegedExceptionAction<java.lang.Object>
java.io.IOException
StandardException
private static boolean isSet(java.util.Properties p, java.lang.String attribute)
private static boolean isTrue(java.util.Properties p, java.lang.String attribute)
true
.public void createDataWarningFile() throws StandardException
RawStoreFactory
createDataWarningFile
in interface RawStoreFactory
StandardException
RawStoreFactory.createDataWarningFile()
private static ContextService getContextService()
private static Context getContextOrNull(java.lang.String contextID)
private static ModuleFactory getMonitor()
private static java.lang.String getServiceName(java.lang.Object serviceModule)
private static java.lang.Object startSystemModule(java.lang.String factoryInterface) throws StandardException
StandardException
private static java.lang.Object bootServiceModule(boolean create, java.lang.Object serviceModule, java.lang.String factoryInterface, java.util.Properties properties) throws StandardException
StandardException
private static java.lang.Object findServiceModule(java.lang.Object serviceModule, java.lang.String factoryInterface) throws StandardException
StandardException
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.