db4o - database for objects v1.04

com.db4o
Interface ObjectContainer


public interface ObjectContainer

- the db4o storage and query interface.

The ObjectContainer provides all functions to store, retrieve and delete objects and to change object state. Test functions provide information on the storage state of an object within the ObjectContainer.


Method Summary
 void activate(java.lang.Object object)
          instantiates all stored Object members on a stored object.
 void close()
          shuts down the ObjectContainer and writes all cached data.
 void deactivate(java.lang.Object object)
          deactivates a stored object by setting all non-primitive members to NULL.
 void delete(java.lang.Object object)
          deletes a stored object permanently from the ObjectContainer.
 ObjectSet get(java.lang.Object template)
          Query-By-Example interface to retrieve objects from an ObjectContainer.
 boolean isActive(java.lang.Object object)
          tests if an object is activated within the ObjectContainer.
 boolean isStored(java.lang.Object object)
          tests if an object is stored within the ObjectContainer.
 void set(java.lang.Object object)
          newly stores objects or updates stored objects.
 

Method Detail

activate

public void activate(java.lang.Object object)
instantiates all stored Object members on a stored object.

The Object members themselves are instantiated in deactivated state.

This function serves to traverse the graph of persistent objects. All members of an object can be activated in turn with subsequent calls to activate().

Duplicate activate() calls on the same object have no effect.
Passing an object that is not stored within the ObjectContainer has no effect.

Parameters:
Object - the object to be activated.

close

public void close()
shuts down the ObjectContainer and writes all cached data.

Subsequent calls to ObjectContainer functions will result in exceptions.

deactivate

public void deactivate(java.lang.Object object)
deactivates a stored object by setting all non-primitive members to NULL.

Calls to this function save memory. The function has no effect, if the passed object is not stored in the ObjectContainer.

Parameters:
object - the object to be deactivated.

delete

public void delete(java.lang.Object object)
deletes a stored object permanently from the ObjectContainer.

Note that this function has to be called for every single object independantly. Delete does not recurse on object members. Simple and array member types are destroyed.

The members of the passed object remain unchanged.

The function has no effect, if the passed object is not stored in the ObjectContainer.

A subsequent call to set() with the same object parameter newly adds the object to the ObjectContainer.

Parameters:
object - the object to be deleted from the ObjectContainer.

get

public ObjectSet get(java.lang.Object template)
Query-By-Example interface to retrieve objects from an ObjectContainer.

get() creates an ObjectSet containing all objects of the ObjectContainer that match the passed template object.

All non-null members of the template object are compared against all stored objects of the same class.

Simple members are ignored if they are 0 or false respectively.

Calling get(NULL) returns all objects stored in the ObjectContainer.

Parameters:
template - object to be evaluated.
Returns:
ObjectSet of all objects found.

isActive

public boolean isActive(java.lang.Object object)
tests if an object is activated within the ObjectContainer.

isActive returns false if an object is not stored within the ObjectContainer.

Parameters:
object - to be tested
Returns:
true if the passed object is active.

isStored

public boolean isStored(java.lang.Object object)
tests if an object is stored within the ObjectContainer.

Returns:
true if the passed object is stored.

set

public void set(java.lang.Object object)
newly stores objects or updates stored objects.

An object not yet stored in the ObjectContainer will be added when it is passed to set().

An object already stored in the container will be updated.

The update will affect all simple type object members.

Object members not yet stored within the ObjectContainer will be added.
Links to members that already exist in the ObjectContainer  will be updated.

Members that are already stored will not be updated themselves.
Every object member needs to be updated individually with a call to set().

Parameters:
Object - the object to be stored or updated.

db4o - database for objects v1.04