|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.store.raw.RawStore
A Raw store that implements the RawStoreFactory module by delegating all the work to the lower modules TransactionFactory, LogFactory and DataFactory.
String TransactionFactoryId=
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 |
private static final java.lang.String BACKUP_HISTORY
private static final java.lang.String[] BACKUP_FILTER
protected TransactionFactory xactFactory
protected DataFactory dataFactory
protected LogFactory logFactory
private StorageFactory storageFactory
private java.security.SecureRandom random
private boolean databaseEncrypted
private CipherProvider encryptionEngine
private CipherProvider decryptionEngine
private CipherFactory cipherFactory
private int counter_encrypt
private int counter_decrypt
private int encryptionBlockSize
java.lang.String dataDirectory
protected DaemonService rawStoreDaemon
private int actionCode
private static final int FILE_WRITER_ACTION
private StorageFile actionStorageFile
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 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
Constructor Detail |
public RawStore()
Method Detail |
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 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.
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 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 Cloudscape 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 Cloudscape error policyTransaction
,
Context
,
StandardException
public Transaction startNestedReadOnlyUserTransaction(java.lang.Object 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
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.
StandardException
- Standard Cloudscape error policyTransaction
,
Context
,
StandardException
public Transaction startNestedUpdateUserTransaction(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:
startNestedUpdateUserTransaction
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. This name will be
displayed by the transactiontable VTI.
StandardException
- Standard Cloudscape 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 Cloudscape 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 Cloudscape error policyTransaction
,
Context
,
StandardException
public void checkpoint() throws StandardException
RawStoreFactory
checkpoint
in interface RawStoreFactory
StandardException
- Standard Cloudscape error policypublic void freeze() throws StandardException
RawStoreFactory
Please see cloudscape on line documentation on backup and restore.
freeze
in interface RawStoreFactory
StandardException
- Thrown on errorpublic void unfreeze() throws StandardException
RawStoreFactory
Please see cloudscape on line documentation on backup and restore.
unfreeze
in interface RawStoreFactory
StandardException
- Thrown on errorpublic void backup(java.lang.String backupDir) throws StandardException
RawStoreFactory
Please see cloudscape on line documentation on backup and restore.
backup
in interface RawStoreFactory
backupDir
- the name of the directory where the backup should be
stored.
StandardException
- Thrown on errorpublic void backup(java.io.File backupDir) throws StandardException
RawStoreFactory
Please see cloudscape on line documentation on backup and restore.
backup
in interface RawStoreFactory
backupDir
- the directory where the backup should be stored.
StandardException
- Thrown on errorpublic void backupAndEnableLogArchiveMode(java.lang.String backupDir, boolean deleteOnlineArchivedLogFiles) throws StandardException
RawStoreFactory
backupAndEnableLogArchiveMode
in interface RawStoreFactory
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.
StandardException
- Thrown on errorpublic void backupAndEnableLogArchiveMode(java.io.File backupDir, boolean deleteOnlineArchivedLogFiles) throws StandardException
RawStoreFactory
backupAndEnableLogArchiveMode
in interface RawStoreFactory
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.
StandardException
- Thrown on errorprivate void enableLogArchiveMode() throws StandardException
StandardException
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 Cloudscape 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
- StandardCloudscape 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 Cloudscape Error Policypublic void freezePersistentStore() throws StandardException
freezePersistentStore
in interface RawStoreFactory
StandardException
- Standard Cloudscape Error Policypublic void unfreezePersistentStore() throws StandardException
unfreezePersistentStore
in interface RawStoreFactory
StandardException
- Standard Cloudscape Error Policypublic int encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset) throws StandardException
encrypt
in interface RawStoreFactory
StandardException
- Standard Cloudscape 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 Cloudscape 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 Cloudscape Error Policypublic StandardException markCorrupt(StandardException originalError)
Corruptable
markCorrupt
in interface Corruptable
public java.lang.String getTransactionFactoryModule()
getTransactionFactoryModule
in interface RawStoreFactory
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
protected boolean privCopyDirectory(StorageFile from, java.io.File to)
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.private java.io.OutputStreamWriter privFileWriter(StorageFile fileName, boolean append) throws java.io.IOException
java.io.IOException
protected boolean privExists(java.io.File file)
protected boolean privExists(StorageFile file)
protected boolean privDelete(java.io.File file)
protected boolean privMkdirs(java.io.File file)
protected boolean privIsDirectory(java.io.File file)
protected boolean privRemoveDirectory(java.io.File file)
protected boolean privRenameTo(java.io.File file1, java.io.File file2)
protected boolean privCopyDirectory(StorageFile from, java.io.File to, byte[] buffer, java.lang.String[] filter)
protected boolean privCopyDirectory(java.io.File from, StorageFile to, byte[] buffer, java.lang.String[] filter)
protected boolean privCopyFile(java.io.File from, StorageFile to)
protected java.lang.String[] privList(java.io.File file)
public java.lang.Object run() throws java.io.IOException
run
in interface java.security.PrivilegedExceptionAction
java.io.IOException
|
Built on Tue 2006-10-10 19:23:47+0200, from revision exported | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |