public abstract class ExternalObjectContainer extends ObjectContainerBase
_blockConverter, _classCollection, _config, _handlers, _lock, _timeStampIdGenerator, _transaction| Constructor and Description |
|---|
ExternalObjectContainer(Configuration config) |
| Modifier and Type | Method and Description |
|---|---|
void |
activate(java.lang.Object obj)
activates an object with the current activation strategy.
|
void |
activate(java.lang.Object obj,
int depth)
activates all members on a stored object to the specified depth.
|
abstract void |
backup(Storage targetStorage,
java.lang.String path)
backs up a database file of an open ObjectContainer.
|
void |
bind(java.lang.Object obj,
long id)
binds an object to an internal object ID.
|
void |
commit()
commits the running transaction.
|
void |
deactivate(java.lang.Object obj)
deactivates an object.
|
void |
deactivate(java.lang.Object obj,
int depth)
deactivates a stored object by setting all members to
NULL. |
void |
delete(java.lang.Object a_object)
deletes a stored object permanently.
|
java.lang.Object |
descend(java.lang.Object obj,
java.lang.String[] path)
returns a member at the specific path without activating intermediate objects.
|
ExtObjectContainer |
ext()
returns an ObjectContainer with extended functionality.
|
java.lang.Object |
getByID(long id)
returns the stored object for an internal ID.
|
java.lang.Object |
getByUUID(Db4oUUID uuid)
returns a stored object for a
Db4oUUID. |
long |
getID(java.lang.Object obj)
returns the internal unique object ID.
|
ObjectInfo |
getObjectInfo(java.lang.Object obj)
returns the
ObjectInfo for a stored object. |
abstract Db4oDatabase |
identity()
returns the Db4oDatabase object for this ObjectContainer.
|
boolean |
isActive(java.lang.Object obj)
tests if an object is activated.
|
boolean |
isCached(long id)
tests if an object with this ID is currently cached.
|
boolean |
isStored(java.lang.Object obj)
tests if an object is stored in this
ObjectContainer. |
java.lang.Object |
peekPersisted(java.lang.Object obj,
int depth,
boolean committed)
returns a transient copy of a persistent object with all members set
to the values that are currently stored to the database.
|
void |
purge(java.lang.Object obj)
unloads a specific object from the db4o reference mechanism.
|
Query |
query()
creates a new S.O.D.A.
|
ObjectSet |
query(java.lang.Class clazz)
queries for all instances of a class.
|
ObjectSet |
query(Predicate predicate)
Native Query Interface.
|
ObjectSet |
query(Predicate predicate,
QueryComparator comparator)
Native Query Interface.
|
ObjectSet |
queryByExample(java.lang.Object template)
Query-By-Example interface to retrieve objects.
|
void |
refresh(java.lang.Object obj,
int depth)
refreshs all members on a stored object to the specified depth.
|
void |
rollback()
rolls back the running transaction.
|
void |
store(java.lang.Object obj)
newly stores objects or updates stored objects.
|
void |
store(java.lang.Object obj,
int depth)
deep update interface to store or update objects.
|
StoredClass |
storedClass(java.lang.Object clazz)
returns a
StoredClass meta information object. |
StoredClass[] |
storedClasses()
returns an array of all
StoredClass meta information objects. |
activate, activate, activationContextFor, activationDepthProvider, applyRenames, asTopLevelCall, backup, bind, bind2, blockConverter, blockSize, blockSize, callbacks, callbacks, checkClosed, checkReadOnly, checkStillToSet, checkTransaction, checkTransaction, classCollection, classMetadataForID, classMetadataForName, classMetadataForObject, classMetadataForReflectClass, classMetadataIdForName, classOnlyQuery, close, close2, closeIdSystem, closeSystemTransaction, closeTransaction, closeUserTransaction, commit, commit1, commitTimestampIndex, config, configImpl, configure, container, converterVersion, createBlockConverter, createClassMetadata, createReferenceSystem, createStatefulBuffer, createStringIO, currentVersion, db4oTypeStored, deactivate, deactivate, decryptedBufferByAddress, defaultActivationDepth, defaultToString, delete, delete1, delete2, delete4, deleteByID, detectSchemaChanges, dispatchsEvents, doFinalize, environment, executeQuery, fatalShutdown, fatalStorageShutdown, finalize, flagAsHandled, generateTimeStampId, generateTransactionTimestamp, getActivatedObjectFromCache, getByID, getByID2, getByUUID, getHardObjectReferenceById, getHardReferenceBySignature, getID, getIDsForClass, getNativeQueryHandler, getObjectInfo, handledInCurrentTopLevelCall, handleExceptionOnClose, handlers, hasShutDownHook, idForNewUserObject, initalizeWeakReferenceSupport, initialize1, initializeClassMetadataRepository, initializePostOpenExcludingTransportObjectContainer, initializeTransactions, isCached, isClient, isClosed, isDeleted, isStored, knownClasses, lock, logMsg, maintainsIndices, needsLockFileThread, needsUpdate, newQueryResult, newSystemTransaction, newTransaction, newUserTransaction, newWeakReference, open, openImpl, peekPersisted, peekPersisted, peekReference, produceClassMetadata, purge, purge, query, query, query, query, query, queryAllObjects, queryByExample, raiseCommitTimestamp, rawBufferByAddress, readActivatedObjectNotInCache, readBufferById, readBufferById, readBytes, readBytes, readSlotBuffers, readStatefulBufferById, readStatefulBufferById, readWriterByAddress, referenceSystemRegistry, reflector, refresh, refreshInternal, releaseSemaphore, releaseSemaphore, releaseSemaphores, replaceClassMetadataRepository, replicationCallState, reserve, rollback, rollback1, send, setDirtyInSystemTransaction, setSemaphore, setSemaphore, showInternalClasses, shutdown, shutdownDataStorage, shutdownObjectContainer, stackDepth, stackDepth, stillToActivate, stillToDeactivate, stopSession, store, store, store2, storeAfterReplication, storeAll, storeAll, storeByNewReplication, storedClass, storedClasses, storeInternal, storeInternal, stringIO, syncExec, systemInfo, systemTransaction, threadPool, topLevelCallId, topLevelCallId, toString, transaction, tryGetByID, typeHandlerForClass, typeHandlerForClassMetadataID, updateDepthProvider, useDefaultTransactionTimestamp, uUIDIndex, version, versionIndex, withEnvironment, withTransaction, writeDirtyClassMetadata, writeNew, writeUpdateclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitinstanceCount, newEventRegistryopenSessionpublic ExternalObjectContainer(Configuration config)
public final void activate(java.lang.Object obj)
ExtObjectContainerConfiguration.activationDepth() )
and all configured settings for ObjectClass.maximumActivationDepth(int)
and ObjectClass.maximumActivationDepth(int) will be respected.TransparentActivationSupport )
the parameter object will only be activated, if it does not implement
Activatable. All referenced members that do not implement
Activatable will also be activated. Any Activatable objects
along the referenced graph will break cascading activation.public final void activate(java.lang.Object obj,
int depth)
throws DatabaseClosedException
ObjectContainer"Why activation"
for an explanation why activation is necessary.maximumActivationDepth() and
minimumActivationDepth() in the
ObjectClass interface.obj - the object to be activated.depth - the member depth
to which activate is to cascade.DatabaseClosedException - db4o database file was closed or failed to open.Why activation?,
Using callbackspublic final void deactivate(java.lang.Object obj)
ExtObjectContainerobj - the object to be deactivated.public final void bind(java.lang.Object obj,
long id)
throws ArgumentNullException,
java.lang.IllegalArgumentException
ExtObjectContainerset(Object) is
necessary to update the stored object.getID(Object).obj - the object that is to be boundid - the internal id the object is to be bound toArgumentNullExceptionjava.lang.IllegalArgumentExceptionExtObjectContainer.getID(java.lang.Object)public final void commit()
throws DatabaseReadOnlyException,
DatabaseClosedException
ObjectContainerDatabaseReadOnlyException - database was configured as read-only.DatabaseClosedException - db4o database file was closed or failed to open.public final void deactivate(java.lang.Object obj,
int depth)
throws DatabaseClosedException
ObjectContainerNULL.
ObjectContainer.deactivate() triggers Deactivating and Deactivated callbacks.
obj - the object to be deactivated.depth - the member depth
to which deactivate is to cascade.DatabaseClosedException - db4o database file was closed or failed to open.Using callbacks,
Why activation?public final void delete(java.lang.Object a_object)
ObjectContainerconfigured for the class
or for one of the member fields.
ObjectContainer.
set() with the same object newly stores the object
to the ObjectContainer.delete() triggers Deleting and Deleted callbacks,
which can be also used for cascaded deletes.a_object - the object to be deleted from the
ObjectContainer.ObjectClass.cascadeOnDelete(boolean),
ObjectField.cascadeOnDelete(boolean),
Using callbackspublic java.lang.Object descend(java.lang.Object obj,
java.lang.String[] path)
ExtObjectContainerobj - the parent object that is to be used as the starting point.path - an array of field names to navigate bypublic ExtObjectContainer ext()
ObjectContainerpublic final ObjectSet queryByExample(java.lang.Object template) throws DatabaseClosedException
ObjectContainerqueryByExample() creates an
ObjectSet containing
all objects in the ObjectContainer that match the passed
template object.queryByExample(NULL) returns all objects stored in the
ObjectContainer.Collection classes are
evaluated for containment. Differences in length/size() are
ignored.
ObjectSet are instantiated
and activated to the preconfigured depth of 5. The
activation depth
may be configured globally or
individually for classes.
queryByExample() can respond to the Activating callback
method.
template - object to be used as an example to find all matching objects.ObjectSet containing all found objects.DatabaseClosedException - db4o database file was closed or failed to open.Why activation?,
Using callbackspublic final java.lang.Object getByID(long id)
throws DatabaseClosedException,
InvalidIDException
ExtObjectContainergetID(Object).
Objects will not be activated by this method. They will be returned in the
activation state they are currently in, in the local cache.id - the internal IDnull,
if no object is associated with this ID in this ObjectContainer.DatabaseClosedException - db4o database file was closed or failed to open.InvalidIDException - when the provided id is outside the scope of the
file length.Why activation?public final java.lang.Object getByUUID(Db4oUUID uuid)
ExtObjectContainerDb4oUUID.
Db4oUUID for an
object use ExtObjectContainer.getObjectInfo(Object) and ObjectInfo.getUUID().uuid - the UUIDWhy activation?public final long getID(java.lang.Object obj)
ExtObjectContainerObjectContainer.
An object carries the same ID in every db4o session. Internal IDs can
be used to look up objects with the very fast
getByID method.ExtObjectContainer.getObjectInfo(Object), ObjectInfo.getUUID() and
ExtObjectContainer.getByUUID(Db4oUUID) for long-term external references to
objects.obj - any object0, if the passed
object is not stored in this ObjectContainer.public final ObjectInfo getObjectInfo(java.lang.Object obj)
ExtObjectContainerObjectInfo for a stored object.
ObjectContainer.obj - the stored objectObjectInfopublic boolean isActive(java.lang.Object obj)
ExtObjectContainerisActive returns false if an object is not
stored within the ObjectContainer.obj - to be testedtrue if the passed object is active.public boolean isCached(long id)
ExtObjectContainerid - the internal IDpublic boolean isStored(java.lang.Object obj)
ExtObjectContainerObjectContainer.
obj - to be testedtrue if the passed object is stored.public final java.lang.Object peekPersisted(java.lang.Object obj,
int depth,
boolean committed)
throws DatabaseClosedException
ExtObjectContainercommitted parameter it is possible to specify,
whether the desired object should contain the committed values or the
values that were set by the running transaction with
ObjectContainer.store(java.lang.Object).
obj - the object that is to be cloneddepth - the member depth to which the object is to be instantiatedcommitted - whether committed or set values are to be returnedDatabaseClosedExceptionpublic final void purge(java.lang.Object obj)
ExtObjectContainerpurge(Object) is not
"known" to the ObjectContainer afterwards, so this method may also be
used to create multiple copies of objects.purge(Object) has
no influence on the persistence state of objects. "Purged" objects can be
reretrieved with queries.obj - the object to be removed from the reference mechanism.public Query query()
ObjectContainerQuery.
ObjectContainer.queryByExample(Object) for simple Query-By-Example.Native queries are the recommended main db4o query
interface.
public final ObjectSet query(java.lang.Class clazz)
ObjectContainerclazz - the class to query for.ObjectSet returned by the query.public final ObjectSet query(Predicate predicate)
ObjectContainer
// Java JDK 5
List <Cat> cats = db.query(new Predicate<Cat>() {
public boolean match(Cat cat) {
return cat.getName().equals("Occam");
}
});
// Java JDK 1.2 to 1.4
List cats = db.query(new Predicate() {
public boolean match(Cat cat) {
return cat.getName().equals("Occam");
}
});
// Java JDK 1.1
ObjectSet cats = db.query(new CatOccam());
public static class CatOccam extends Predicate {
public boolean match(Cat cat) {
return cat.getName().equals("Occam");
}
});
public final ObjectSet query(Predicate predicate, QueryComparator comparator)
ObjectContainerObjectContainer.query(com.db4o.query.Predicate),
but will sort the resulting ObjectSet according to the given QueryComparator.predicate - the Predicate containing the native query expression.comparator - the QueryComparator specifying the sort order of the resultObjectSet returned by the query.public final void refresh(java.lang.Object obj,
int depth)
ExtObjectContainerobj - the object to be refreshed.depth - the member depth
to which refresh is to cascade.public final void rollback()
ObjectContainerdeactivate()
and activate() to reload an objects member values.public final void store(java.lang.Object obj)
throws DatabaseClosedException,
DatabaseReadOnlyException
ObjectContainerObjectContainer will be
stored when it is passed to store(). An object already stored
in the ObjectContainer will be updated.
store() unless a deep
global or
class-specific
update depth was configured or cascaded updates were
defined in the class
or in one of the member fields.
Depending if the passed object is newly stored or updated, Creating/Created
or Updating/Updated callback method is triggered.
Callbacks
might also be used for cascaded updates.obj - the object to be stored or updated.DatabaseClosedException - db4o database file was closed or failed to open.DatabaseReadOnlyException - database was configured as read-only.ExtObjectContainer#set(object, depth),
Configuration.updateDepth(int),
ObjectClass.updateDepth(int),
ObjectClass.cascadeOnUpdate(boolean),
ObjectField.cascadeOnUpdate(boolean),
Using callbackspublic final void store(java.lang.Object obj,
int depth)
throws DatabaseClosedException,
DatabaseReadOnlyException
ExtObjectContainerObjectContainer#set(Object),
this method allows a manual specification of the depth, the passed object is to be updated.obj - the object to be stored or updated.depth - the depth to which the object is to be updatedDatabaseClosedExceptionDatabaseReadOnlyExceptioncom.db4o.ObjectContainer#setpublic final StoredClass storedClass(java.lang.Object clazz)
ExtObjectContainerStoredClass meta information object.
clazz - class name, Class object, or example object.StoredClass meta information object.public StoredClass[] storedClasses()
ExtObjectContainerStoredClass meta information objects.public abstract void backup(Storage targetStorage, java.lang.String path) throws Db4oIOException, DatabaseClosedException, NotSupportedException
ExtObjectContainertargetStorage - the Storage to be used for backuppath - a fully qualified pathDb4oIOException - I/O operation failed or was unexpectedly interrupted.DatabaseClosedException - db4o database file was closed or failed to open.NotSupportedException - is thrown when the operation is not supported in current
configuration/environmentpublic abstract Db4oDatabase identity()
ExtObjectContainer