org.apache.derby.impl.store.raw
Class RawStore

java.lang.Object
  extended byorg.apache.derby.impl.store.raw.RawStore
All Implemented Interfaces:
Corruptable, ModuleControl, ModuleSupportable, java.security.PrivilegedExceptionAction, RawStoreFactory

public class RawStore
extends java.lang.Object
implements RawStoreFactory, ModuleControl, ModuleSupportable, java.security.PrivilegedExceptionAction

A Raw store that implements the RawStoreFactory module by delegating all the work to the lower modules TransactionFactory, LogFactory and DataFactory.

        String TransactionFactoryId=
        


Field Summary
private  boolean actionAppend
           
private  byte[] actionBuffer
           
private  int actionCode
           
private  java.lang.String[] actionFilter
           
private  java.io.File actionRegularFile
           
private  java.io.File actionRegularFile2
           
private  StorageFile actionStorageFile
           
private static java.lang.String[] BACKUP_FILTER
           
private static java.lang.String BACKUP_HISTORY
           
private  CipherFactory cipherFactory
           
private static int COPY_REGULAR_DIRECTORY_TO_STORAGE_ACTION
           
private static int COPY_REGULAR_FILE_TO_STORAGE_ACTION
           
private static int COPY_STORAGE_DIRECTORY_TO_REGULAR_ACTION
           
private  int counter_decrypt
           
private  int counter_encrypt
           
private  boolean databaseEncrypted
           
(package private)  java.lang.String dataDirectory
           
protected  DataFactory dataFactory
           
private  CipherProvider decryptionEngine
           
private  int encryptionBlockSize
           
private  CipherProvider encryptionEngine
           
private static int FILE_WRITER_ACTION
           
protected  LogFactory logFactory
           
private  java.security.SecureRandom random
           
protected  DaemonService rawStoreDaemon
           
private static int REGULAR_FILE_DELETE_ACTION
           
private static int REGULAR_FILE_EXISTS_ACTION
           
private static int REGULAR_FILE_IS_DIRECTORY_ACTION
           
private static int REGULAR_FILE_LIST_DIRECTORY_ACTION
           
private static int REGULAR_FILE_MKDIRS_ACTION
           
private static int REGULAR_FILE_REMOVE_DIRECTORY_ACTION
           
private static int REGULAR_FILE_RENAME_TO_ACTION
           
private static int STORAGE_FILE_EXISTS_ACTION
           
private  StorageFactory storageFactory
           
protected  TransactionFactory xactFactory
           
 
Fields inherited from interface org.apache.derby.iapi.store.raw.RawStoreFactory
CONTAINER_INITIAL_PAGES, DATA_ENCRYPT_ALGORITHM_VERSION, DEFAULT_ENCRYPTION_BLOCKSIZE, DERBY_STORE_MAJOR_VERSION_10, DERBY_STORE_MINOR_VERSION_1, 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, 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 Summary
RawStore()
           
 
Method Summary
 void backup(java.io.File backupDir)
          Backup the database to backupDir.
 void backup(java.lang.String backupDir)
          Backup the database to backupDir.
 void backupAndEnableLogArchiveMode(java.io.File backupDir, boolean deleteOnlineArchivedLogFiles)
          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 backupAndEnableLogArchiveMode(java.lang.String backupDir, boolean deleteOnlineArchivedLogFiles)
          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.
 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()
          Try to checkpoint the database to minimize recovery time.
 void createFinished()
           
 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.
private  void enableLogArchiveMode()
           
 int encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset)
          Encrypt cleartext into ciphertext.
 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.
 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
 LockFactory getLockFactory()
          Get the LockFactory to use with this store.
 java.lang.String getLogFactoryModule()
           
 long getMaxContainerId()
          Return an id which can be used to create a container.
 void getRawStoreProperties(PersistentSet set)
          Get JBMS properties relavent to raw store
 java.lang.String getTransactionFactoryModule()
           
 TransactionInfo[] getTransactionInfo()
           
 java.lang.Object getXAResourceManager()
           
 void idle()
          Idle the raw store as much as possible.
 boolean isReadOnly()
          Is the store read-only.
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)
           
protected  boolean privCopyDirectory(java.io.File from, StorageFile to, byte[] buffer, java.lang.String[] filter)
           
protected  boolean privCopyDirectory(StorageFile from, java.io.File to)
           
protected  boolean privCopyDirectory(StorageFile from, java.io.File to, byte[] buffer, java.lang.String[] filter)
           
protected  boolean privCopyFile(java.io.File from, StorageFile to)
           
protected  boolean privDelete(java.io.File file)
           
protected  boolean privExists(java.io.File file)
           
protected  boolean privExists(StorageFile file)
           
private  java.io.OutputStreamWriter privFileWriter(StorageFile fileName, boolean append)
           
protected  boolean privIsDirectory(java.io.File file)
           
protected  java.lang.String[] privList(java.io.File file)
           
protected  boolean privMkdirs(java.io.File file)
           
protected  boolean privRemoveDirectory(java.io.File file)
           
protected  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 restoreRemainingFromBackup(java.lang.String backupPath)
           
 java.lang.Object run()
           
 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(java.lang.Object 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(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 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 unfreeze()
          Unfreeze the database after a backup has been taken.
 void unfreezePersistentStore()
          Freeze persistent store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BACKUP_HISTORY

private static final java.lang.String BACKUP_HISTORY
See Also:
Constant Field Values

BACKUP_FILTER

private static final java.lang.String[] BACKUP_FILTER

xactFactory

protected TransactionFactory xactFactory

dataFactory

protected DataFactory dataFactory

logFactory

protected LogFactory logFactory

storageFactory

private StorageFactory storageFactory

random

private java.security.SecureRandom random

databaseEncrypted

private boolean databaseEncrypted

encryptionEngine

private CipherProvider encryptionEngine

decryptionEngine

private CipherProvider decryptionEngine

cipherFactory

private CipherFactory cipherFactory

counter_encrypt

private int counter_encrypt

counter_decrypt

private int counter_decrypt

encryptionBlockSize

private int encryptionBlockSize

dataDirectory

java.lang.String dataDirectory

rawStoreDaemon

protected DaemonService rawStoreDaemon

actionCode

private int actionCode

FILE_WRITER_ACTION

private static final int FILE_WRITER_ACTION
See Also:
Constant Field Values

actionStorageFile

private StorageFile actionStorageFile

actionAppend

private boolean actionAppend

REGULAR_FILE_EXISTS_ACTION

private static final int REGULAR_FILE_EXISTS_ACTION
See Also:
Constant Field Values

actionRegularFile

private java.io.File actionRegularFile

STORAGE_FILE_EXISTS_ACTION

private static final int STORAGE_FILE_EXISTS_ACTION
See Also:
Constant Field Values

REGULAR_FILE_DELETE_ACTION

private static final int REGULAR_FILE_DELETE_ACTION
See Also:
Constant Field Values

REGULAR_FILE_MKDIRS_ACTION

private static final int REGULAR_FILE_MKDIRS_ACTION
See Also:
Constant Field Values

REGULAR_FILE_IS_DIRECTORY_ACTION

private static final int REGULAR_FILE_IS_DIRECTORY_ACTION
See Also:
Constant Field Values

REGULAR_FILE_REMOVE_DIRECTORY_ACTION

private static final int REGULAR_FILE_REMOVE_DIRECTORY_ACTION
See Also:
Constant Field Values

REGULAR_FILE_RENAME_TO_ACTION

private static final int REGULAR_FILE_RENAME_TO_ACTION
See Also:
Constant Field Values

actionRegularFile2

private java.io.File actionRegularFile2

COPY_STORAGE_DIRECTORY_TO_REGULAR_ACTION

private static final int COPY_STORAGE_DIRECTORY_TO_REGULAR_ACTION
See Also:
Constant Field Values

actionBuffer

private byte[] actionBuffer

actionFilter

private java.lang.String[] actionFilter

COPY_REGULAR_DIRECTORY_TO_STORAGE_ACTION

private static final int COPY_REGULAR_DIRECTORY_TO_STORAGE_ACTION
See Also:
Constant Field Values

COPY_REGULAR_FILE_TO_STORAGE_ACTION

private static final int COPY_REGULAR_FILE_TO_STORAGE_ACTION
See Also:
Constant Field Values

REGULAR_FILE_LIST_DIRECTORY_ACTION

private static final int REGULAR_FILE_LIST_DIRECTORY_ACTION
See Also:
Constant Field Values
Constructor Detail

RawStore

public RawStore()
Method Detail

canSupport

public boolean canSupport(java.util.Properties startParams)
We use this RawStore for all databases.

Specified by:
canSupport in interface ModuleSupportable
Returns:
true if this instance can be used, false otherwise.

boot

public void boot(boolean create,
                 java.util.Properties properties)
          throws StandardException
Description copied from interface: ModuleControl
Boot this module with the given properties. Creates a module instance that can be found using the findModule() methods of Monitor. The module can only be found using one of these findModule() methods once this method has returned.

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 cloudscape code, and thus must not be modified by cloudscape 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.

Specified by:
boot in interface ModuleControl
Throws:
StandardException - Module cannot be started.
See Also:
Monitor, ModuleFactory

stop

public void stop()
Description copied from interface: ModuleControl
Stop the module. The module may be found via a findModule() method until some time after this method returns. Therefore the factory must be prepared to reject requests to it once it has been stopped. In addition other modules may cache a reference to the module and make requests of it after it has been stopped, these requests should be rejected as well.

Specified by:
stop in interface ModuleControl
See Also:
Monitor, ModuleFactory

isReadOnly

public boolean isReadOnly()
Is the store read-only.

Specified by:
isReadOnly in interface RawStoreFactory
See Also:
RawStoreFactory.isReadOnly()

getLockFactory

public LockFactory getLockFactory()
Description copied from interface: RawStoreFactory
Get the LockFactory to use with this store.

Specified by:
getLockFactory in interface RawStoreFactory

getXAResourceManager

public java.lang.Object getXAResourceManager()
                                      throws StandardException
Specified by:
getXAResourceManager in interface RawStoreFactory
Throws:
StandardException

startGlobalTransaction

public Transaction startGlobalTransaction(ContextManager contextMgr,
                                          int format_id,
                                          byte[] global_id,
                                          byte[] branch_id)
                                   throws StandardException
Description copied from interface: RawStoreFactory
Create a global user transaction, almost all work within the raw store is performed in the context of a transaction.

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.

  1. Create an raw store transaction context
  2. Create a new idle transaction and then link it to the context. Only one user transaction can be active in a context at any one time. After a commit the transaction may be re-used.

    Raw Store Transaction Context Behaviour
    The cleanupOnError() method of this context behaves as follows:

    • If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then no action is taken.
    • If error is an instance of StandardException that has a severity equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, and the transaction returned to the idle state.
    • If error is an instance of StandardException that has a severity greater than ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
    • If error is not an instance of StandardException then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.

    Specified by:
    startGlobalTransaction in interface RawStoreFactory
    Parameters:
    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()
    Throws:
    StandardException - Standard Cloudscape error policy
    See Also:
    Transaction, Context, StandardException

startTransaction

public Transaction startTransaction(ContextManager contextMgr,
                                    java.lang.String transName)
                             throws StandardException
Description copied from interface: RawStoreFactory
Create a user transaction, almost all work within the raw store is performed in the context of a transaction.

Starting a transaction always performs the following steps.

  1. Create an raw store transaction context
  2. Create a new idle transaction and then link it to the context. Only one user transaction and one nested user transaction can be active in a context at any one time. After a commit the transaction may be re-used.

    Raw Store Transaction Context Behaviour
    The cleanupOnError() method of this context behaves as follows:

    • If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then no action is taken.
    • If error is an instance of StandardException that has a severity equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, and the transaction returned to the idle state.
    • If error is an instance of StandardException that has a severity greater than ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
    • If error is not an instance of StandardException then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.

    Specified by:
    startTransaction in interface RawStoreFactory
    Parameters:
    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.
    Throws:
    StandardException - Standard Cloudscape error policy
    See Also:
    Transaction, Context, StandardException

startNestedReadOnlyUserTransaction

public Transaction startNestedReadOnlyUserTransaction(java.lang.Object compatibilitySpace,
                                                      ContextManager contextMgr,
                                                      java.lang.String transName)
                                               throws StandardException
Description copied from interface: RawStoreFactory
Create a nested user transaction, almost all work within the raw store is performed in the context of a transaction.

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.

  1. Create an raw store transaction context
  2. Create a new idle transaction and then link it to the context. Only one user transaction and one nested user transaction can be active in a context at any one time. After a commit the transaction may be re-used.

    Raw Store Transaction Context Behaviour
    The cleanupOnError() method of this context behaves as follows:

    • If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then no action is taken.
    • If error is an instance of StandardException that has a severity equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, and the transaction returned to the idle state. If a user transaction exists on the context stack then that transaction is aborted also.
    • If error is an instance of StandardException that has a severity greater than ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
    • If error is not an instance of StandardException then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.

    Specified by:
    startNestedReadOnlyUserTransaction in interface RawStoreFactory
    Parameters:
    compatibilitySpace - 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.
    Throws:
    StandardException - Standard Cloudscape error policy
    See Also:
    Transaction, Context, StandardException

startNestedUpdateUserTransaction

public Transaction startNestedUpdateUserTransaction(ContextManager contextMgr,
                                                    java.lang.String transName)
                                             throws StandardException
Description copied from interface: RawStoreFactory
Create a nested user transaction, almost all work within the raw store is performed in the context of a transaction.

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.

  1. Create an raw store transaction context
  2. Create a new idle transaction and then link it to the context. Only one user transaction and one nested user transaction can be active in a context at any one time. After a commit the transaction may be re-used.

    Raw Store Transaction Context Behaviour
    The cleanupOnError() method of this context behaves as follows:

    • If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then no action is taken.
    • If error is an instance of StandardException that has a severity equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, and the transaction returned to the idle state. If a user transaction exists on the context stack then that transaction is aborted also.
    • If error is an instance of StandardException that has a severity greater than ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
    • If error is not an instance of StandardException then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.

    Specified by:
    startNestedUpdateUserTransaction in interface RawStoreFactory
    Parameters:
    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.
    Throws:
    StandardException - Standard Cloudscape error policy
    See Also:
    Transaction, Context, StandardException

findUserTransaction

public Transaction findUserTransaction(ContextManager contextMgr,
                                       java.lang.String transName)
                                throws StandardException
Description copied from interface: RawStoreFactory
Find a user transaction in the context manager, which must be the current context manager. If a user transaction does not already exist, then create one @see #startTransaction

Specified by:
findUserTransaction in interface RawStoreFactory
Parameters:
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.
Throws:
StandardException - Standard Cloudscape error policy
See Also:
RawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)

startInternalTransaction

public Transaction startInternalTransaction(ContextManager contextMgr)
                                     throws StandardException
Description copied from interface: RawStoreFactory
Create an internal transaction.

Starting an internal transaction always performs the following steps.

  1. Create an raw store internal transaction context
  2. Create a new idle internal transaction and then link it to the context.

    AN internal transaction is identical to a user transaction with the exception that

    • Logical operations are not supported
    • Savepoints are not supported
    • Containers are not closed when commit() is called.
    • Pages are not unlatched (since containers are not closed) when commit() is called.
    • During recovery time internal transactions are rolled back before user transactions.
    Only one internal transaction can be active in a context at any one time. After a commit the transaction may be re-used.

    Raw Store Internal Transaction Context Behaviour
    The cleanupOnError() method of this context behaves as follows:

    • If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then the internal transaction is aborted, the internal transaction is closed, the context is popped off the stack, and an exception of severity Transaction exception is re-thrown.
    • If error is an instance of StandardException that has a severity greater than or equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's internal transaction is aborted, the internal transaction is closed and the context is popped off the stack.
    • If error is not an instance of StandardException then the context's internal transaction is aborted, the internal transaction is closed and the context is popped off the stack.

    Specified by:
    startInternalTransaction in interface RawStoreFactory
    Throws:
    StandardException - Standard Cloudscape error policy
    See Also:
    Transaction, Context, StandardException

checkpoint

public void checkpoint()
                throws StandardException
Description copied from interface: RawStoreFactory
Try to checkpoint the database to minimize recovery time. The raw store does not guarentee that a checkpoint will indeed have happened by the time this routine returns.

Specified by:
checkpoint in interface RawStoreFactory
Throws:
StandardException - Standard Cloudscape error policy

freeze

public void freeze()
            throws StandardException
Description copied from interface: RawStoreFactory
Freeze the database temporarily so a backup can be taken.

Please see cloudscape on line documentation on backup and restore.

Specified by:
freeze in interface RawStoreFactory
Throws:
StandardException - Thrown on error

unfreeze

public void unfreeze()
              throws StandardException
Description copied from interface: RawStoreFactory
Unfreeze the database after a backup has been taken.

Please see cloudscape on line documentation on backup and restore.

Specified by:
unfreeze in interface RawStoreFactory
Throws:
StandardException - Thrown on error

backup

public void backup(java.lang.String backupDir)
            throws StandardException
Description copied from interface: RawStoreFactory
Backup the database to backupDir.

Please see cloudscape on line documentation on backup and restore.

Specified by:
backup in interface RawStoreFactory
Parameters:
backupDir - the name of the directory where the backup should be stored.
Throws:
StandardException - Thrown on error

backup

public void backup(java.io.File backupDir)
            throws StandardException
Description copied from interface: RawStoreFactory
Backup the database to backupDir.

Please see cloudscape on line documentation on backup and restore.

Specified by:
backup in interface RawStoreFactory
Parameters:
backupDir - the directory where the backup should be stored.
Throws:
StandardException - Thrown on error

backupAndEnableLogArchiveMode

public void backupAndEnableLogArchiveMode(java.lang.String backupDir,
                                          boolean deleteOnlineArchivedLogFiles)
                                   throws StandardException
Description copied from interface: RawStoreFactory
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.

Specified by:
backupAndEnableLogArchiveMode in interface RawStoreFactory
Parameters:
backupDir - the directory name where the database backup should go. This directory will be created if not it does not exist.
deleteOnlineArchivedLogFiles - If true deletes online archived log files that exist before this backup, delete will occur only after backup is complete.
Throws:
StandardException - Thrown on error

backupAndEnableLogArchiveMode

public void backupAndEnableLogArchiveMode(java.io.File backupDir,
                                          boolean deleteOnlineArchivedLogFiles)
                                   throws StandardException
Description copied from interface: RawStoreFactory
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.

Specified by:
backupAndEnableLogArchiveMode in interface RawStoreFactory
Parameters:
backupDir - the directory name where the database backup should go. This directory will be created if not it does not exist.
deleteOnlineArchivedLogFiles - If true deletes online archived log files that exist before this backup, delete will occur only after backup is complete.
Throws:
StandardException - Thrown on error

enableLogArchiveMode

private void enableLogArchiveMode()
                           throws StandardException
Throws:
StandardException

disableLogArchiveMode

public void disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles)
                           throws StandardException
