|
db4o 4.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 |
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()
returns the Db4oCollections interface to create or modify database-aware
collections for this ObjectContainer . |
Configuration |
configure()
returns the Configuration context for this ObjectContainer. |
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.
|
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 .
|
java.lang.Object |
lock()
returns the main synchronisation lock. |
void |
migrateFrom(ObjectContainer objectContainer)
aids migration of objects between ObjectContainers. |
java.lang.Object |
peekPersisted(java.lang.Object 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. |
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. |
Db4oReplication |
replicateTo(ObjectContainer destination)
starts replication to another ObjectContainer .
|
void |
set(java.lang.Object obj,
int depth)
deep update interface to store or update objects. |
boolean |
setSemaphore(java.lang.String name,
int waitForAvailability)
attempts to set a semaphore. |
StoredClass |
storedClass(java.lang.Object clazz)
returns a StoredClass meta information object.
|
StoredClass[] |
storedClasses()
returns an array of all StoredClass meta information objects. |
Methods inherited from interface com.db4o.ObjectContainer |
activate, close, commit, deactivate, delete, ext, get, query, rollback, set |
Method Detail |
public void backup(java.lang.String path) throws java.io.IOException
path
- a fully qualified path
java.io.IOException
public void bind(java.lang.Object obj, long id)
set(Object)
is
necessary to update the stored object.getID(Object)
.
id
- the internal id the object is to be bound togetID(Object)
public Db4oCollections collections()
Db4oCollections
interface to create or modify database-aware
collections for this ObjectContainer
.
Db4oCollections
interface for this ObjectContainer
.public 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()
public java.lang.Object getByID(long ID)
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
.public java.lang.Object getByUUID(Db4oUUID uuid)
Db4oUUID
.
Db4oUUID
for an
object use getObjectInfo(Object)
and ObjectInfo.getUUID()
.
uuid
- the UUID
public 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.
0
, if the passed
object is not stored in this ObjectContainer
.public ObjectInfo getObjectInfo(java.lang.Object obj)
ObjectInfo
for a stored object.
ObjectContainer
.
obj
- the stored object
ObjectInfo
public Db4oDatabase identity()
Db4oDatabase
object for this ObjectContainer.
public boolean isActive(java.lang.Object obj)
isActive
returns false
if an object is not
stored within the ObjectContainer
.
true
if the passed object is active.public boolean isCached(long ID)
ID
- the internal IDpublic boolean isClosed()
ObjectContainer
is closed.
true
if this ObjectContainer
is closed.public boolean isStored(java.lang.Object obj)
ObjectContainer
.
true
if the passed object is stored.public java.lang.Object lock()
public 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.public java.lang.Object peekPersisted(java.lang.Object 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.set(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
public void purge()
public 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.
public void refresh(java.lang.Object obj, int depth)
depth
- the member depth
to which refresh is to cascade.public void releaseSemaphore(java.lang.String name)
name
- the name of the semaphore to be released.public Db4oReplication replicateTo(ObjectContainer destination)
ObjectContainer
.
ObjectContainer
can only be involved in a replication
process with one other ObjectContainer
at the same time.Db4oReplication
interface provides methods to commit
and to cancel the replication process.
destination
- the ObjectContainer
to replicate to.
Db4oReplication
interface for this replication process.public void set(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.
ObjectContainer#set(Object)
public 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.public StoredClass storedClass(java.lang.Object clazz)
StoredClass
meta information object.
StoredClass
meta information object.public StoredClass[] storedClasses()
StoredClass
meta information objects.
|
db4o 4.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |