Package org.apache.rat
Class ReportConfiguration
java.lang.Object
org.apache.rat.ReportConfiguration
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A wrapper around an output stream that does not close the output stream. -
Constructor Summary
-
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
addDirectoryFilter(org.apache.commons.io.filefilter.IOFileFilter directoryFilter)
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
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
addLicensesIfNotPresent(Collection<ILicense> licenses)
Adds multiple licenses to the list of licenses.void
Sets the reporting option for duplicate license families.Gets the SortedSet of approved license categories.Returns the optional license copyright being added if RAT is adding headers.org.apache.commons.io.filefilter.IOFileFilter
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 a set Licenses of depending on thefilter
if filter is set:all
- All licenses will be returned.approved
- Only approved licenses will be returnednone
- No licenses will be returnedgetLog()
Retrieves the Log that was provided in the constructor.org.apache.commons.io.function.IOSupplier<OutputStream>
Returns the output stream supplier.org.apache.commons.io.function.IOSupplier<InputStream>
org.apache.commons.io.function.IOSupplier<PrintWriter>
boolean
boolean
This value is ignored if RAT is not adding licenses.boolean
void
Sets the reporting option for duplicate licenses.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
setAddLicenseHeaders(AddLicenseHeaders addLicenseHeaders)
Sets whether RAT should enable, disable, or force the adding of license headers.void
setCopyrightMessage(String copyrightMessage)
Sets the optional copyright message used if RAT is adding license headers.void
setDirectoryFilter(org.apache.commons.io.filefilter.IOFileFilter directoryFilter)
void
Adds the licenses and approved licenses from the defaults object to the configuration.void
setInputFileFilter(FilenameFilter inputFileFilter)
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
setReportable(IReportable reportable)
void
setStyleReport(boolean styleReport)
void
setStyleSheet(File styleSheet)
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
Constructor- Parameters:
log
- The Log implementation that messages will be written to.
-
-
Method Details
-
getLog
Retrieves the Log that was provided in the constructor.- Returns:
- the Log for the system.
-
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.
-
getInputFileFilter
- Returns:
- The filename filter for the potential input files.
-
setInputFileFilter
- Parameters:
inputFileFilter
- the filename filter to filter the input files.
-
getDirectoryFilter
public org.apache.commons.io.filefilter.IOFileFilter getDirectoryFilter() -
setDirectoryFilter
public void setDirectoryFilter(org.apache.commons.io.filefilter.IOFileFilter directoryFilter) -
addDirectoryFilter
public void addDirectoryFilter(org.apache.commons.io.filefilter.IOFileFilter directoryFilter) -
getReportable
- Returns:
- the thing being reported on.
-
setReportable
- Parameters:
reportable
- the thing being reported on.
-
getStyleSheet
- 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
- Parameters:
styleSheet
- 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 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.
-
isStyleReport
public boolean isStyleReport()- Returns:
true
if the XML report should be styled.
-
setStyleReport
public void setStyleReport(boolean styleReport)- Parameters:
styleReport
- specifies whether the XML report should be styled.
-
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:
ReportConfiguration.NoCloseOutputStream
-
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:
setOut(IOSupplier)
-
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
- Returns:
- A supplier for a PrintWriter that wraps the output stream.
- See Also:
getOutput()
-
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.
-
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.
-
addLicensesIfNotPresent
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.
-
getApprovedLicenseCategories
Gets the SortedSet of approved license categories. Once a license has been removed from the approved list it cannot be re-added- Returns:
- the Sorted set of approved license categories.
-
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:
isAddingLicenses()
-
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:
isAddingLicenses()
-
isAddingLicensesForced
public boolean isAddingLicensesForced()This value is ignored if RAT is not adding licenses.- Returns:
true
if RAT is forcing the adding license headers.- See Also:
isAddingLicenses()
-
isAddingLicenses
public boolean isAddingLicenses()- Returns:
- whether RAT should add missing license headers.
- See Also:
isAddingLicensesForced()
,getCopyrightMessage()
-
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:
isAddingLicenses()
,setCopyrightMessage(String)
-
getLicenses
Gets a set Licenses of depending on thefilter
if filter is set:all
- All licenses will be returned.approved
- Only approved licenses will be returnednone
- No licenses will be returned
- Parameters:
filter
- The license filter.- Returns:
- The set of defined licenses.
-
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.
-
validate
Validates that the configuration is valid.- Parameters:
logger
- String consumer to log warning messages to.
-