Description copied from interface: RawStoreFactory
disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.

Specified by:
disableLogArchiveMode in interface RawStoreFactory
Parameters:
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.
Throws:
StandardException - Thrown on error

restoreRemainingFromBackup

private void restoreRemainingFromBackup(java.lang.String backupPath)
                                 throws StandardException
Throws:
StandardException

idle

public void idle()
          throws StandardException
Description copied from interface: RawStoreFactory
Idle the raw store as much as possible.

Specified by:
idle in interface RawStoreFactory
Throws:
StandardException - Standard Cloudscape error policy

getTransactionInfo

public TransactionInfo[] getTransactionInfo()
Specified by:
getTransactionInfo in interface RawStoreFactory
See Also:
AccessFactory.getTransactionInfo()

openFlushedScan

public ScanHandle openFlushedScan(DatabaseInstant start,
                                  int groupsIWant)
                           throws StandardException
Description copied from interface: RawStoreFactory
Get a flushed scan.

Specified by:
openFlushedScan in interface RawStoreFactory
Parameters:
start - The instant for the beginning of the scan.
groupsIWant - log record groups the caller wants to scan.
Throws:
StandardException - StandardCloudscape error policy

getDaemon

public DaemonService getDaemon()
Description copied from interface: RawStoreFactory
If this raw store has a daemon that services its need, return the daemon. If not, return null

