Cedric Beust wrote:
> A voir.  Je pense que si tu es sur que tes objets passive's ne seront
> jamais accedes de facon concurrente, la serialization est probablement
> la meilleure et la plus economique solution.

Certes, l'avantage de la BD �tant : "aucune ligne de code � �crire" :)

> Mais bon, tiens-nous au courant a propos de db4o (ou autres OODB).

Je crois que db4o correspond exactement � ce que je cherche :
(c'est un peu long, mais tr�s int�ressant!)
-----------------------------------------------------------------------
What's "activation" and what is it for?

Let's explain this with an example:
Consider that you retrieve an object from the database by using a query. 
This object might have 1000 members, all these 1000 objects might have 
1000 members, these have 1000 members in turn and so on....
In the worst case, you have a single root object that indirectly 
references all other objects in the database. Creating all of these 
objects could take a very long time and you might experience OutOfMemory 
problems.

To solve this, db4o introduces a concept of "deactivated" objects:
All of the fields of a "deactivated" object are set to null.
The primitive types hold their default values respectively.

In db4o terms, loading the fields with the stored values from the 
database is called "activation".

db4o provides an API, to configure how activation is to behave. You can 
set a global activation depth and override the behaviour individually 
for specific classes:
Db4o.configure().activationDepth(int)
Db4o.configure().objectClass("yourClass").minimumActivationDepth(int)
Db4o.configure().objectClass("yourClass").maximumActivationDepth(int)
By default, Db4o is configured with a standard activation depth of 5.

The term "depth" means:
"number of member references away from the original object"

Here is an example. Consider you have a default activation depth of 3. 
If you retrieve an object:
object.member1.member2.member3 will be instantiated.
"member3" will be present but deactivated.

You can use manual activation to instantiate individual objects:
ObjectContainer#activate(object, depth);

Manual deactivation may be used to save memory:
ObjectContainer#deactivate(object, depth);

By configuring db4o you have full control over how you want db4o to 
behave. The two extremes:
- using an activationDepth of Integer.MAX_VALUE let's you forget about 
manual activation but you might not have the best performance and memory 
footprint
- using an activationDepth of 0 and activating and deactivating all 
objects manually keeps memory consumption extremely low on a 
low-memory-device.
---------------------------------------------------------------------

Voil�, voil�, je fais les tests ce soir. Plus de nouvelles demain,
si cela marche :)

yann.

-- 
  / Yann SECQ            Equipe SMAC           [EMAIL PROTECTED] \
| Multi-Agent Systems Modeling & Agent Oriented Programming |
  \ http://www.lifl.fr/SMAC        http://www.lifl.fr/~secq /

Répondre à