Generating a Clara-compatible monitor automatically
Programmers can write Clara-compatible runtime monitors manually, but writing such monitoring aspects can be quite tedious and error-prone. Usually it is easier to have a tool generate the monitors for you, from a high-level monitor description. There are several tools out there that generate some form of monitoring aspects already:
- Tracematches, implemented in the AspectBench Compiler
- JavaMOP, which generates finite-state monitors from specifications in the form of Extended Regular Expressions and Past-time and Future-time Linear Temporal Logic,
- J-LO, which generates monitors from special Linear-temporal Logic formulae,
- Association Aspects,
- Relational Aspects,
- S2A for Live Sequence Charts, and
- M2Aspects for Message Sequence Charts.
Tracematches and Relational Aspects
Tracematches and Relational Aspects are fully compatible with Clara in the sense that they generate a monitoring aspect that is annotated with a Dependency State Machine. Clara can fully analyze and optimize programs that are woven with these aspects. For those two formalisms, Clara even has a special tool integration. Because both Tracematches and Relational Aspects are implemented as an extension to the AspectBench Compiler, just as Clara, we do not write the annotated aspects to disk (as source file) but instead process them internally, directly within the compiler. In result, the programmer only needs to supply the Tracematch or Relational Aspect to the compiler, enable the right command-line options and everything else happens from there automatically.
- You can find some example tracematches here.
For all finite-state formalisms supported by JavaMOP (ERE, FTLTL, PTLTL) we currently have support for Dependent Advice, but not Dependency State Machines. Just add the flag get-dependency to your JavaMOP specification and this will cause JavaMOP to annotate the generated AspectJ with Dependent-Advice annotations.
Unfortunately, as of now, JavaMOP cannot yet generate Dependency State Machines. Implementing such support would be no problem, it just has not been done yet. Because Dependent-Advice annotations only convey flow-insensitive information, Clara can optimize JavaMOP monitors only using its first two analysis stages, the Quick Check and the Orphan-Shadows Analysis. Of course, programmers can easily replace the Dependent-Advice annotations that JavaMOP genrates by Dependency State Machines manually. In fact that’s what we did when testing Clara.
All other tools
All other tools cannot currently generate aspects that would contain Dependent Advice or Dependency State Machines. Again, in principle they could, it just has not been implemented yet. Programmers can use these tools to generate monitoring aspects and then annotate these aspects manually.