|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.jac.core.Wrapper | +--org.objectweb.jac.aspects.persistence.AbstractPersistenceWrapper | +--org.objectweb.jac.aspects.persistence.PersistenceWrapper
This wrapper defines persistence extensions for objects that a defined persitent by a persistent aspect component.
Nested Class Summary | |
static class |
PersistenceWrapper.InvalidOidException
|
Nested classes inherited from class org.objectweb.jac.aspects.persistence.AbstractPersistenceWrapper |
AbstractPersistenceWrapper.InvalidOidException |
Field Summary | |
static String[] |
toWrapForLists
|
static String[] |
toWrapForMaps
|
static String[] |
toWrapForSets
|
Fields inherited from class org.objectweb.jac.aspects.persistence.AbstractPersistenceWrapper |
ATTR_ADDED |
Fields inherited from class org.objectweb.jac.core.Wrapper |
ac, cr |
Constructor Summary | |
PersistenceWrapper(AspectComponent ac)
|
|
PersistenceWrapper(AspectComponent ac,
Boolean doStatics)
|
Method Summary | |
protected void |
addToCollection(Interaction interaction,
OID oid,
CollectionItem collection,
Object value)
This method stores the persistent object that is added to the collection into the storage. |
Object |
applyPersistence(Interaction interaction)
This wrapping method apply the persistence aspect for a given call on a persistent object. |
Object |
construct(ConstructorInvocation invocation)
|
void |
getCollection(Wrappee wrappee,
OID oid,
CollectionItem collection)
This method loads alls the persistent objects that are contained in this collection from the storage. |
void |
getReference(Wrappee wrappee,
OID oid,
FieldItem reference)
This method loads the persistent object that is pointed by the reference from the storage. |
Object |
handleStatic(Interaction interaction)
This wrapping method is called on static objects constructors as defined by the pointcut of PersistenceAC . |
void |
initAllFields(Wrappee wrappee,
OID oid)
Initialize all fields of an object in the storage. |
void |
initCollections(Wrappee wrappee,
OID oid,
CollectionItem[] collections)
|
Object |
invoke(MethodInvocation invocation)
|
void |
loadAllFields(Wrappee wrappee,
OID oid)
Load all the fields of an object from the storage and initialize the object. |
OID |
makePersistent(Wrappee wrappee)
Makes an object persistent if it is not already. |
protected void |
removeFromCollection(Interaction interaction,
OID oid,
CollectionItem collection,
Object value)
This method delete the persistent object that is removed from the collection from the storage. |
protected void |
setField(Wrappee wrappee,
OID oid,
FieldItem field)
This method stores the field into the storage. |
protected void |
setReference(Wrappee wrappee,
OID oid,
FieldItem reference,
Wrappee value)
This method stores the persistent object that is pointed by the reference into the storage. |
void |
updateCollection(CollectionItem collection,
int position)
Update the element of a collection at a gievn position |
void |
wrapCollections(Wrappee wrappee,
OID oid,
boolean isNew)
This role method wraps all the collection of the current wrappee so that they will trigger the needed loads from the storage when they are accessed. |
Methods inherited from class org.objectweb.jac.aspects.persistence.AbstractPersistenceWrapper |
checkOid, getAC, getOID, getStorage, isPersistent, normalizeInput, normalizeOutput |
Methods inherited from class org.objectweb.jac.core.Wrapper |
attr, attrdef, defines, getAspectComponent, getAspectComponentName, getExceptionHandlers, proceed, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String[] toWrapForLists
public static final String[] toWrapForSets
public static final String[] toWrapForMaps
Constructor Detail |
public PersistenceWrapper(AspectComponent ac)
public PersistenceWrapper(AspectComponent ac, Boolean doStatics)
Method Detail |
public Object handleStatic(Interaction interaction)
PersistenceAC
.
PersistenceAC.registerStatics(java.lang.String, java.lang.String)
public OID makePersistent(Wrappee wrappee) throws Exception
wrappee
- the object to make persistent
Exception
public void loadAllFields(Wrappee wrappee, OID oid) throws Exception
wrappee
- the object
Exception
public void wrapCollections(Wrappee wrappee, OID oid, boolean isNew)
wrappee
- the object whose collections to wrapoid
- the oid of wrappeeisNew
- must true if the object is newly created, false if
loaded from storagepublic Object applyPersistence(Interaction interaction) throws Exception
It uses the RTTI aspect to determine the accessed and written field types.
Default behavior is:
Exception
AbstractMethodItem.getAccessedFields()
,
getCollection(Wrappee,OID,CollectionItem)
,
getReference(Wrappee,OID,FieldItem)
,
addToCollection(Interaction,OID,CollectionItem,Object)
,
removeFromCollection(Interaction,OID,CollectionItem,Object)
,
setReference(Wrappee,OID,FieldItem,Wrappee)
,
setField(Wrappee,OID,FieldItem)
,
AbstractMethodItem.getWrittenFields()
,
org.objectweb.jac.core.rttipublic void getCollection(Wrappee wrappee, OID oid, CollectionItem collection) throws Exception
If the collection has already been loaded from the storage, do nothing.
collection
- the collection to load
Exception
protected void addToCollection(Interaction interaction, OID oid, CollectionItem collection, Object value) throws Exception
interaction
- the current interactionoid
- the oid of the object holding the collectioncollection
- the collection to add tovalue
- the value to add to the collection
Exception
removeFromCollection(Interaction,OID,CollectionItem,Object)
,
getCollection(Wrappee,OID,CollectionItem)
protected void removeFromCollection(Interaction interaction, OID oid, CollectionItem collection, Object value) throws Exception
interaction
- the current interactionoid
- the oid of the object holding the collectioncollection
- the collection to remove fromvalue
- the value to remove from the collection
Exception
addToCollection(Interaction,OID,CollectionItem,Object)
,
getCollection(Wrappee,OID,CollectionItem)
public void updateCollection(CollectionItem collection, int position) throws Exception
Exception
public void getReference(Wrappee wrappee, OID oid, FieldItem reference) throws Exception
If the reference has already been loaded from the storage, do nothing.
reference
- the reference to load
Exception
setReference(Wrappee,OID,FieldItem,Wrappee)
protected void setReference(Wrappee wrappee, OID oid, FieldItem reference, Wrappee value) throws Exception
reference
- the reference to store
Exception
getReference(Wrappee,OID,FieldItem)
protected void setField(Wrappee wrappee, OID oid, FieldItem field) throws Exception
field
- the field to store
Exception
public void initCollections(Wrappee wrappee, OID oid, CollectionItem[] collections) throws Exception
Exception
public void initAllFields(Wrappee wrappee, OID oid) throws Exception
This method is called when a new object is made persistent. The references and collections are also recursively saved into the storage.
wrappee
- the initialized object
Exception
public Object invoke(MethodInvocation invocation) throws Throwable
invoke
in interface MethodInterceptor
invoke
in class Wrapper
Throwable
public Object construct(ConstructorInvocation invocation) throws Throwable
construct
in interface ConstructorInterceptor
construct
in class Wrapper
Throwable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |