org.sonar.api.batch
Class AbstractSourceImporter

java.lang.Object
  extended by org.sonar.api.batch.AbstractSourceImporter
All Implemented Interfaces:
CheckProject, Sensor, BatchComponent, BatchExtension, Extension

public abstract class AbstractSourceImporter
extends Object
implements Sensor

A pre-implementation for a sensor that imports sources. It became too much ugly because of extensability. Methods can't be refactored because they are heavily overridden in plugins.

Since:
1.10

Field Summary
 
Fields inherited from interface org.sonar.api.batch.Sensor
FLAG_SQUID_ANALYSIS
 
Constructor Summary
AbstractSourceImporter(Language language)
           
 
Method Summary
protected  void analyse(ProjectFileSystem fileSystem, SensorContext context)
           
 void analyse(Project project, SensorContext context)
          The method that is going to be run when the sensor is called
protected  Resource createResource(File file, List<File> sourceDirs, boolean unitTest)
           
 Language getLanguage()
           
protected  boolean isEnabled(Project project)
           
protected  void onFinished()
           
protected  void parseDirs(SensorContext context, List<File> files, List<File> sourceDirs, boolean unitTest, Charset sourcesEncoding)
           
 boolean shouldExecuteOnProject(Project project)
          Generally this method should not be overridden in subclasses, but if it is, then it should be executed anyway (see SONAR-3419).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSourceImporter

public AbstractSourceImporter(Language language)
Method Detail

shouldExecuteOnProject

public boolean shouldExecuteOnProject(Project project)
Generally this method should not be overridden in subclasses, but if it is, then it should be executed anyway (see SONAR-3419).

Specified by:
shouldExecuteOnProject in interface CheckProject

analyse

public void analyse(Project project,
                    SensorContext context)
The method that is going to be run when the sensor is called

Specified by:
analyse in interface Sensor
Parameters:
project - the project the sensor runs on
context - the context

onFinished

protected void onFinished()

analyse

protected void analyse(ProjectFileSystem fileSystem,
                       SensorContext context)

parseDirs

protected void parseDirs(SensorContext context,
                         List<File> files,
                         List<File> sourceDirs,
                         boolean unitTest,
                         Charset sourcesEncoding)

createResource

protected Resource createResource(File file,
                                  List<File> sourceDirs,
                                  boolean unitTest)

isEnabled

protected boolean isEnabled(Project project)

getLanguage

public Language getLanguage()
Returns:
the language


Copyright © 2009-2014 SonarSource. All Rights Reserved.