org.sonar.api.resources
Interface ProjectFileSystem

All Known Implementing Classes:
DefaultProjectFileSystem

public interface ProjectFileSystem

Since:
1.10

Method Summary
 ProjectFileSystem addSourceDir(File dir)
           
 ProjectFileSystem addTestDir(File dir)
           
 File getBasedir()
          Project root directory.
 File getBuildDir()
          Build directory.
 File getBuildOutputDir()
           
 File getFileFromBuildDirectory(String filename)
           
 List<File> getJavaSourceFiles()
          Java source files, excluding unit tests and files matching project exclusion patterns.
 File getReportOutputDir()
           
 File getSonarWorkingDirectory()
           
 Charset getSourceCharset()
          Source encoding.
 List<File> getSourceDirs()
           
 List<File> getSourceFiles(Language... langs)
          Source files, excluding unit tests and files matching project exclusion patterns.
 List<File> getTestDirs()
           
 List<File> getTestFiles(Language... langs)
          Unit test files, excluding files matching project exclusion patterns.
 boolean hasJavaSourceFiles()
          Check if the project has Java files, excluding unit tests and files matching project exclusion patterns.
 boolean hasTestFiles(Language lang)
          Check if the project has unit test files, excluding files matching project exclusion patterns.
 File resolvePath(String path)
          Get file from path.
 Resource toResource(File file)
           
 File writeToWorkingDirectory(String content, String fileName)
          Save data into a new file of Sonar working directory.
 

Method Detail

getSourceCharset

Charset getSourceCharset()
Source encoding. It's the default plateform charset if it is not defined in the project (Maven property 'project.build.sourceEncoding').


getBasedir

File getBasedir()
Project root directory.


getBuildDir

File getBuildDir()
Build directory. It's "${basedir}/target" by default in Maven projects.


getBuildOutputDir

File getBuildOutputDir()

getSourceDirs

List<File> getSourceDirs()

addSourceDir

ProjectFileSystem addSourceDir(File dir)

getTestDirs

List<File> getTestDirs()

addTestDir

ProjectFileSystem addTestDir(File dir)

getReportOutputDir

File getReportOutputDir()

getSonarWorkingDirectory

File getSonarWorkingDirectory()

resolvePath

File resolvePath(String path)
Get file from path. It can be absolute or relative to project basedir. For example resolvePath("pom.xml") or resolvePath("src/main/java")


getSourceFiles

List<File> getSourceFiles(Language... langs)
Source files, excluding unit tests and files matching project exclusion patterns.

Parameters:
langs - language filter. Check all files, whatever their language, if null or empty.

getJavaSourceFiles

List<File> getJavaSourceFiles()
Java source files, excluding unit tests and files matching project exclusion patterns. Shortcut for getSourceFiles(Java.INSTANCE)


hasJavaSourceFiles

boolean hasJavaSourceFiles()
Check if the project has Java files, excluding unit tests and files matching project exclusion patterns.


getTestFiles

List<File> getTestFiles(Language... langs)
Unit test files, excluding files matching project exclusion patterns.


hasTestFiles

boolean hasTestFiles(Language lang)
Check if the project has unit test files, excluding files matching project exclusion patterns.


writeToWorkingDirectory

File writeToWorkingDirectory(String content,
                             String fileName)
                             throws IOException
Save data into a new file of Sonar working directory.

Returns:
the created file
Throws:
IOException

getFileFromBuildDirectory

File getFileFromBuildDirectory(String filename)

toResource

Resource toResource(File file)


Copyright © 2009-2010 SonarSource. All Rights Reserved.