BACK TO INDEX
BACK
TO JOAFIP PERSISTENT POJO
Java agent is use to transform byte code to cancel object persistence constraints.
jvm arguments:
with all options off by default
-javaagent: <dir>joafip-java-agent.jar
with option setting
-javaagent: <dir>joafip-java-agent.jar=options
where:
itrans
make transformer working at start of application else need to call JoafipJavaAgent.installTransformer, uninstallTransformer also usable
logbc
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
propertie
file intrumentation.properties, if exist it will be read to enable
code transformation of classes of package and/or classes according to
its contents.
The properties file lines have the form:
xx.xx=storable (or xx.xx="on")
Have
no effect for all classes annotated @NotStorableClass
JOAFIP core classes are annotated not storable, but not the JOAFIP
collections.
or
xx.xx=access
To be
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")
the class
net.sf.joafip.service.JoafipJavaAgent have the following methods
installed
to know if java agent installed
isTransformerInstalled
to know if byte code transformer is installed
isInterceptFieldAccess
to know if java agent add putField and getField instruction interception (add force load of object before access to field)
installTransformer
to install byte code transformer
uninstallTransformer
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:
is final
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