ITWissen.info - Tech know how online

aspect weaver

The aspect weaver, Aspect Weaver, merges aspect and component code at the connection points. An aspect weaver can weave at different times, e.g. at translation time, load time or runtime. Accordingly also different types of aspect weavers are distinguished.

Aspect weavers are used in the context of aspect-oriented programming( AOP). The task of an aspect weaver is to interweave the program code or also byte code with the aspect code at the defined interweaving points - the join points. The following types of aspect weavers are distinguished:

Aspect weavers

Aspect weavers

Source code weavers Weave the functional program code with the aspect code before translating the program code - source code weaver.

Bytecode weaver

Bytecode weaver

Bytecode weaver Weave the aspect code with the already compiled functional program code - byte code weaver.

Load time weaver Weave the functional byte code of a program with the aspect code at loading time of the program - Link Time Weaver.

Runtime Weaver Weave the aspect code with the loaded functional byte code at run time - run time weaver.

One differentiates in this connection into static weavers (source code and byte code weavers) and dynamic weavers (load time and run time weavers).

The static aspect weavers weave thus the functional program code with the aspect code before and/or after the compilation of the program code. Examples of static aspect weavers are: AspectJ, AspectBench compiler, AspectC#, AspectC++ or HyperJ.

In dynamic aspect weavers, aspect code is interwoven with functional bytecode dynamically at runtime. This requires the most precise information about the objects to be interwoven and the aspects. After interweaving at the previously defined interweaving points (join points), the aspects are part of the objects. The following four approaches exist for this form of dynamic interweaving of aspects:

Wrappers. Here, a special wrapper object is implemented for each object, which is then responsible for the execution of the aspect code. The wrapper object handles all calls and references and is therefore also called a proxy object.

Bytecode Transformation Based on the fact that the aspect code is woven into the loaded classes of the program only at load time, for which the class loader must be replaced. This modifies the implementation of the classes.

Just-In-Time (JIT) This is also referred to as instrumenting the JIT layer, where the JIT compiler and virtual machine must be adapted.

Dynamic Code Instrumentation This involves selectively modifying the bytecode in memory at runtime. The underlying principle is simple; an unconditional jump is simply executed on the aspect code to be weaved in. Before this, the actual program execution is stopped and the register contents are saved. After execution of the aspect code, the original register contents are restored and program execution resumes.

Examples of dynamic aspect weavers are:Rapier-LOOM .NET for the .NET framework, AspectS - aspect-oriented programming (AOP) with Squeak, JBoss Aspect Oriented Programming, Java Aspect Components, JMangler and JMunger. Of particular interest is the JBoss AOP framework, which supports the development of aspect-oriented solutions for Java. This framework can be integrated directly into the JBoss Application Server or also used isolated by the framework providing the required classes. Furthermore JBoss orients itself at the generally valid concepts of the aspect-oriented programming (AOP)

Informations:
Englisch: aspect weaver
Updated at: 01.11.2013
#Words: 532
Links: aspect, code, connection, translation, acoustic overload point (automotive) (AOP)
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024