Specified by:
getDaemon in interface RawStoreFactory

createFinished

public void createFinished()
                    throws StandardException
Specified by:
createFinished in interface RawStoreFactory
Throws:
StandardException

getRawStoreProperties

public void getRawStoreProperties(PersistentSet set)
                           throws StandardException
Get JBMS properties relavent to raw store

Specified by:
getRawStoreProperties in interface RawStoreFactory
Throws:
StandardException - Standard Cloudscape Error Policy

freezePersistentStore

public void freezePersistentStore()
                           throws StandardException
Freeze persistent store. Reads can still happen, only cannot write.

Specified by:
freezePersistentStore in interface RawStoreFactory
Throws:
StandardException - Standard Cloudscape Error Policy

unfreezePersistentStore

public void unfreezePersistentStore()
                             throws StandardException
Freeze persistent store. Reads can still happen, only cannot write.

Specified by:
unfreezePersistentStore in interface RawStoreFactory
Throws:
StandardException - Standard Cloudscape Error Policy

encrypt

public int encrypt(byte[] cleartext,
                   int offset,
                   int length,
                   byte[] ciphertext,
                   int outputOffset)
            throws StandardException
Encrypt cleartext into ciphertext.

Specified by:
encrypt in interface RawStoreFactory
Throws:
StandardException - Standard Cloudscape Error Policy
See Also:
CipherProvider.encrypt(byte[], int, int, byte[], int)

