BACK TO INDEX
BACK TO JOAFIP PERSISTENT POJO
Java agent is use to transform byte code to cancel object persistence constraints.
with all options off by default
with option setting
make transformer working at start of application else need to call JoafipJavaAgent.installTransformer, uninstallTransformer also usable
write byte code transformed in <home dir>/logs/classes (helpful for transformation debugging)
By default only classes in package net.sf.joafip and not marked NotStorable are transformed.
The java agent look for a
file intrumentation.properties, if exist it will be read to enable
code transformation of classes of package and/or classes according to
The properties file lines have the form:
xx.xx=storable (or xx.xx="on")
no effect for all classes annotated @NotStorableClass
JOAFIP core classes are annotated not storable, but not the JOAFIP collections.
transform because access directly to persisted instace's field
Where "xx.xx" is a package or full class name (example: form "java.lang.Locale" for "Locale" class in package "java.lang")
net.sf.joafip.service.JoafipJavaAgent have the following methods
to know if java agent installed
to know if byte code transformer is installed
to know if java agent add putField and getField instruction interception (add force load of object before access to field)
to install byte code transformer
to uninstall byte code transformer
If option is present the byte code transformer is installed at start of application before the main of the application is call. This means that all classes load by the JVM are byte code transformed.
case which for the byte code transformation must be activated:
if class instance is persisted and:
have final public method
invoke private method, or access to field, of other instance of its own class or super class
if class instance is not persisted and:
access to public field of persisted class