Top Description Fields Methods
org.apache.derby.iapi.store.access

public Interface AccessFactory

Known Direct Implementers
org.apache.derby.impl.store.access.RAMAccessManager
Imports
org.apache.derby.catalog.UUID, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.locks.LockFactory, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.access.conglomerate.MethodFactory, org.apache.derby.iapi.services.property.PropertySetCallback, java.util.Properties, java.io.File

Module interface for an access manager. An access manager provides transactional access via access methods to data in a single storage manager.

An AccessFactory is typically obtained from the Monitor:

	// Get the current transaction controller.
	AccessFactory af;
	af = (AccessFactory) Monitor.findServiceModule(this, AccessFactory.MODULE);
  

Field Summary

Modifier and TypeField and Description
public static final String
MODULE

Used to identify this interface when finding it with the Monitor.

Method Summary

Modifier and TypeMethod and Description
public void
backup(String
the name of the directory where the backup should be stored.
backupDir
,
boolean
if true, waits for all the backup blocking operations in progress to finish.
wait
)

Backup the database to backupDir.

public void
backupAndEnableLogArchiveMode(String
the directory name where the database backup should go. This directory will be created if not it does not exist.
backupDir
,
boolean
If true deletes online archived log files that exist before this backup, delete will occur only after backup is complete.
deleteOnlineArchivedLogFiles
,
boolean
if true, waits for all the backup blocking operations in progress to finish.
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.

public void
checkpoint()

Checkpoints the database, that is, flushes all dirty data to disk.

public void
createFinished()

Database creation has finished.

public void
createReadMeFiles()

DERBY-5996(Create readme files (cautioning users against modifying database files) at database hard upgrade time) This gets called during hard upgrade.

public void
disableLogArchiveMode(boolean
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.
deleteOnlineArchivedLogFiles
)

disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.

public void
failover(String
the replication database that is being failed over.
dbname
)

Start the failover for this database.

public MethodFactory
findMethodFactoryByFormat(UUID format)

Find an access method that implements a format type.

public MethodFactory
findMethodFactoryByImpl(String impltype)

Find an access method that implements an implementation type.

public void
freeze()

Freeze the database temporarily so a backup can be taken.

public TransactionController
getAndNameTransaction(ContextManager
The context manager for the current context.
cm
,
String
If a new transaction is started, it will be given this name. The name is displayed in the transactiontable VTI.
transName
)

Get a transaction.

public LockFactory

Returns:

The lock factory to use with this store.
getLockFactory
()

Get the LockFactory to use with this store.

public TransactionController
getTransaction(ContextManager
The context manager for the current context.
cm
)

Get a transaction controller with which to manipulate data within the access manager.

public TransactionInfo[]

Returns:

an array of TransactionInfo, or null if there is no transaction in the database.
getTransactionInfo
()

Return a snap shot of all transactions in the db.

public Object

Returns:

The XAResourceManager associated with this accessfactory.
getXAResourceManager
()

Return the XAResourceManager associated with this AccessFactory.

public boolean
isReadOnly()

Is the store read-only.

public void
registerAccessMethod(MethodFactory factory)

Register an access method that this access manager can use.

public void
startReplicationMaster(String
The master database that is being replicated.
dbmaster
,
String
The hostname for the slave
host
,
int
The port the slave is listening on
port
,
String
The type of replication contract. Currently only asynchronous replication is supported, but 1-safe/2-safe/very-safe modes may be added later.
replicationMode
)

Start the replication master role for this database

public Object
startXATransaction(ContextManager
The context manager for the current context.
cm
,
int
the format id part of the Xid - ie. Xid.getFormatId().
format_id
,
byte[]
the global transaction identifier part of XID - ie. Xid.getGlobalTransactionId().
global_id
,
byte[]
The branch qualifier of the Xid - ie. Xid.getBranchQaulifier()
branch_id
)

Start a global transaction.

public void
stopReplicationMaster()

Stop the replication master role for this database.

public void
unfreeze()

Unfreeze the database after a backup has been taken.

public void

Field Detail

MODULEback to summary
public static final String MODULE

Used to identify this interface when finding it with the Monitor.

Method Detail

backupback to summary
public void backup(String backupDir, boolean wait) throws StandardException

Backup the database to backupDir.

Please see Derby on line documentation on backup and restore.

Parameters
backupDir:String

the name of the directory where the backup should be stored.

wait:boolean

if true, waits for all the backup blocking operations in progress to finish.

Exceptions
StandardException:
Thrown on error
backupAndEnableLogArchiveModeback to summary
public 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:String

the directory name where the database backup should go. This directory will be created if not it does not exist.

deleteOnlineArchivedLogFiles:boolean

If true deletes online archived log files that exist before this backup, delete will occur only after backup is complete.

wait:boolean

if true, waits for all the backup blocking operations in progress to finish.

Exceptions
StandardException:
Thrown on error
checkpointback to summary
public void checkpoint() throws StandardException

Checkpoints the database, that is, flushes all dirty data to disk. Records a checkpoint in the transaction log, if there is a log.

Exceptions
StandardException:
Thrown on error
createFinishedback to summary
public void createFinished() throws StandardException

Database creation has finished.

Exceptions
StandardException:
Standard exception policy.
createReadMeFilesback to summary
public void createReadMeFiles() throws StandardException

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

disableLogArchiveModeback to summary
public void disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles) throws StandardException

disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.

Parameters
deleteOnlineArchivedLogFiles:boolean

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.

Exceptions
StandardException:
Thrown on error
failoverback to summary
public void failover(String dbname) throws StandardException

Start the failover for this database.

Parameters
dbname:String

the replication database that is being failed over.

Exceptions
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.
findMethodFactoryByFormatback to summary
public MethodFactory findMethodFactoryByFormat(UUID format)

Find an access method that implements a format type.

findMethodFactoryByImplback to summary
public MethodFactory findMethodFactoryByImpl(String impltype) throws StandardException

Find an access method that implements an implementation type.

Exceptions
StandardException:
Standard exception policy.
freezeback to summary
public void freeze() throws StandardException

Freeze the database temporarily so a backup can be taken.

Please see Derby on line documentation on backup and restore.

Exceptions
StandardException:
Thrown on error
getAndNameTransactionback to summary
public TransactionController getAndNameTransaction(ContextManager cm, String transName) throws StandardException

Get a transaction. If a new transaction is implicitly created, give it name transName.

Parameters
cm:ContextManager

The context manager for the current context.

transName:String

If a new transaction is started, it will be given this name. The name is displayed in the transactiontable VTI.

Exceptions
StandardException:
Standard exception policy.
See Also
TransactionController, AccessFactory#getTransaction
getLockFactoryback to summary
public LockFactory getLockFactory()

Get the LockFactory to use with this store.

Returns:LockFactory

The lock factory to use with this store.

getTransactionback to summary
public TransactionController getTransaction(ContextManager cm) throws StandardException

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:ContextManager

The context manager for the current context.

Exceptions
StandardException:
Standard exception policy.
See Also
TransactionController
getTransactionInfoback to summary
public 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:TransactionInfo[]

an array of TransactionInfo, or null if there is no transaction in the database.

getXAResourceManagerback to summary
public Object getXAResourceManager() throws StandardException

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:Object

The XAResourceManager associated with this accessfactory.

Exceptions
StandardException:
Standard exception policy.
isReadOnlyback to summary
public boolean isReadOnly()

Is the store read-only.

registerAccessMethodback to summary
public void registerAccessMethod(MethodFactory factory)

Register an access method that this access manager can use.

startReplicationMasterback to summary
public void startReplicationMaster(String dbmaster, String host, int port, String replicationMode) throws StandardException

Start the replication master role for this database

Parameters
dbmaster:String

The master database that is being replicated.

host:String

The hostname for the slave

port:int

The port the slave is listening on

replicationMode:String

The type of replication contract. Currently only asynchronous replication is supported, but 1-safe/2-safe/very-safe modes may be added later.

Exceptions
StandardException:
Standard Derby exception policy, thrown on error.
startXATransactionback to summary
public 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:ContextManager

The context manager for the current context.

format_id:int

the format id part of the Xid - ie. Xid.getFormatId().

global_id:byte[]

the global transaction identifier part of XID - ie. Xid.getGlobalTransactionId().

branch_id:byte[]

The branch qualifier of the Xid - ie. Xid.getBranchQaulifier()

Exceptions
StandardException:
Standard exception policy.
See Also
TransactionController
stopReplicationMasterback to summary
public void stopReplicationMaster() throws StandardException

Stop the replication master role for this database.

Exceptions
StandardException:
Standard Derby exception policy, thrown on error.
unfreezeback to summary
public void unfreeze() throws StandardException

Unfreeze the database after a backup has been taken.

Please see Derby on line documentation on backup and restore.

Exceptions
StandardException:
Thrown on error
waitForPostCommitToFinishWorkback to summary
public void waitForPostCommitToFinishWork()