Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 0cfcb5752fd5bab453ee4654b78df045 > files > 9

jiapi-manual-0.4.0-8.mga7.noarch.rpm

<html>
<body>

<h1>Jiapi: Java Instrumentation API</h1>

<p>
<h2>What is Jiapi?</h2>

When a Java virtual machine encounters a request for a class which
hasn't been loaded to its memory, it consults a class loader to locate
and load the class. Typically, the classes are loaded from a filesystem 
or URL as a bytecode array and then converted into an instance of class 
<code>java.lang.Class</code> within the virtual machine. Jiapi is a tool 
which can be used to alter this normal class loading behavior. Instead 
of letting the class to be loaded as it is, Jiapi is used to manipulate 
classes' bytecode. The manipulated class is then passed to a class loader 
which loads it into a Java virtual machine. In addition to just
described <i>just-in-time bytecode weaving</i>, Jiapi can be used to
instrument a class <i>ahead-of-time</i>. In this mode compiled classes
are preprocessed by Jiapi instrumentors and modified classes are then
serialized on a filesystem to be executed later.

<p>
This whole process can be arranged so that it is transparent to a class
being manipulated. This transparency can be utilized by several types
of applications:
<ul>
  <li><b>Debugging tools</b></li>
  Debugger could add tracing information in between the original
  bytecode of a class.
  <li><b>Profiling tools</b></li>
  A profiling application could manipulate classes by adding "hooks"
  which can be caught at runtime to them. This way it is possible 
  to analyze and visualize the runtime characteristics of a program 
  without touching the code itself.
  <li><b>Aspect oriented programming tools</b></li>
  AOP compilers could utilize Jiapi as a bytecode weaver.
  <li><b>etc...</b></li>
</ul>

<p>
The focus of a project is to provide:
<ul>
  <li>a framework to implement instruments which manipulate Java bytecode  
  <li>implementations for common bytecode manipulations
  <li>an abstraction for some of the details in bytecode structure
  <li>easy to use event based API and runtime hooks for application developers
  <li>instrumentation configuration tools
  <li>ClassLoaders utilizing bytecode instrumentation
  <li>class loading plugins for application servers
</ul>


<p>
Jiapi realization can be viewed as a layered architecture where each
layer is implemented on top the lower layer. 

<pre>

    +--------------------------------+
    |         Applications           |
    |                                |
    +--------------+                 |
    | Jiapi events |                 |  alt.jiapi.event
    +--------------+-------+         |
    |   Jiapi framework    |         |  alt.jiapi, alt.jiapi.instrumentor
    |                      |         |
    +----------------------+---------+
    |       Jiapi reflection         |  alt.jiapi.reflect
    |                                |
    +--------------------------------+
    |       Jiapi file               |  alt.jiapi.file
    +--------------------------------+

</pre>

These layers are described in <a href="user_guide.html">a user guide</a>
starting from bottom up.


</body>
</html>