Interface AccessFactory
- All Known Implementing Classes:
RAMAccessManager
,RllRAMAccessManager
An AccessFactory is typically obtained from the Monitor:
// Get the current transaction controller. AccessFactory af; af = (AccessFactory) Monitor.findServiceModule(this, AccessFactory.MODULE);
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
Backup the database to backupDir.void
backupAndEnableLogArchiveMode
(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
Checkpoints the database, that is, flushes all dirty data to disk.void
Database creation has finished.void
DERBY-5996(Create readme files (cautioning users against modifying database files) at database hard upgrade time) This gets called during hard upgrade.void
disableLogArchiveMode
(boolean deleteOnlineArchivedLogFiles) disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.void
Start the failover for this database.findMethodFactoryByFormat
(UUID format) Find an access method that implements a format type.findMethodFactoryByImpl
(String impltype) Find an access method that implements an implementation type.void
freeze()
Freeze the database temporarily so a backup can be taken.getAndNameTransaction
(ContextManager cm, String transName) Get a transaction.Get the LockFactory to use with this store.Get a transaction controller with which to manipulate data within the access manager.Return a snap shot of all transactions in the db.Return the XAResourceManager associated with this AccessFactory.boolean
Is the store read-only.void
registerAccessMethod
(MethodFactory factory) Register an access method that this access manager can use.void
startReplicationMaster
(String dbmaster, String host, int port, String replicationMode) Start the replication master role for this databasestartXATransaction
(ContextManager cm, int format_id, byte[] global_id, byte[] branch_id) Start a global transaction.void
Stop the replication master role for this database.void
unfreeze()
Unfreeze the database after a backup has been taken.void
-
Field Details
-
MODULE
Used to identify this interface when finding it with the Monitor.- See Also:
-
-
Method Details
-
registerAccessMethod
Register an access method that this access manager can use. -
createFinished
Database creation has finished.- Throws:
StandardException
- Standard exception policy.
-
findMethodFactoryByImpl
Find an access method that implements an implementation type.- Throws:
StandardException
- Standard exception policy.
-
findMethodFactoryByFormat
Find an access method that implements a format type. -
getLockFactory
LockFactory getLockFactory()Get the LockFactory to use with this store.- Returns:
- The lock factory to use with this store.
-
getXAResourceManager
Return the XAResourceManager associated with this AccessFactory.Returns an object which can be used to implement the "offline" 2 phase commit interaction between the accessfactory and outstanding transaction managers taking care of in-doubt transactions.
- Returns:
- The XAResourceManager associated with this accessfactory.
- Throws:
StandardException
- Standard exception policy.
-
isReadOnly
boolean isReadOnly()Is the store read-only. -
createReadMeFiles
DERBY-5996(Create readme files (cautioning users against modifying database files) at database hard upgrade time) This gets called during hard upgrade. It will create 3 readme files one in database directory, one in "seg0" directory and one in log directory. These readme files warn users against touching any of files associated with derby database- Throws:
StandardException
-
getTransaction
Get a transaction controller with which to manipulate data within the access manager. Implicitly creates an access context if one does not already exist.- Parameters:
cm
- The context manager for the current context.- Throws:
StandardException
- Standard exception policy.- See Also:
-
getAndNameTransaction
TransactionController getAndNameTransaction(ContextManager cm, String transName) throws StandardException Get a transaction. If a new transaction is implicitly created, give it name transName.- Parameters:
cm
- The context manager for 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 exception policy.- See Also:
-
getTransactionInfo
TransactionInfo[] getTransactionInfo()Return a snap shot of all transactions in the db.Take a snap shot of all transactions currently in the database and make a record of their information.
- Returns:
- an array of TransactionInfo, or null if there is no transaction in the database.
-
startXATransaction
Object startXATransaction(ContextManager cm, int format_id, byte[] global_id, byte[] branch_id) throws StandardException Start a global transaction.Get a transaction controller with which to manipulate data within the access manager. Implicitly creates an access context.
Must only be called if no other transaction context exists in the current context manager. If another transaction exists in the context an exception will be thrown.
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.
If the global transaction id given matches an existing in-doubt global transaction in the current system, then a StandardException will be thrown with a state of SQLState.STORE_XA_XAER_DUPID.
- Parameters:
cm
- The context manager for 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 exception policy.- See Also:
-
startReplicationMaster
void startReplicationMaster(String dbmaster, String host, int port, String replicationMode) throws StandardException Start the replication master role for this database- Parameters:
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.- Throws:
StandardException
- Standard Derby exception policy, thrown on error.
-
stopReplicationMaster
Stop the replication master role for this database.- Throws:
StandardException
- Standard Derby exception policy, thrown on error.
-
failover
Start the failover for this database.- Parameters:
dbname
- the replication database that is being failed over.- Throws:
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.
-
freeze
Freeze the database temporarily so a backup can be taken.Please see Derby on line documentation on backup and restore.
- Throws:
StandardException
- Thrown on error
-
unfreeze
Unfreeze the database after a backup has been taken.Please see Derby on line documentation on backup and restore.
- Throws:
StandardException
- Thrown on error
-
backup
Backup the database to backupDir.Please see Derby on line documentation on backup and restore.
- Parameters:
backupDir
- the name of the directory where the backup should be stored.wait
- if true, waits for all the backup blocking operations in progress to finish.- Throws:
StandardException
- Thrown on error
-
backupAndEnableLogArchiveMode
void backupAndEnableLogArchiveMode(String backupDir, boolean deleteOnlineArchivedLogFiles, boolean wait) throws StandardException 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.- 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.wait
- if true, waits for all the backup blocking operations in progress to finish.- Throws:
StandardException
- Thrown on error
-
disableLogArchiveMode
disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.- 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
-
checkpoint
Checkpoints the database, that is, flushes all dirty data to disk. Records a checkpoint in the transaction log, if there is a log.- Throws:
StandardException
- Thrown on error
-
waitForPostCommitToFinishWork
void waitForPostCommitToFinishWork()
-