next up previous contents
Next: Load-Time Adaptation Up: Static Adaptation Previous: Static Adaptation

Binary Component Adaptation

The Binary Component Adaptation (BCA) [#!Keller1998!#] shifts parts of the adaptation from the compilation time towards the runtime.

The BCA mechanism applies adaptation to classes. Attributes, methods and modifiers of classes can be removed, added or changed without needing to access the source code. The modifications are specified in an adaptation file which is compiled into a binary delta file . The delta file is then being merged with the original binary resources during loading and adapted binary code is produced. Keller et al. used the Java technology for the implementation of their prototype.

  
Figure: Procedure of class loading in BCA

The heart of the BCA technique is a modified class loader. The original procedure of class loading [#!LiYe1999!#] is extended by a modifier and a delta file compiler (s. fig. [*]). In the original procedure a class file is loaded by the class loader and translated into an internal representation. The internal representation is then checked by the verifier to guarantee that no JVM rules are violated. In the modified procedure the BCA modifier is inserted between class loader and verifier. The modifier takes a class in the internal representation from the class loader and adapts the class according to the specification in the binary delta file. The delta file was generated from the adaptation file. In the adaptation file the programmer can define the modifications on a class in a syntax similar to Java. For example if the programmer wants to add an interface Printable and an implementation of a method print(String msg) as defined in the interface to a class A, the adaptation file would look as follows:
delta class A {
      add interface Printable;
      add method public void print(String msg){
          System.out.println(msg); 
      }
}
After the modification of the loaded class file it is passed to the verifier and executed by the interpreter or a just-in-time compiler (JIT).

Though BCA offers adaptation not only at compilation time, but also at load time - as imposed by R5 - in its original from it is not suitable for dynamic adaptation. It assumes that there is at maximum one delta file for a class file and does not provide any functionality to perform a environment specific selection of a delta file out of a set of delta files.


next up previous contents
Next: Load-Time Adaptation Up: Static Adaptation Previous: Static Adaptation
Copyright Munich Network Management Team