SPLevo/Development/VPMAnalyzer

Aus SDQ-Wiki

Variation Point Model Analyzer (VPMAnalyzer) are used in SPLevo to realize basic analyses to find relationships between variation points. Further information about the variation point analysis itself can be found at SPLevo/Variation Point Analysis.

The SPLevo infrastructure provides an Eclipse extension point to develop such basic VPMAnalyzer as an Eclipse Plugin (OSGi Bundle) and install it in the Eclipse enviornment. It will automatically become available in the vpm analysis selection dialog SPLevo/Quick Start.

VPM Analyzer Extension Point

VPM Analyzer Extension Point

The VPMAnalyzer extension point requires to specify an analyzer class that implements the VPMAnalyzer Java interface.


Extension Point Classes

The recommended way to implement such an analyzer class is to derive the AbstractVPMAnalyzer. This abstract analyzer provides methods for handling variation point graph nodes and a logging infrastructure to trace detailed information about the relationships detected.

The main method of an analyzer is the analyzer(VPMGraph) method returning a VPMAnalysisResult. Such a result object holds a reference to the analyzer that produced it and a list of VPMEdgeDescriptors. An edge descriptor documents the relationship detected by the implemented relationship analysis. These descriptors are processed by the SPLevo infrastructure to enhance the VPM graph with those relationships. The graph manipulation is not directly done by the individual analyzers to prevent any synchronization issues because multiple VPMAnalyzers can be executed in parallel.

Analyzer Configurations

Configuration Definition Types

An analyzer can specify a set of configuration available to configure his analysis. For this, the VPMAnalyzer inteface has a method getAvailableConfigurations() which returns a map of configuration ids and ConfigurationDefinitions. The later specifies the what type of values are allowed for a specific configuration.
These configuration definitions are used, for example, by the SPLevo user interface. If an engineer has added and highlighted an analyzer, the UI presents a configuration table to him. Which options and and UI elements are provided is specified by the individual ConfigurationDefinitions.

The class diagram on the right presents the hierarchy of available configuration definition types. In general, the configuration can be either a free text field or a drop down box providin prespecified choices to select from.

  • A text input field is created in the UI for any type of IntegerConfigDefinition, DoubleConfigDefinition, BooleanConfigDefinition, or StringConfigDefinition.
  • A drown down box is created for any ChoiceConfigDefinition<T>. The concrete datatype of the choices is specified by the type paremeter. For example, new ChoiceConfigDefinition<String>() would allow to select from string values.
    A special case is the derived BooleanChoiceConfigDefinition which already holds true and false as the typical boolean alternatives.

Recommendation

It is recommended to invoke setDefaultConfigurations() in the analyzers constructor. This forces the analyzer to set the default values of all configurations in the created analyzers configuration map.

Example

If an analyzer should have a boolean configuration and the user should be provided with a drop down box to select from, one could implement the getAvailableConfigurations() as

   @Override
   public Map<String, ConfigDefinition> getAvailableConfigurations() {
       Map<String, ConfigDefinition> availableConfigurations = new HashMap<String, ConfigDefinition>();
       availableConfigurations.put(MY_CONFIG_ID, new BooleanChoiceConfigDefintion());
       return availableConfigurations;
   }

and during the analysis process the configuration set by the user can be accessed by

   getConfiguration().get(MY_CONFIG_ID);

Analysis Trace Log

The VPMAnalyzer provides an infrastructure to log detailed information about the relationships identified by an VPMAnalyzer. Logging these information is handled fully transparent for the individual VPMAnalyzer. The AbstractVPMAnalyzer provides two logAnalysisInfo() methods accepting identifiers for the related variation points (i.e. vp1ID and vp2ID), information about the source and target of the relationship (i.e. sourceInfo and targetInfo) and an optional remark.

In the background the logs are stored with a log4j infrastructure to reduce the overhead. When the VPM Analysis workflow is started from the SPLevo Dashboard, the workflow initializes an according Log4J appender to write the logging into csv file inside the log directory of the current SPLevo project. The name of the log file is enhanced with the current timestamp to identify the right log file.

CSVEdit Plugin for Analysis Trace Log

To check this logfile and use order and filter capabilities, the csvedit Eclipse plugin is recommended as an viewer/editor for these files: