org.sonar.api.resources
Interface ProjectFileSystem

All Superinterfaces:
BatchComponent
All Known Implementing Classes:
DefaultProjectFileSystem

public interface ProjectFileSystem
extends BatchComponent

Since:
1.10

Method Summary
 ProjectFileSystem addSourceDir(File dir)
          Deprecated. since 2.6 - ProjectFileSystem should be immutable See http://jira.codehaus.org/browse/SONAR-2126
 ProjectFileSystem addTestDir(File dir)
          Deprecated. since 2.6 - ProjectFileSystem should be immutable See http://jira.codehaus.org/browse/SONAR-2126
 File getBasedir()
          Project root directory.
 File getBuildDir()
          Build directory.
 File getBuildOutputDir()
          Directory where classes are placed.
 File getFileFromBuildDirectory(String filename)
           
 List<File> getJavaSourceFiles()
          Deprecated. since 2.6 use mainFiles(String...) instead. See http://jira.codehaus.org/browse/SONAR-2126
 File getReportOutputDir()
           
 File getSonarWorkingDirectory()
           
 Charset getSourceCharset()
          Source encoding.
 List<File> getSourceDirs()
          The list of directories for sources
 List<File> getSourceFiles(Language... langs)
          Deprecated. since 2.6 use mainFiles(String...) instead. See http://jira.codehaus.org/browse/SONAR-2126
 List<File> getTestDirs()
          The list of directories for tests
 List<File> getTestFiles(Language... langs)
          Deprecated. since 2.6 use testFiles(String...) instead. See http://jira.codehaus.org/browse/SONAR-2126
 boolean hasJavaSourceFiles()
          Deprecated. since 2.6 - API should be language agnostic
 boolean hasTestFiles(Language lang)
          Deprecated. since 2.6 - use language key instead of Language object
 List<InputFile> mainFiles(String... langs)
          Source files, excluding unit tests and files matching project exclusion patterns.
 File resolvePath(String path)
          Get file from path.
 List<InputFile> testFiles(String... langs)
          Source files of unit tests.
 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. Never null, it returns the default platform charset if it is not defined in 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()
Directory where classes are placed. It's "${basedir}/target/classes" by default in Maven projects.


getSourceDirs

List<File> getSourceDirs()
The list of directories for sources


addSourceDir

@Deprecated
ProjectFileSystem addSourceDir(File dir)
Deprecated. since 2.6 - ProjectFileSystem should be immutable See http://jira.codehaus.org/browse/SONAR-2126

Adds a source directory

Returns:
the current object

getTestDirs

List<File> getTestDirs()
The list of directories for tests


addTestDir

@Deprecated
ProjectFileSystem addTestDir(File dir)
Deprecated. since 2.6 - ProjectFileSystem should be immutable See http://jira.codehaus.org/browse/SONAR-2126

Adds a test directory

Returns:
the current object

getReportOutputDir

File getReportOutputDir()
Returns:
the directory where reporting is placed. Default is target/sites

getSonarWorkingDirectory

File getSonarWorkingDirectory()
Returns:
the Sonar working directory. Default is "target/sonar"

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

@Deprecated
List<File> getSourceFiles(Language... langs)
Deprecated. since 2.6 use mainFiles(String...) instead. See http://jira.codehaus.org/browse/SONAR-2126

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

@Deprecated
List<File> getJavaSourceFiles()
Deprecated. since 2.6 use mainFiles(String...) instead. See http://jira.codehaus.org/browse/SONAR-2126

Java source files, excluding unit tests and files matching project exclusion patterns. Shortcut for getSourceFiles(Java.INSTANCE)


hasJavaSourceFiles

@Deprecated
boolean hasJavaSourceFiles()
Deprecated. since 2.6 - API should be language agnostic

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


getTestFiles

@Deprecated
List<File> getTestFiles(Language... langs)
Deprecated. since 2.6 use testFiles(String...) instead. See http://jira.codehaus.org/browse/SONAR-2126

Unit test files, excluding files matching project exclusion patterns.


hasTestFiles

@Deprecated
boolean hasTestFiles(Language lang)
Deprecated. since 2.6 - use language key instead of Language object

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)

mainFiles

List<InputFile> mainFiles(String... langs)
Source files, excluding unit tests and files matching project exclusion patterns.

Parameters:
langs - language filter. If null or empty, will return empty list
Since:
2.6

testFiles

List<InputFile> testFiles(String... langs)
Source files of unit tests. Exclusion patterns are not applied.

Parameters:
langs - language filter. If null or empty, will return empty list
Since:
2.6


Copyright © 2009-2011 SonarSource. All Rights Reserved.