Reflex

Reflex is not an actively supported project anymore.

Reflex: Multi-Language AOP for Java

Reflex is a versatile kernel for multi-language AOP 2005-GPCE.

This means that Reflex provides, in the context of Java, building blocks for facilitating the implementation of different aspect-oriented languages so that it is easier to experiment with new AOP concepts and languages, and also possible to compose aspects written in different AOP languages. It is built around a flexible intermediate model, derived from reflection, of (point)cuts, links, and metaobjects, to be used as an intermediate target for the implementation of aspect-oriented languages. This is the level at which aspect interactions can be detected and resolved. Below this composition layer, a reflection layer implements the intermediate reflective model. Above the composition layer, a language layer, structured as a plugin architecture, helps bridge the gap between the aspect models and the intermediate model.

Architecture

The architecture of Reflex is as follows:

  • The transformation layer is based on a reflective core extending Java with behavioral and structural reflective facilities. The model of behavioral reflection is based on that presented in 2003-OOPSLA.
  • The composition layer ensures _automatic detection_ of aspect interactions, and provides expressive means for their explicit resolution. The composition facilities of Reflex were presented in 2006-SC-2, and recently, advanced mechanisms for declarative composition of structural aspects were introduced [2006-TR|[2006-SC]].
  • The language layer is now based on the MetaBorg approach for unrestricted embedding and assimilation of domain-specific languages. Concrete syntax for the Reflex kernel API using this approach was presented in 2006-ODAL. The ReLAx case study is the first experiment of a full-fledged domain-specific aspect language with this architecture.

Portability and Dynamicity

In order to be portable, Reflex is implemented as a Java class library. It relies on Javassist to weave hooks in the base bytecode at load-time and connect these hooks to the metalevel, or to add structural elements (methods, classes) according to a Reflex configuration program. Part of this configuration can be modified at runtime through a dynamic configuration API.
Load-time configuration makes it possible to limit program transformation to the program points of interest (partial reflection with spatial selection). Runtime configuration makes it possible to activate/deactiveate the hooks (partial reflection with temporal selection), and access/change metaobjects.

An important property of Reflex is that the MOP of its underlying reflective layer is not fixed but can also be configured. This makes it possible to configure Reflex in order to support efficient static weaving but also makes it possible to support dynamic weaving (although a minimal overhead at the level of the hooks cannot be avoided after unweaving).

Evolution

Reflex first started as an open and portable system for behavioral reflection in Java 2001-Reflection, which then evolved to support a flexible model of partial behavioral reflection 2003-OOPSLA. As these experiments established clear connections between reflection and AOP (Aspect-Oriented Programming), this relation was further explored: this led to the proposal of AOP kernels 2004-EIWAS.

Language Plugins

Note: The information on plugins below can be considered outdated, since we developed a new plugin architecture, integrating the MetaBorg approach. The first experiment with this new approach to extensible language design is ReLAx, an extensible implementation of the KALA domain-specific aspect language for advanced transaction management.

The primitive means to configure Reflex are configuration classes. To raise the level of abstraction, plugins can be provided: a plugin supports an aspect language, and is in charge of generating the appropriate Reflex configuration.

As of today, two plugins are available for Reflex:

To run Reflex with a plugin, the plugin jar file must either be in the ./plugins directory, or in a directory specified by the reflex.config.plugins.path system property. It can also be specified on the command line using the –use <myplugin.jar> argument.

Documentation

Reflex documentation can be found here. Source code is mostly documented, and the distribution comes with a number of illustrative examples.

Publications are good high-level documents on the rationale behind Reflex, although precise APIs may be outdated.

Finally, there are mailing lists to discuss use and development of Reflex.

Download

Reflex is open source. At present it is distributed under the MIT license. You can get access to the latest source code on our Subversion Repository: http://pleiad.dcc.uchile.cl/svn/reflex/, using username guest and password guest. Otherwise you can get the latest snapshot made available: http://pleiad.dcc.uchile.cl/build/reflex-base/package-index.html.

Credits

Chief designer: Éric Tanter

Contributors (alphabetical order): Noury Bouraqadi, Denis Caromel, Pierre Cointe, Peter Ebraert, Alexis Herrera, Benoit Kessler, Luis Mateu, François Nollen, Jacques Noyé, Ángel Nuñez, José Piquer, Guillaume Pothier, Leonardo Rodríguez, Rodolfo Toledo, Michael Vernaillen.

This work was initially developed by Éric Tanter during his PhD thesis.

Also check the Reflex website at École des Mines de Nantes.

See Also

  • ReflexD: ReflexD is a versatile kernel for distributed AOP in Java. ReflexD is implemented as an extension of Reflex, making use of Reflex itself and Java RMI as a base for remote invocation.
  • ReLAx: ReLAx is the implementation of the KALA domain-specific aspect language on top of Reflex.
  • SOM: SOM (Sequential Object Monitors) is a model for concurrent programming based on a thread-less scheduler.
  • POM: POM (Parallel Object Monitors) is a concurrency abstraction for the coordination of parallel activities over single objects and groups of objects in shared memory systems. It allows a clean separation of the coordination concern from the base application code.
  • AJP: AspectJ plugin for Reflex
  • Classboxes: Reflex-based implementation and JastAddJ-based compiler for Classboxes

Acknowledgments

The best Java IDE