Package org.apache.rat.configuration
Class XMLConfigurationReader
java.lang.Object
org.apache.rat.configuration.XMLConfigurationReader
- All Implemented Interfaces:
LicenseReader
,MatcherReader
A class that reads the XML configuration file format.
<rat-config>
<licenses>
<license id=id name=name >
<notes></notes>
<text> </text>
<copyright start='' end='' owner=''/>
<spdx></spdx>
<and> <matcher/>...</and>
<or> <matcher/>...</or>
<matcher_ref refid='' />
<not><matcher /></not>
</license>
</licenses>
<approved>
<family refid=''>
</approved>
<matchers>
<matcher className=''/>
<matcher className=''/>
</matchers>
</rat-config>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Merge the new document into the document that this reader processes.void
addLicenses(URL url)
Adds a URL to the set of files to be read.void
addMatchers(URL url)
Adds a URL to the set of files to be read.Reads the configuration and extracts the list of approved licenses.static IHeaderMatcher
createTextMatcher(String id, String txt)
Create a text matcher.void
Read the urls and create a single document to process.Reads the configuration and extracts instances of ILicenseFamily.Reads the configuration and extracts instances of ILicense.void
Reads the configuration and MatcherBuilder classes and adds them to Readers.
-
Constructor Details
-
XMLConfigurationReader
public XMLConfigurationReader()Constructs the XML configuration reader.
-
-
Method Details
-
addLicenses
Description copied from interface:LicenseReader
Adds a URL to the set of files to be read.- Specified by:
addLicenses
in interfaceLicenseReader
- Parameters:
url
- the URL to read.
-
read
Read the urls and create a single document to process.- Parameters:
urls
- The URLs to read.
-
add
Merge the new document into the document that this reader processes.- Parameters:
newDoc
- the Document to merge.
-
createTextMatcher
Create a text matcher. Will construct a FullTextMatcher or a SimpleTextMatcher depending on the complexity of the text.- Parameters:
id
- the id for the Matcher.txt
- the text to match- Returns:
- the IHeaderMatcher that matches the text.
-
readLicenses
Description copied from interface:LicenseReader
Reads the configuration and extracts instances of ILicense.- Specified by:
readLicenses
in interfaceLicenseReader
- Returns:
- A collection of ILicense.
-
readFamilies
Description copied from interface:LicenseReader
Reads the configuration and extracts instances of ILicenseFamily.- Specified by:
readFamilies
in interfaceLicenseReader
- Returns:
- A collection of ILicenseFamily.
-
approvedLicenseId
Description copied from interface:LicenseReader
Reads the configuration and extracts the list of approved licenses.- Specified by:
approvedLicenseId
in interfaceLicenseReader
- Returns:
- The list of approved licenses specified in the configuration or an empty list if none specified.
-
readMatcherBuilders
public void readMatcherBuilders()Description copied from interface:MatcherReader
Reads the configuration and MatcherBuilder classes and adds them to Readers.- Specified by:
readMatcherBuilders
in interfaceMatcherReader
-
addMatchers
Description copied from interface:MatcherReader
Adds a URL to the set of files to be read.- Specified by:
addMatchers
in interfaceMatcherReader
- Parameters:
url
- the URL to read.
-