|
db4o 7.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ExtObjectContainer
extended functionality for the
ObjectContainer
interface.
Every db4o ObjectContainer
always is an ExtObjectContainer
so a cast is possible.
ObjectContainer.ext()
is a convenient method to perform the cast.
The ObjectContainer functionality is split to two interfaces to allow newcomers to
focus on the essential methods.
Method Summary | ||
---|---|---|
void |
activate(java.lang.Object obj)
activates an object with the current activation strategy. |
|
void |
backup(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. |
|
Db4oCollections |
collections()
Deprecated. since 7.0. Use of old internal collections is discouraged. Please use com.db4o.collections.ArrayList4 and com.db4o.collections.ArrayMap4 instead. |
|
Configuration |
configure()
returns the Configuration context for this ObjectContainer. |
|
void |
deactivate(java.lang.Object obj)
deactivates an object. |
|
java.lang.Object |
descend(java.lang.Object obj,
java.lang.String[] path)
returns a member at the specific path without activating intermediate objects. |
|
|
getByID(long ID)
returns the stored object for an internal ID. |
|
|
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. |
|
com.db4o.ext.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 |
isClosed()
tests if this ObjectContainer is closed. |
|
boolean |
isStored(java.lang.Object obj)
tests if an object is stored in this ObjectContainer . |
|
ReflectClass[] |
knownClasses()
returns all class representations that are known to this ObjectContainer because they have been used or stored. |
|
java.lang.Object |
lock()
returns the main synchronisation lock. |
|
void |
migrateFrom(ObjectContainer objectContainer)
aids migration of objects between ObjectContainers. |
|
|
peekPersisted(T object,
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()
unloads all clean indices from memory and frees unused objects. |
|
void |
purge(java.lang.Object obj)
unloads a specific object from the db4o reference mechanism. |
|
GenericReflector |
reflector()
Return the reflector currently being used by db4objects. |
|
void |
refresh(java.lang.Object obj,
int depth)
refreshs all members on a stored object to the specified depth. |
|
void |
releaseSemaphore(java.lang.String name)
releases a semaphore, if the calling transaction is the owner. |
|
ReplicationProcess |
replicationBegin(ObjectContainer peerB,
ReplicationConflictHandler conflictHandler)
Deprecated. Since db4o-5.2. Use db4o Replication System (dRS) instead. prepares for replication with another ObjectContainer .
An ObjectContainer can only be involved in a replication
process with one other ObjectContainer at the same time.The returned ReplicationProcess interface provides methods to commit
and to cancel the replication process.
This ObjectContainer will be "peerA" for the returned ReplicationProcess. The other ObjectContainer will be "peerB". |
|
void |
set(java.lang.Object obj,
int depth)
Deprecated. Use store(Object,int) instead |
|
boolean |
setSemaphore(java.lang.String name,
int waitForAvailability)
attempts to set a semaphore. |
|
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. |
|
SystemInfo |
systemInfo()
returns the SystemInfo for this ObjectContainer. |
|
long |
version()
returns the current transaction serial number. |
Methods inherited from interface com.db4o.ObjectContainer |
---|
activate, close, commit, deactivate, delete, ext, get, query, query, query, query, query, queryByExample, rollback, set, store |
Method Detail |
---|
void activate(java.lang.Object obj) throws Db4oIOException, DatabaseClosedException
Configuration.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.
Db4oIOException
DatabaseClosedException
void deactivate(java.lang.Object obj)
obj
- the object to be deactivated.void backup(java.lang.String path) throws Db4oIOException, DatabaseClosedException, com.db4o.foundation.NotSupportedException
path
- a fully qualified path
DatabaseClosedException
- db4o database file was closed or failed to open.
com.db4o.foundation.NotSupportedException
- is thrown when the operation is not supported in current
configuration/environment
Db4oIOException
- I/O operation failed or was unexpectedly interrupted.void bind(java.lang.Object obj, long id) throws InvalidIDException, DatabaseClosedException
set(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 to
DatabaseClosedException
- db4o database file was closed or failed to open.
InvalidIDException
- when the provided id is outside the scope of the
database IDs.getID(java.lang.Object)
Db4oCollections collections()
Db4oCollections
interface to create or modify database-aware
collections for this ObjectContainer
.
Db4oCollections
interface for this ObjectContainer
.Configuration configure()
Db4o class
, the global
Configuration
context
is copied into the ObjectContainer. The
Configuration
can be modified individually for
each ObjectContainer without any effects on the global settings.
Configuration
the Configuration
context for this ObjectContainerDb4o.configure()
java.lang.Object descend(java.lang.Object obj, java.lang.String[] path)
obj
- the parent object that is to be used as the starting point.path
- an array of field names to navigate by
<T> T getByID(long ID) throws DatabaseClosedException, InvalidIDException
getID(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 ID
null
,
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 theWhy activation?
<T> T getByUUID(Db4oUUID uuid) throws DatabaseClosedException, Db4oIOException
Db4oUUID
.
Db4oUUID
for an
object use getObjectInfo(Object)
and ObjectInfo.getUUID()
.
uuid
- the UUID
Db4oIOException
- I/O operation failed or was unexpectedly interrupted.
DatabaseClosedException
- db4o database file was closed or failed to open.Why activation?
long getID(java.lang.Object obj)
ObjectContainer
.
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.getObjectInfo(Object)
, ObjectInfo.getUUID()
and
getByUUID(Db4oUUID)
for long-term external references to
objects.
obj
- any object
0
, if the passed
object is not stored in this ObjectContainer
.ObjectInfo getObjectInfo(java.lang.Object obj)
ObjectInfo
for a stored object.
ObjectContainer
.
obj
- the stored object
ObjectInfo
com.db4o.ext.Db4oDatabase identity()
boolean isActive(java.lang.Object obj)
isActive
returns false
if an object is not
stored within the ObjectContainer
.
obj
- to be testedtrue
if the passed object is active.boolean isCached(long ID)
ID
- the internal IDboolean isClosed()
ObjectContainer
is closed.
true
if this ObjectContainer
is closed.boolean isStored(java.lang.Object obj) throws DatabaseClosedException
ObjectContainer
.
obj
- to be testedtrue
if the passed object is stored.
DatabaseClosedException
- db4o database file was closed or failed to open.ReflectClass[] knownClasses()
java.lang.Object lock()
void migrateFrom(ObjectContainer objectContainer)
Defragment
operation. It is included in the default
implementation supplied in Defragment.java/Defragment.cs.
objectContainer
- the ObjectContainer
objects are to be migrated
from or null
to denote that migration is completed.<T> T peekPersisted(T object, int depth, boolean committed)
committed
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)
.
object
- 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 returned
void purge()
void purge(java.lang.Object obj)
purge(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.GenericReflector reflector()
void refresh(java.lang.Object obj, int depth)
obj
- the object to be refreshed.depth
- the member depth
to which refresh is to cascade.void releaseSemaphore(java.lang.String name)
name
- the name of the semaphore to be released.ReplicationProcess replicationBegin(ObjectContainer peerB, ReplicationConflictHandler conflictHandler)
ObjectContainer
.
ObjectContainer
can only be involved in a replication
process with one other ObjectContainer
at the same time.ReplicationProcess
interface provides methods to commit
and to cancel the replication process.
peerB
- the ObjectContainer
to replicate with.conflictHandler
- the conflict handler for this ReplicationProcess.
Conflicts occur
whenever ReplicationProcess.replicate(Object)
is called with an
object that was modified in both ObjectContainers since the last
replication run between the two. Upon a conflict the
ReplicationConflictHandler.resolveConflict(ReplicationProcess, Object, Object)
method will be called in the conflict handler.
ReplicationProcess
interface for this replication process.void set(java.lang.Object obj, int depth)
store(Object,int)
instead
ObjectContainer#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 updatedObjectContainer.set(java.lang.Object)
void store(java.lang.Object obj, int depth)
ObjectContainer#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 updatedObjectContainer.set(java.lang.Object)
boolean setSemaphore(java.lang.String name, int waitForAvailability)
ObjectContainers
.
releaseSemaphore(java.lang.String)
ObjectContainer.close()
ObjectServer
is
closed.ObjectContainer
looses the connection and is timed
out.ObjectContainer.commit()
or ObjectContainer.rollback()
.getID(Object)
name
- the name of the semaphore to be setwaitForAvailability
- the time in milliseconds to wait for other
transactions to release the semaphore. The parameter may be zero, if
the method is to return immediately.
true
, if the semaphore could be set or if the
calling transaction already owned the semaphore.
false
, if the semaphore is owned by another
transaction.StoredClass storedClass(java.lang.Object clazz)
StoredClass
meta information object.
clazz
- class name, Class object, or example object.StoredClass
meta information object.StoredClass[] storedClasses()
StoredClass
meta information objects.
SystemInfo systemInfo()
SystemInfo
for this ObjectContainer.
SystemInfo
supplies methods that provide
information about system state and system settings of this
ObjectContainer.
SystemInfo
for this ObjectContainer.long version()
|
db4o 7.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |