Package com.db4o.internal
Class IoAdaptedObjectContainer
- java.lang.Object
-
- com.db4o.internal.ObjectContainerBase
-
- com.db4o.internal.ExternalObjectContainer
-
- com.db4o.internal.LocalObjectContainer
-
- com.db4o.internal.IoAdaptedObjectContainer
-
- All Implemented Interfaces:
EmbeddedObjectContainer
,ExtObjectContainer
,InternalObjectContainer
,ObjectContainerSpec
,Internal4
,ObjectContainer
,TransientClass
public class IoAdaptedObjectContainer extends LocalObjectContainer implements EmbeddedObjectContainer
-
-
Field Summary
-
Fields inherited from class com.db4o.internal.LocalObjectContainer
_fileHeader, _pointerIo
-
Fields inherited from class com.db4o.internal.ObjectContainerBase
_blockConverter, _classCollection, _config, _handlers, _lock, _timeStampIdGenerator, _transaction
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
backup(Storage targetStorage, java.lang.String path)
backs up a database file of an open ObjectContainer.void
backupSync(Storage targetStorage, java.lang.String path)
backs up a database file of an open ObjectContainer.byte
blockSize()
void
blockSize(int size)
void
closeTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)
void
commit1(Transaction trans)
protected void
fatalStorageShutdown()
long
fileLength()
java.lang.String
fileName()
protected void
openImpl()
void
overwriteDeletedBytes(int address, int length)
void
readBytes(byte[] bytes, int address, int length)
void
readBytes(byte[] bytes, int address, int addressOffset, int length)
void
reserve(int byteCount)
protected void
shutdownDataStorage()
void
syncFiles()
void
syncFiles(java.lang.Runnable runnable)
BlockAwareBin
timerFile()
void
writeBytes(ByteArrayBuffer buffer, int blockedAddress, int addressOffset)
-
Methods inherited from class com.db4o.internal.LocalObjectContainer
allocatePointerSlot, allocateSafeSlot, allocateSlot, allocateSlotForNewUserObject, allocateSlotForUserObjectUpdate, appendBytes, blockSizeReadFromFile, classOnlyQuery, close2, closeIdSystem, commitHook, commitTransaction, converterVersion, createBTreeClassIndex, createIdSystem, currentVersion, debugReadPointerSlot, defaultToString, delete4, doFinalize, executeQuery, free, free, freespaceManager, from, generateNewIdentity, getAll, getFileHeader, getIDsForClass, identity, idForNewUserObject, idSystem, installDebugFreespaceManager, instanceCount, isDeleted, isValidPointer, localSystemTransaction, maximumDatabaseFileSize, newEventRegistry, newQueryResult, newQueryResult, newTransaction, newTransactionalIdSystem, openSession, overwriteDeletedBlockedSlot, queryAllObjects, raiseCommitTimestamp, readBufferById, readBufferById, readBufferBySlot, readPointerSlot, readSlotBuffers, readStatefulBufferById, readStatefulBufferById, readStatefulBufferBySlot, releaseSemaphore, releaseSemaphore, releaseSemaphores, rollback1, setDirtyInSystemTransaction, setIdentity, setNextTimeStampId, setRegularEndAddress, setSemaphore, setSemaphore, setServer, shutdown, systemData, systemInfo, writeDirtyClassMetadata, writeEncrypt, writeHeader, writeNew, writePointer, writeTransactionPointer, writeUpdate
-
Methods inherited from class com.db4o.internal.ExternalObjectContainer
activate, activate, bind, commit, deactivate, deactivate, delete, descend, ext, getByID, getByUUID, getID, getObjectInfo, inCallback, isActive, isCached, isStored, peekPersisted, purge, query, query, query, query, queryByExample, refresh, rollback, store, store, storedClass, storedClasses
-
Methods inherited from class com.db4o.internal.ObjectContainerBase
activate, activate, activationContextFor, activationDepthProvider, applyRenames, asTopLevelCall, backup, backupSync, bind, bind2, blockConverter, callbacks, callbacks, checkClosed, checkReadOnly, checkStillToSet, checkTransaction, checkTransaction, classCollection, classMetadataForID, classMetadataForName, classMetadataForObject, classMetadataForReflectClass, classMetadataIdForName, close, closeSystemTransaction, closeUserTransaction, commit, commitTimestampIndex, config, configImpl, configure, container, createBlockConverter, createClassMetadata, createReferenceSystem, createStatefulBuffer, createStringIO, db4oTypeStored, deactivate, deactivate, decryptedBufferByAddress, defaultActivationDepth, delete, delete1, delete2, deleteByID, detectSchemaChanges, dispatchsEvents, environment, fatalShutdown, finalize, flagAsHandled, generateTimeStampId, generateTransactionTimestamp, getActivatedObjectFromCache, getByID, getByID2, getByUUID, getHardObjectReferenceById, getHardReferenceBySignature, getID, getNativeQueryHandler, getObjectInfo, handledInCurrentTopLevelCall, handleExceptionOnClose, handlers, hasShutDownHook, initalizeWeakReferenceSupport, initialize1, initializeClassMetadataRepository, initializePostOpenExcludingTransportObjectContainer, initializeTransactions, isCached, isClient, isClosed, isStored, knownClasses, lock, logMsg, maintainsIndices, needsLockFileThread, needsUpdate, newSystemTransaction, newUserTransaction, newWeakReference, open, peekPersisted, peekPersisted, peekReference, produceClassMetadata, purge, purge, query, query, query, query, query, queryByExample, rawBufferByAddress, readActivatedObjectNotInCache, readWriterByAddress, referenceSystemRegistry, reflector, refresh, refreshInternal, replaceClassMetadataRepository, replicationCallState, rollback, send, showInternalClasses, shutdownObjectContainer, stackDepth, stackDepth, stillToActivate, stillToDeactivate, stopSession, store, store, store2, storeAfterReplication, storeAll, storeAll, storeByNewReplication, storedClass, storedClasses, storeInternal, storeInternal, stringIO, syncExec, systemTransaction, threadPool, topLevelCallId, topLevelCallId, toString, transaction, tryGetByID, typeHandlerForClass, typeHandlerForClassMetadataID, updateDepthProvider, useDefaultTransactionTimestamp, uUIDIndex, version, versionIndex, withEnvironment, withTransaction
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.db4o.EmbeddedObjectContainer
backup
-
Methods inherited from interface com.db4o.ext.ExtObjectContainer
activate, backup, backupSync, bind, configure, deactivate, descend, getByID, getByUUID, getID, getObjectInfo, isActive, isCached, isClosed, isStored, knownClasses, lock, peekPersisted, purge, purge, reflector, refresh, store, storedClass, storedClasses, version
-
Methods inherited from interface com.db4o.internal.InternalObjectContainer
callbacks, callbacks, classMetadataForID, classMetadataForName, classMetadataForReflectClass, configImpl, container, getNativeQueryHandler, handlers, inCallback, isClient, storeAll, syncExec, transaction, updateDepthProvider
-
Methods inherited from interface com.db4o.ObjectContainer
activate, close, commit, deactivate, delete, ext, query, query, query, query, query, queryByExample, rollback, store
-
-
-
-
Method Detail
-
openImpl
protected final void openImpl() throws OldFormatException, DatabaseReadOnlyException
- Specified by:
openImpl
in classObjectContainerBase
- Throws:
OldFormatException
DatabaseReadOnlyException
-
backup
public void backup(Storage targetStorage, java.lang.String path) throws DatabaseClosedException, Db4oIOException
Description copied from interface:ExtObjectContainer
backs up a database file of an open ObjectContainer.
While the backup is running, the ObjectContainer can continue to be used. Changes that are made while the backup is in progress, will be applied to the open ObjectContainer and to the backup.
While the backup is running, the ObjectContainer should not be closed.
Note that this is designed to run as a background process: To avoid harming performance of concurrently active database operations, it tries to leave room for other threads as much as possible and thus will be orders of magnitude slower than a regular file copy. If you are looking for a faster backup (that will block all other database operations), useExtObjectContainer.backupSync(Storage, String)
instead.
If a file already exists at the specified path, it will be overwritten.
This method is intended for cross-storage backups, i.e. backup from an in-memory database to a file.- Specified by:
backup
in interfaceExtObjectContainer
- Specified by:
backup
in classExternalObjectContainer
- Parameters:
targetStorage
- theStorage
to be used for backuppath
- a fully qualified path- Throws:
DatabaseClosedException
- db4o database file was closed or failed to open.Db4oIOException
- I/O operation failed or was unexpectedly interrupted.
-
backupSync
public void backupSync(Storage targetStorage, java.lang.String path) throws DatabaseClosedException, Db4oIOException
Description copied from interface:ExtObjectContainer
backs up a database file of an open ObjectContainer. While the backup is running, the ObjectContainer should not be closed.
Note that this blocks all other concurrently active database operations for the full duration of the backup. If you intend to run a backup as a less intrusive background process concurrently with other database operations, useExtObjectContainer.backup(Storage, String)
instead.
If a file already exists at the specified path, it will be overwritten.
This method can be used for cross-storage backups, i.e. backup from an in-memory database to a file.- Specified by:
backupSync
in interfaceExtObjectContainer
- Specified by:
backupSync
in classExternalObjectContainer
- Parameters:
targetStorage
- theStorage
to be used for backuppath
- a fully qualified path- Throws:
DatabaseClosedException
- db4o database file was closed or failed to open.Db4oIOException
- I/O operation failed or was unexpectedly interrupted.
-
blockSize
public void blockSize(int size)
- Specified by:
blockSize
in classObjectContainerBase
-
blockSize
public byte blockSize()
- Specified by:
blockSize
in classObjectContainerBase
-
shutdownDataStorage
protected void shutdownDataStorage()
- Specified by:
shutdownDataStorage
in classObjectContainerBase
-
closeTransaction
public void closeTransaction(Transaction transaction, boolean isSystemTransaction, boolean rollbackOnClose)
- Specified by:
closeTransaction
in classObjectContainerBase
-
commit1
public void commit1(Transaction trans)
- Overrides:
commit1
in classLocalObjectContainer
-
fileLength
public long fileLength()
- Specified by:
fileLength
in classLocalObjectContainer
-
fileName
public java.lang.String fileName()
- Specified by:
fileName
in classLocalObjectContainer
-
readBytes
public void readBytes(byte[] bytes, int address, int length) throws Db4oIOException
- Specified by:
readBytes
in classObjectContainerBase
- Throws:
Db4oIOException
-
readBytes
public void readBytes(byte[] bytes, int address, int addressOffset, int length) throws Db4oIOException
- Specified by:
readBytes
in classObjectContainerBase
- Throws:
Db4oIOException
-
reserve
public void reserve(int byteCount) throws DatabaseReadOnlyException
- Specified by:
reserve
in classObjectContainerBase
- Throws:
DatabaseReadOnlyException
-
syncFiles
public void syncFiles()
- Specified by:
syncFiles
in classLocalObjectContainer
-
syncFiles
public void syncFiles(java.lang.Runnable runnable)
- Specified by:
syncFiles
in classLocalObjectContainer
-
writeBytes
public void writeBytes(ByteArrayBuffer buffer, int blockedAddress, int addressOffset)
- Specified by:
writeBytes
in classLocalObjectContainer
-
overwriteDeletedBytes
public void overwriteDeletedBytes(int address, int length)
- Specified by:
overwriteDeletedBytes
in classLocalObjectContainer
-
timerFile
public BlockAwareBin timerFile()
-
fatalStorageShutdown
protected void fatalStorageShutdown()
- Specified by:
fatalStorageShutdown
in classObjectContainerBase
-
-