|
JAC project AOPSYS CEDRIC & LIP6 labs |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the configuration interface of the persistence aspect.
PersistenceAC
Method Summary | |
void |
configureStorage(ClassItem storageClass,
String[] storageParameters)
Specify which storage class to use and the parameters to use to instanciate it. |
void |
defineMaxIdleCheckPeriod(long period)
Defines the period that is used to check that the collection max idle time has not been reached. |
void |
disableCache(CollectionItem collection)
This configuration method allows to disable the cache for a given collection. |
void |
makePersistent(String classExpr,
String nameExpr)
Configure persistence for one class. |
void |
maxIdle(CollectionItem collection,
long maxIdle)
Set a max idle time for a collection. |
void |
preloadAllFields(ClassItem cl)
Set all fields of a class to be preloaded |
void |
preloadField(FieldItem field)
Sets a field or collection to be preloaded |
void |
registerStatics(String classExpr,
String nameExpr)
Registers a static name, that is a name that will not be changed by the persistence AC. |
void |
setValueConverter(ClassItem cl,
ClassItem converter)
Associate a String-Object converter with a class |
Method Detail |
public void setValueConverter(ClassItem cl, ClassItem converter)
In order to stock objects in database, those objects must be converted in a String format. Basic classes are already implemented, but for new classes (such as java.awt.Dimension) new converters must be used. New converters can be used with fhis function.
cl
- the class to convertconverter
- the converter used. The class must implement
org.objectweb.jac.aspects.persistenceconf.StringConverter
.StringConverter
public void configureStorage(ClassItem storageClass, String[] storageParameters)
FSStorage
and
PostgresStorage
storageClass
- the storage classstorageParameters
- the parametersFSStorage
,
PostgresStorage
public void makePersistent(String classExpr, String nameExpr)
The persistence type must be PersistenceAC.ROOT (a named object that is an entry point in the storage) or PersistenceAC.PERSISTENT for a regular persistent class.
ROOT objects are always wrapped, PERSISTENT are only wrapped when they become persistent, that is when they are linked to an already persistent object.
classExpr
- class expression of static objectsnameExpr
- name expression of static objectspublic void registerStatics(String classExpr, String nameExpr)
Note that the root objects, as defined by the rtti aspect are automatically considered as static objects by the persistence aspect. Thus, it is useless to define a root object static.
classExpr
- class expression of static objectsnameExpr
- name expression of static objectsRttiConf.addRoot(String)
public void preloadField(FieldItem field)
By default, persistent fields are loaded when accessed. Preloading a field force it to be loaded when the object is created : in the constructor.
field
- the field to preloadpublic void preloadAllFields(ClassItem cl)
Same as preloadField, but for all fields of the class
cl
- the class#preloadField(ClassItem,String)
public void maxIdle(CollectionItem collection, long maxIdle)
The idle time corresponds to the time the collection is loaded in memory without having been accessed. By default, a collection stays in memory when it is loaded. For big collections, it might be interested to define a max idle time. When the max idle time is reached, the persistence aspect unloads this collection from the memory. The collection will be reloaded on the next access.
The frequency the max idle time has be reached is global to
all collection and can be defined by
defineMaxIdleCheckPeriod
collection
- the collection that has a max idlemaxIdle
- the max idle time in msdefineMaxIdleCheckPeriod(long)
public void defineMaxIdleCheckPeriod(long period)
If a collection max idle time is defined and that it has not been used for this time, then the collection is unloaded from the memory by the peristence.
This method is not mandatory, by default, a check period of 200.000 ms is defined.
period
- the period time check in msmaxIdle(CollectionItem,long)
public void disableCache(CollectionItem collection)
Then, the collection will never be loaded in the memory but the objects will be accessed directly in the storage.
|
Contact JAC development team: Renaud Pawlak Lionel Seinturier Laurent Martelli |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |