Class RootLicenseMatcher
-
- All Implemented Interfaces:
public final class RootLicenseMatcherA heuristic for determining which (root) license files apply to any file or directory.
For any given directory the heuristic tries to assign license files by utilizing LicenseFilePatterns.licenseFilenames and patent files by utilizing LicenseFilePatterns.patentFilenames independently of one another. The LicenseFilePatterns.rootLicenseFilenames serve only as fallback to find license files if there isn't any match for LicenseFilePatterns.licenseFilenames.
To determine the (root) license files applicable for a specific directory, all filenames in that directory are matched against LicenseFilePatterns.licenseFilenames. If there are matches then these are used as result, otherwise that search is repeated recursively in the parent directory. If there is no parent directory (because the root was already searched but no result was found) then start from scratch using the fallback pattern LicenseFilePatterns.rootLicenseFilenames.
Patent files are assigned in an analog way, but without any fallback pattern.
-
-
Constructor Summary
Constructors Constructor Description RootLicenseMatcher(LicenseFilePatterns licenseFilePatterns)
-
Method Summary
Modifier and Type Method Description final Map<String, Set<LicenseFinding>>getApplicableRootLicenseFindingsForDirectories(Collection<LicenseFinding> licenseFindings, Collection<String> directories)Return a mapping from the given relative directories to the licenses findings for the (root) license files applicable to the respective directory. final Map<String, Set<String>>getApplicableLicenseFilesForDirectories(Collection<String> relativeFilePaths, Collection<String> directories)Return a mapping from the given relative directories to the relative paths of the (root) licenses files applicable to that respective directory. -
-
Constructor Detail
-
RootLicenseMatcher
RootLicenseMatcher(LicenseFilePatterns licenseFilePatterns)
-
-
Method Detail
-
getApplicableRootLicenseFindingsForDirectories
final Map<String, Set<LicenseFinding>> getApplicableRootLicenseFindingsForDirectories(Collection<LicenseFinding> licenseFindings, Collection<String> directories)
Return a mapping from the given relative directories to the licenses findings for the (root) license files applicable to the respective directory. The values of the map entries are subsets of the given licenseFindings.
-
getApplicableLicenseFilesForDirectories
final Map<String, Set<String>> getApplicableLicenseFilesForDirectories(Collection<String> relativeFilePaths, Collection<String> directories)
Return a mapping from the given relative directories to the relative paths of the (root) licenses files applicable to that respective directory. The values of the map entries are subsets of the given relativeFilePaths.
-
-
-
-