decrypt

public int decrypt(byte[] ciphertext,
                   int offset,
                   int length,
                   byte[] cleartext,
                   int outputOffset)
            throws StandardException
Decrypt cleartext from ciphertext.

Specified by:
decrypt in interface RawStoreFactory
Throws:
StandardException - Standard Cloudscape Error Policy
See Also:
CipherProvider.decrypt(byte[], int, int, byte[], int)

getEncryptionBlockSize

public int getEncryptionBlockSize()
Returns the encryption block size used by the algorithm at time of creation of an encrypted database

Specified by:
getEncryptionBlockSize in interface RawStoreFactory

random

public int random()
Description copied from interface: RawStoreFactory
Returns a secure random number for this raw store - if database is not encrypted, returns 0.

Specified by:
random in interface RawStoreFactory

changeBootPassword

public java.io.Serializable changeBootPassword(java.util.Properties properties,
                                               java.io.Serializable changePassword)
                                        throws StandardException
Description copied from interface: RawStoreFactory
Change the boot password. Return the encrypted form of the secret key. The new value must be a String of the form: oldBootPassword, newBootPassword

Specified by:
changeBootPassword in interface RawStoreFactory
Throws:
StandardException - Standard Cloudscape Error Policy

markCorrupt

public StandardException markCorrupt(StandardException originalError)
Description copied from interface: Corruptable
Mark the module as corrupt. It is safe to call this multiple times.

Specified by:
markCorrupt in interface Corruptable
Returns:
Must always return its parameter.

getTransactionFactoryModule

public java.lang.String getTransactionFactoryModule()
Specified by:
getTransactionFactoryModule in interface RawStoreFactory

getDataFactoryModule

public java.lang.String getDataFactoryModule()
Specified by:
getDataFactoryModule in interface RawStoreFactory

getLogFactoryModule

public java.lang.String getLogFactoryModule()
Specified by:
getLogFactoryModule in interface RawStoreFactory

logHistory

private void logHistory(java.io.OutputStreamWriter historyFile,
                        java.lang.String msg)
                 throws java.io.IOException
Throws:
java.io.IOException

privCopyDirectory

protected boolean privCopyDirectory(StorageFile from,
                                    java.io.File to)

privCopyDirectory

protected boolean privCopyDirectory(java.io.File from,
                                    StorageFile to)

getMaxContainerId

public long getMaxContainerId()
                       throws StandardException
Return an id which can be used to create a container.

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.

Specified by:
getMaxContainerId in interface RawStoreFactory
Returns:
The an id which can be used to create a container.
Throws:
StandardException - Standard exception policy.

privFileWriter

private java.io.OutputStreamWriter privFileWriter(StorageFile fileName,
                                                  boolean append)
                                           throws java.io.IOException
Throws:
java.io.IOException

privExists

protected boolean privExists(java.io.File file)

privExists

protected boolean privExists(StorageFile file)

privDelete

protected boolean privDelete(java.io.File file)

privMkdirs

protected boolean privMkdirs(java.io.File file)

privIsDirectory

protected boolean privIsDirectory(java.io.File file)

privRemoveDirectory

protected boolean privRemoveDirectory(java.io.File file)

privRenameTo

protected boolean privRenameTo(java.io.File file1,
                               java.io.File file2)

privCopyDirectory

protected boolean privCopyDirectory(StorageFile from,
                                    java.io.File to,
                                    byte[] buffer,
                                    java.lang.String[] filter)

privCopyDirectory

protected boolean privCopyDirectory(java.io.File from,
                                    StorageFile to,
                                    byte[] buffer,
                                    java.lang.String[] filter)

privCopyFile

protected boolean privCopyFile(java.io.File from,
                               StorageFile to)

privList

protected java.lang.String[] privList(java.io.File file)

run

public java.lang.Object run()
                     throws java.io.IOException
Specified by:
run in interface java.security.PrivilegedExceptionAction
Throws:
java.io.IOException

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.