Package org.apache.rat
Class ReportConfiguration
java.lang.Object
org.apache.rat.ReportConfiguration
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A wrapper around an output stream that does not close the output stream.static enum
The styles of processing for various categories of documents. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addApprovedLicenseCategories
(Collection<String> approvedLicenseCategories) Adds a collection of license family categories to the set of approved license names.void
addApprovedLicenseCategory
(String familyCategory) Adds a license family category (id) to the list of approved licensesvoid
addApprovedLicenseCategory
(ILicenseFamily approvedILicenseFamily) Adds an ILicenseFamily to the list of approved licenses.void
addApprovedLicenseId
(String licenseId) Adds a license family category (id) to the list of approved licensesvoid
addApprovedLicenseId
(ILicense approvedLicense) Adds an ILicenseFamily to the list of approved licenses.void
addApprovedLicenseIds
(Collection<String> approvedLicenseIds) Adds a collection of license family categories to the set of approved license names.void
addExcludedCollection
(StandardCollection collection) Excludes a StandardCollection of patterns.void
addExcludedFileProcessor
(StandardCollection collection) Excludes the file processor defined in the StandardCollection.void
addExcludedFilter
(FileFilter fileFilter) Excludes files that match a FileFilter.void
addExcludedMatcher
(DocumentNameMatcher matcher) Excludes files that match a DocumentNameMatcher.void
addExcludedPatterns
(Iterable<String> patterns) Excludes files that match the pattern.void
addFamilies
(Collection<ILicenseFamily> families) Adds multiple families to the list of license families.void
addFamily
(ILicenseFamily family) Adds a license family to the list of families.void
addFamily
(ILicenseFamily.Builder builder) Adds a license family to the list of families.void
addIncludedCollection
(StandardCollection collection) Adds the patterns from the standard collection as included patterns.void
addIncludedFilter
(FileFilter fileFilter) Adds the fileFilter to filter files that should be included, this overrides any exclusion of the same files.void
addIncludedPatterns
(Iterable<String> patterns) Add file patterns that are to be included.void
addLicense
(ILicense license) Adds a license to the list of licenses.addLicense
(ILicense.Builder builder) Adds a license to the list of licenses.void
addLicenses
(Collection<ILicense> licenses) Adds multiple licenses to the list of licenses.void
Adds a file as a source of files to scan.void
addSource
(IReportable reportable) Adds a Reportable as a source of files to scan.void
Sets the reporting option for duplicate license families.Retrieves the archive processing type.Gets the ClaimValidator for the configuration.Returns the optional license copyright being added if RAT is adding headers.getDocumentExcluder
(DocumentName baseDir) Get the DocumentNameMatcher that excludes files found in the directory tree..Gets the matcher that matches generated text.Gets the SortedSet of approved license categories.Gets a sorted set of ILicenseFamily objects based onfilter
. if filter is set:all
- All licenses families will be returned.approved
- Only approved license families will be returnednone
- No license families will be returnedGets the SortedSet of approved license categories.Gets the SortedSet of approved license categories.Gets the enclosed LicenseSetFactory.org.apache.commons.io.function.IOSupplier
<OutputStream> Returns the output stream supplier.Gets a builder initialized with any files specified as sources.Retrieves the archive processing type.org.apache.commons.io.function.IOSupplier
<InputStream> Gets the IOSupplier with the style sheet.org.apache.commons.io.function.IOSupplier
<PrintWriter> Gets a PrintWriter that wraps the output stream.boolean
Returnstrue
if the configuration has any sources defined.boolean
Gets the flag that determines if license headers should be added if missing.boolean
Gets the flag that determines if license headers are "forced" overwriting existing files.boolean
isDryRun()
Returns the state of the dry run flag.void
Sets the reporting option for duplicate licenses.Return the current filter that determines which families will be output in the XML document.void
Set the level of license families that should be output in the XML document.Gets the selected license filter.void
Set the level of licenses that should be output in the XML document.void
logFamilyCollisions
(Log.Level level) Set the log level for reporting collisions in the set of license families.void
logLicenseCollisions
(Log.Level level) Sets the log level for reporting license collisions.void
removeApprovedLicenseCategories
(Collection<String> familyCategory) Removes a license family category from the list of approved licenses.void
removeApprovedLicenseCategory
(String familyCategory) Adds a license family category to the list of approved licenses.void
removeApprovedLicenseId
(String licenseId) Adds a license family category to the list of approved licenses.void
removeApprovedLicenseIds
(Collection<String> licenseIds) Removes a license family category from the list of approved licenses.void
setAddLicenseHeaders
(AddLicenseHeaders addLicenseHeaders) Sets whether RAT should enable, disable, or force the adding of license headers.void
setArchiveProcessing
(ReportConfiguration.Processing archiveProcessing) Sets the archive processing type.void
setCopyrightMessage
(String copyrightMessage) Sets the optional copyright message used if RAT is adding license headers.void
setDryRun
(boolean state) Sets the dry run flag.void
Adds the licenses and approved licenses from the defaults object to the configuration.void
Sets the OutputStream supplier to use the specified file.void
setOut
(org.apache.commons.io.function.IOSupplier<OutputStream> out) Sets the supplier for the output stream.void
setStandardProcessing
(ReportConfiguration.Processing standardProcessing) Sets the archive processing type.void
setStyleSheet
(File styleSheet) Sets the style sheet.void
setStyleSheet
(URI styleSheet) Sets the style sheet for custom processing.void
setStyleSheet
(URL styleSheet) Sets the style sheet for custom processing.void
setStyleSheet
(org.apache.commons.io.function.IOSupplier<InputStream> styleSheet) Sets the style sheet for custom processing.void
Validates that the configuration is valid.
-
Constructor Details
-
ReportConfiguration
public ReportConfiguration()Constructor
-
-
Method Details
-
addSource
Adds a file as a source of files to scan. The file must be a text file that lists files to be included. File within the file must be in linux format with a "/" file separator.- Parameters:
file
- the file to process.
-
addSource
Adds a Reportable as a source of files to scan.- Parameters:
reportable
- the reportable to process.
-
hasSource
public boolean hasSource()Returnstrue
if the configuration has any sources defined.- Returns:
true
if the configuration has any sources defined.
-
getSources
Gets a builder initialized with any files specified as sources.- Returns:
- a configured builder.
-
getGeneratedMatcher
Gets the matcher that matches generated text.- Returns:
- the matcher that matches generated text.
-
getArchiveProcessing
Retrieves the archive processing type.- Returns:
- The archive processing type.
-
setArchiveProcessing
Sets the archive processing type. If not set will default to NOTIFICATION.- Parameters:
archiveProcessing
- the type of processing archives should have.
-
getStandardProcessing
Retrieves the archive processing type.- Returns:
- The archive processing type.
-
setStandardProcessing
Sets the archive processing type. If not set will default to NOTIFICATION.- Parameters:
standardProcessing
- the type of processing archives should have.
-
logFamilyCollisions
Set the log level for reporting collisions in the set of license families.NOTE: should be set before licenses or license families are added.
- Parameters:
level
- The log level to use.
-
familyDuplicateOption
Sets the reporting option for duplicate license families.- Parameters:
state
- The ReportingSet.Option to use for reporting.
-
logLicenseCollisions
Sets the log level for reporting license collisions.- Parameters:
level
- The log level.
-
licenseDuplicateOption
Sets the reporting option for duplicate licenses.- Parameters:
state
- the ReportingSt.Option to use for reporting.
-
listFamilies
Set the level of license families that should be output in the XML document.- Parameters:
filter
- the license families to list.
-
listFamilies
Return the current filter that determines which families will be output in the XML document.- Returns:
- the filter that defines the families to list.
-
listLicenses
Set the level of licenses that should be output in the XML document.- Parameters:
filter
- the licenses to list.
-
listLicenses
Gets the selected license filter.- Returns:
- the filter to limit license display.
-
setDryRun
public void setDryRun(boolean state) Sets the dry run flag.- Parameters:
state
- the state for the dry run flag.
-
isDryRun
public boolean isDryRun()Returns the state of the dry run flag.- Returns:
- the state of the dry run flag.
-
addExcludedCollection
Excludes a StandardCollection of patterns.- Parameters:
collection
- the StandardCollection to exclude.- See Also:
-
addExcludedFileProcessor
Excludes the file processor defined in the StandardCollection.- Parameters:
collection
- the StandardCollection to exclude.- See Also:
-
addExcludedFilter
Excludes files that match a FileFilter.- Parameters:
fileFilter
- the file filter to match.
-
addExcludedMatcher
Excludes files that match a DocumentNameMatcher.- Parameters:
matcher
- the DocumentNameMatcher to match.
-
addExcludedPatterns
Excludes files that match the pattern.- Parameters:
patterns
- the collection of patterns to exclude.- See Also:
-
addIncludedCollection
Adds the patterns from the standard collection as included patterns.- Parameters:
collection
- the standard collection to include.
-
addIncludedFilter
Adds the fileFilter to filter files that should be included, this overrides any exclusion of the same files.- Parameters:
fileFilter
- the filter to identify files that should be included.
-
addIncludedPatterns
Add file patterns that are to be included. These patterns override any exclusion of the same files.- Parameters:
patterns
- The iterable of Strings containing the patterns.
-
getDocumentExcluder
Get the DocumentNameMatcher that excludes files found in the directory tree..- Parameters:
baseDir
- the DocumentName for the base directory.- Returns:
- the DocumentNameMatcher for the base directory.
-
getStyleSheet
Gets the IOSupplier with the style sheet.- Returns:
- the Supplier of the InputStream that is the XSLT style sheet to style the report with.
-
setStyleSheet
Sets the style sheet for custom processing. The IOSupplier may be called multiple times, so the input stream must be able to be opened and closed multiple times.- Parameters:
styleSheet
- the XSLT style sheet to style the report with.
-
setFrom
Adds the licenses and approved licenses from the defaults object to the configuration. Side effect: if the report should be styled and no style sheet has been set the plain stylesheet from the defaults will be used.- Parameters:
defaults
- The defaults to set.
-
setStyleSheet
Sets the style sheet.- Parameters:
styleSheet
- the XSLT style sheet file to style the report with.
-
setStyleSheet
Sets the style sheet for custom processing. The stylesheet may be opened multiple times so the URI must be capable of being opened multiple times.- Parameters:
styleSheet
- the URI of the XSLT style sheet to style the report with.
-
setStyleSheet
Sets the style sheet for custom processing. The stylesheet may be opened multiple times so the URL must be capable of being opened multiple times.- Parameters:
styleSheet
- the URL of the XSLT style sheet to style the report with.
-
setOut
Sets the supplier for the output stream. The supplier may be called multiple times to provide the stream. Suppliers should prepare streams that are appended to and that can be closed. If anOutputStream
should not be closed consider wrapping it in aNoCloseOutputStream
- Parameters:
out
- The OutputStream supplier that provides the output stream to write the report to. A null value will use System.out.- See Also:
-
setOut
Sets the OutputStream supplier to use the specified file. The file may be opened and closed several times. File is deleted first and then may be repeatedly opened in append mode.- Parameters:
file
- The file to create the supplier with.- See Also:
-
getOutput
Returns the output stream supplier. If no stream has been set returns a supplier for System.out.- Returns:
- The supplier of the output stream to write the report to.
-
getWriter
Gets a PrintWriter that wraps the output stream.- Returns:
- A supplier for a PrintWriter that wraps the output stream.
- See Also:
-
addLicense
Adds a license to the list of licenses. Does not add the license to the list of approved licenses.- Parameters:
license
- The license to add to the list of licenses.
-
addLicense
Adds a license to the list of licenses. Does not add the license to the list of approved licenses.- Parameters:
builder
- The license builder to build and add to the list of licenses.- Returns:
- The ILicense implementation that was added.
-
addLicenses
Adds multiple licenses to the list of licenses. Does not add the licenses to the list of approved licenses.- Parameters:
licenses
- The licenses to add.
-
addFamily
Adds a license family to the list of families. Does not add the family to the list of approved licenses.- Parameters:
family
- The license family to add to the list of license families.
-
addFamily
Adds a license family to the list of families. Does not add the family to the list of approved licenses.- Parameters:
builder
- The licenseFamily.Builder to build and add to the list of licenses.
-
addFamilies
Adds multiple families to the list of license families. Does not add the licenses to the list of approved licenses.- Parameters:
families
- The license families to add.
-
addApprovedLicenseCategory
Adds an ILicenseFamily to the list of approved licenses.- Parameters:
approvedILicenseFamily
- the LicenseFamily to add.
-
addApprovedLicenseCategory
Adds a license family category (id) to the list of approved licenses- Parameters:
familyCategory
- the category to add.
-
addApprovedLicenseCategories
Adds a collection of license family categories to the set of approved license names.- Parameters:
approvedLicenseCategories
- set of approved license categories.
-
removeApprovedLicenseCategory
Adds a license family category to the list of approved licenses. Once a license has been removed from the approved list it cannot be re-added- Parameters:
familyCategory
- the category to add.
-
removeApprovedLicenseCategories
Removes a license family category from the list of approved licenses. Once a license has been removed from the approved list it cannot be re-added- Parameters:
familyCategory
- the family category to remove.
-
getLicenseCategories
Gets the SortedSet of approved license categories. Once a license has been removed from the approved list it cannot be re-added- Parameters:
filter
- The LicenseFilter to filter the categories by.- Returns:
- the Sorted set of approved license categories.
-
getLicenses
Gets the SortedSet of approved license categories. Once a license has been removed from the approved list it cannot be re-added- Parameters:
filter
- The LicenseFilter to filter the licenses by.- Returns:
- the Sorted set of approved license categories.
-
getLicenseIds
Gets the SortedSet of approved license categories. Once a license has been removed from the approved list it cannot be re-added- Parameters:
filter
- The LicenseFilter to filter the licenses by.- Returns:
- the Sorted set of approved license categories.
-
addApprovedLicenseId
Adds an ILicenseFamily to the list of approved licenses.- Parameters:
approvedLicense
- the License to add.
-
addApprovedLicenseId
Adds a license family category (id) to the list of approved licenses- Parameters:
licenseId
- the license id to add.
-
addApprovedLicenseIds
Adds a collection of license family categories to the set of approved license names.- Parameters:
approvedLicenseIds
- set of approved license IDs.
-
removeApprovedLicenseId
Adds a license family category to the list of approved licenses. Once a license has been removed from the approved list it cannot be re-added- Parameters:
licenseId
- the license ID to add.
-
removeApprovedLicenseIds
Removes a license family category from the list of approved licenses. Once a license has been removed from the approved list it cannot be re-added- Parameters:
licenseIds
- the license IDs to remove.
-
getCopyrightMessage
Returns the optional license copyright being added if RAT is adding headers. This value is ignored, if no license headers are added.- Returns:
- the optional copyright message.
- See Also:
-
setCopyrightMessage
Sets the optional copyright message used if RAT is adding license headers. This value is ignored, if no license headers are added.- Parameters:
copyrightMessage
- message to set.- See Also:
-
isAddingLicensesForced
public boolean isAddingLicensesForced()Gets the flag that determines if license headers are "forced" overwriting existing files. This value is ignored if RAT is not adding licenses.- Returns:
true
if RAT is forcing the adding license headers.- See Also:
-
isAddingLicenses
public boolean isAddingLicenses()Gets the flag that determines if license headers should be added if missing.- Returns:
- whether RAT should add missing license headers.
- See Also:
-
setAddLicenseHeaders
Sets whether RAT should enable, disable, or force the adding of license headers.- Parameters:
addLicenseHeaders
- enables/disables or forces adding of licenses headers.- See Also:
-
getLicenseFamilies
Gets a sorted set of ILicenseFamily objects based onfilter
. if filter is set:all
- All licenses families will be returned.approved
- Only approved license families will be returnednone
- No license families will be returned
- Parameters:
filter
- The license filter.- Returns:
- The set of defined licenses.
-
getClaimValidator
Gets the ClaimValidator for the configuration.- Returns:
- the ClaimValidator.
-
getLicenseSetFactory
Gets the enclosed LicenseSetFactory.- Returns:
- the license set factory.
-
validate
Validates that the configuration is valid.- Parameters:
logger
- String consumer to log warning messages to.- Throws:
ConfigurationException
- on configuration error.
-