Wiki

Clone wiki

limeds-framework / Guide To Component Aspects

The framework has a built in mechanism called "Aspects" that allows plug-in modules to execute code right before and right after a FunctionalSegment is executed. This mechanism is used to implement internal framework features such as caching and validation.

LimeDS users can develop their own Aspect to further extend the possibilities of the framework. To do this, two interfaces need to be implemented: AspectFactory (which must be registered as an OSGi service) and Aspect.

AspectFactory requires two methods to be implemented:

  1. getPriority: Use this method to specify the priority of the aspect, this will have an impact on when the aspect will be executed relatively to the other aspects registered with the system.
  2. createInstance: This method allows LimeDS to create appropriate Aspect instances and should return an empty results if the current SegmentContext (the Segment for which the aspect will be used) is incompatible with the aspect.

Aspect requires four methods to be implemented:

  1. init: Defines what to do if the aspect is initialized.
  2. doBefore: Defines what to do before each time the Segment (to which the aspect is being applied) is called.
  3. doAfter: Defines what to do after each time the Segment (to which the aspect is being applied) was called.
  4. destroy: Defines what to do if the aspect is no longer needed.

Updated