Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Extension points

Here is list of extension points available in the sonar plugin API. Please note that partial implementation of those extensions are available in the api as well. Check the Javadoc for more information.

List of extensions

Chart

This extension is used to create chart components based on JFreeChart

CpdMapping

This extension is used to configure and handle PMD-CPD to find duplication

DashboardWidget

This extensions is used to add a new HTML component inside the project dashboard

Decorator

This extension is used to decorate resources, i.e. add measures. Decorator are called on every resource of the resource tree and only have acces to the resource and its children

DependsUponMavenPlugin

TBD

Footer

This extension is used to define a footer

GwtExtension

This extension is used to define a page written using GWT

Language

This extension is used and is mandatory to cover a new language

MavenPluginHandler

This extension is used to configure and handle a maven plugin

Metrics

This extension is used to create a new Metric. It can be quantitative (lines of code, number of rule violations) or qualitative (code coverage, complexity by class, rules compliance). As a rule, a metric is used to store a number but it can also be used to store a text field with list of key/value pairs, an XML or even binary document

Page

This extension is used to define a new web page and add an entry point in the left Sonar sidebar. The new page should be implemented as a GWT component

PostJob

This extension is used to run a job after every other job. For example purge, report generation...

Purge

TBD

ResourceViewer

This extension is used to add a new tab to the source viewer along with "Violations", "Sources", "Coverage", etc. The new tab should be implemented as a GWT component

RubyRailsPage

TBD

RubyRailsWebservice

TBD

RubyRailsWidget

TBD

RulesRepository

This extension is used to define a new repository of rule, i.e. a list of coding rules to publish into the global rules referential

Sensor

This extension is used to analyze sources or make requests on other systems for instance in order to feed Sonar. A sensor has access to the complete tree of resources.

SquidSearch

TBD

TimeMachine

TBD

View

TBD

WebPage

TBD

Webservice

TBD

Widget

TBD

Sensor or Decorator ?

There are two extensions that enables to save measures : Sensor and Decorator. A common problem when writing a plugin is to decide which one to use.

Sensor

A Sensor is invoked once during the analysis of a project. The sensor can invoke a maven plugin, parse a flat file, connect to a web server... For example the Cobertura Sensor invokes the Codehaus Cobertura MOJO. Then the generated XML file is parsed and used to save the first-level of measures on resources (project, package or class).
A sensor has can access and save measures on the whole tree of resources. Sensor are generally used to add measure at the lowest level of the resource tree.

Decorator

Decorators are triggered once all sensors have completed. Their decorate method is called on every resource of a certain level bottom up. Decorators can load (SELECT) and save (INSERT) measures. The call is contextual, i.e it is only possible to access the resource and its children.
Decorators are generally used either to consolidate at higher levels measures that have been added by Sensors at the lowest level.

  • No labels