blob: b127c8d5ffaa13f2a668d160654f871176e34b71 [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 2.0.0 from src/site/markdown/architecture.md at 2025-09-23
| Rendered using Apache Maven Fluido Skin 2.1.0
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0" />
<title>Overview – Apache RAT™ - A Release Audit Tool</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-2.1.0.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script src="./js/apache-maven-fluido-2.1.0.min.js"></script>
<link href="https://creadur.apache.org/font/matesc.css" type="text/css" rel="stylesheet" />
</head>
<body>
<a class="github-fork-ribbon right-top" href="https://github.com/apache/creadur-rat" data-ribbon="Fork me on GitHub">Fork me on GitHub</a>
<div class="container-fluid container-fluid-top">
<header>
<div id="banner">
<div class="pull-left"><div id="bannerLeft"><h1><a href="https://www.apache.org/"><img src="https://www.apache.org/img/asf_logo.png" alt="The Apache Software Foundation" /> Apache RAT</a></h1></div></div>
<div class="pull-right"></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2025-09-23<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 0.17-SNAPSHOT<span class="divider">|</span></li>
<li><a href="https://www.apache.org/">Apache</a><span class="divider">/</span></li>
<li><a href="../">Creadur</a><span class="divider">/</span></li>
<li><a href="./">RAT</a><span class="divider">/</span></li>
<li class="active">Overview</li>
</ul>
</div>
</header>
<div class="row-fluid">
<header id="leftColumn" class="span2">
<nav class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Apache RAT™</li>
<li><a href="index.html">Introducing RAT</a></li>
<li><a href="download_rat.cgi">Downloads</a></li>
<li><a href="changes.html">Changes</a></li>
<li class="nav-header">RAT from the Command Line</li>
<li><a href="apache-rat/index.html">Command Line Introduction</a></li>
<li><a href="apache-rat/cli_options.html">Command Line Options</a></li>
<li><a href="apache-rat/env_vars.html">Environment Variables</a></li>
<li><a href="apache-rat-core/exclusion_expression.html">Exclusion Expressions</a></li>
<li><a href="apache-rat/standard_collections.html">Standard Collections</a></li>
<li class="nav-header">RAT from Ant</li>
<li><a href="apache-rat-tasks/index.html">Ant Task Introduction</a></li>
<li><a href="apache-rat-tasks/ant_options.html">Ant Elements and Attributes</a></li>
<li class="nav-header">RAT from Maven</li>
<li><a href="apache-rat-plugin/index.html">Maven Plugin Introduction</a></li>
<li><a href="apache-rat-plugin/mvn_options.html">Maven Options</a></li>
<li><a href="apache-rat-plugin/examples/index.html">Maven Examples</a></li>
<li class="nav-header">Configuring RAT</li>
<li><a href="apache-rat/name_xref.html">Option Name Cross Reference</a></li>
<li><a href="apache-rat/default_licenses.html">Default Licenses</a></li>
<li><a href="apache-rat/default_matchers.html">Default Matchers</a></li>
<li><a href="license_def.html">Defining New Licenses</a></li>
<li><a href="apache-rat/xsd.html">Configuration XSD</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/default.xml">Default Configuration</a></li>
<li><a href="apache-rat/detecting_generated_files.html">Detecting Generated Files</a></li>
<li class="nav-header">RAT Output</li>
<li><a href="apache-rat/output/example.html">Standard Output Example</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/rat-report.xsd">Output XSD</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl">XSLT - Plain text</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/missing-headers.xsl">XSLT - Missing headers list</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/unapproved-licenses.xsl">XSLT - Unapproved licenses list</a></li>
<li class="nav-header">Developing RAT</li>
<li class="active"><a>Architecture</a></li>
<li><a href="apidocs/index.html">Javadocs</a></li>
<li><a href="apache-rat-core/development/document_name.html">Document Name concept</a></li>
<li><a href="development/ui_implementation.html">UI Development</a></li>
<li><a href="apache-rat-core/development/write_file_processor.html">Writing a File Processor</a></li>
<li class="nav-header">Apache Creadur™</li>
<li><a href="..">Creadur Project Home</a></li>
<li><a href="../tentacles">Apache Tentacles</a></li>
<li><a href="../whisker">Apache Whisker</a></li>
<li><a href="https://www.apache.org/security/">Security</a></li>
<li><a href="https://www.apache.org/licenses/">License</a></li>
<li><a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li>
<li class="nav-header">The Apache Software Foundation</li>
<li><a href="https://www.apache.org/foundation">About the Foundation</a></li>
<li><a href="https://projects.apache.org">The projects</a></li>
<li><a href="https://people.apache.org">The people</a></li>
<li><a href="https://www.apache.org/foundation/how-it-works.html">How we work</a></li>
<li><a href="https://www.apache.org/foundation/how-it-works.html#history">Our history</a></li>
<li><a href="https://blogs.apache.org/foundation/">News</a></li>
<li class="nav-header">Contribute</li>
<li><a href="https://www.apache.org/foundation/getinvolved.html">Get Involved</a></li>
<li class="nav-header">Committer Info</li>
<li><a href="https://www.apache.org/dev/committers.html">ASF Committers&apos; FAQ</a></li>
<li><a href="https://www.apache.org/dev/new-committers-guide.html">New Committers Guide</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-site/blob/asf-site/README.md">How to publish this site</a></li>
<li><a href="https://community.apache.org/">Community</a></li>
<li><a href="https://www.apache.org/legal/">Legal</a></li>
<li><a href="https://www.apache.org/foundation/marks/">Branding</a></li>
<li><a href="https://www.apache.org/press/">Media Relations</a></li>
<li class="nav-header">Modules</li>
<li><a href="apache-rat-core/index.html">Apache Creadur RAT::Core</a></li>
<li><a href="apache-rat-plugin/index.html">Apache Creadur RAT::Plugin4Maven</a></li>
<li><a href="apache-rat-tasks/index.html">Apache Creadur RAT::Tasks4Ant</a></li>
<li><a href="apache-rat/index.html">Apache Creadur RAT::Packaging</a></li>
<li><a href="apache-rat-tools/index.html">Apache Creadur RAT::Tools</a></li>
<li><a href="apache-rat-testdata/index.html">Apache Creadur RAT::Testdata</a></li>
<li class="nav-header">Project Documentation</li>
<li><a href="project-info.html"><span class="icon-chevron-right"></span>Project Information</a></li>
<li><a href="project-reports.html"><span class="icon-chevron-right"></span>Project Reports</a></li>
</ul>
</nav>
<div class="well sidebar-nav">
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<a href="https://maven.apache.org/" class="builtBy"><img class="builtBy" src="https://maven.apache.org/images/logos/maven-feather.png" /> Maven</a>
</div>
</div>
</header>
<main id="bodyColumn" class="span10">
<!---
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<section><a id="Overview"></a>
<h1>Overview</h1>
<p>The RAT architecture is build around a single engine that parses input files to build an XML based report.
User interfaces (UIs) create and configure a <code>ReportConfiguration</code> which is passed to a <code>Reporter</code> instance which performs all the processing.</p>
<pre><code class="nohighlight nocode">/------\ /------\ /------\
| CLI | |Maven | | Ant |
| UI | | UI | | UI |
\--+---/ \--+---/ \--+---/
| | |
\-----------+-----------/ ReportConfiguration
| input to Reporter
/----+----\
| Reporter| &lt;--- Multiple files and directories
\----+----/
|
V
Report
</code></pre></section><section><a id="Configuration"></a>
<h1>Configuration</h1>
<p>The <code>ReportConfiguration</code> contains all the options for the Reporter class. User interfaces create a <code>ReportConfiguration</code> and pass it to the <code>Reporter</code> instance for execution. The configuration specifies the configuration for:</p>
<ul>
<li>License Families &#x2013; An identifier for families of licenses that share the same constraints. The default list is defined in the <code>o.a.r.default.xml</code> file in the families section.</li>
<li>Licenses &#x2013; the definition of a license that defines the matchers that comprise the test for the license. The default licenses are defined in the <code>o.a.r.default.xml</code> file in the licenses section.</li>
<li>Approved License Families &#x2013; A list of license families that are approved. Licenses of families not in this are unapproved. The default approved license families are defined in the <code>o.a.r.default.xml</code> file in the approved section.</li>
</ul><section><a id="License_Families"></a>
<h2>License Families</h2>
<p>A license family comprises an ID and a name. New families may be added to the <code>o.a.r.default.xml</code> file or programmatically from the UI. License family IDs must be unique. Later ID definitions override earlier definitions.</p></section><section><a id="License"></a>
<h2>License</h2>
<p>A license definition comprises a family (identified by its ID), and a matcher. Licenses adopt the ID of their family which may be overridden with an id attribute. Licenses also adopt the name of their family unless it is overridden by a name attribute.</p></section><section><a id="Approved_Licenses"></a>
<h2>Approved Licenses</h2>
<p>The approved licenses are enumerated in a list. Licenses are selected by family and the family ID is specified in the list.</p></section><section><a id="Matchers"></a>
<h2>Matchers</h2>
<p>Matchers are classes that implement specific tests. They are created by builders. The default builders are specified in the <code>o.a.r.default.xml</code> file in the matchers section.</p><section><a id="Matcher.Builder"></a>
<h3>Matcher.Builder</h3>
<p>New matcher builders may be defined within the <code>o.a.r.default.xml</code> file and then used in the license definitions within the file.</p>
<p>Matcher builder class names must be of the form <code>&lt;name&gt;Builder</code> where <code>&lt;name&gt;</code> becomes the name of the matcher and is used in identifying the matcher to use (e.g. as a tag in the License section of the <code>o.a.r.default.xml</code> file). They must also implement the <code>o.a.r.analysis.IHeaderMatcher.Builder</code> interface.</p></section></section><section><a id="Flags_to_add_licenses_and_copyrights_to_files"></a>
<h2>Flags to add licenses and copyrights to files</h2>
<p>The configuration has a set of options to add licenses and optionally copyright notices to files that do not have them.
The <code>addLicenses</code> option adds the Apache-2.0 license to files that do not have any license specified.
If the <code>copyright</code> text is provided it is also added to the files.
The <code>addLicensesForced</code> modifies the way the licenses are added, by default the licenses are added to new files with name of the old file but a <code>.new</code> extension added.
If <code>addLicensesForced</code> is specified then the files are overwritten.</p></section><section><a id="File_name_filter"></a>
<h2>File name filter</h2>
<p>The file name filter specifies a filter to be used to filter out any files that should not be evaluated.</p></section><section><a id="out"></a>
<h2>out</h2>
<p>The <code>out</code> parameter specifies an <code>OutputStream</code> IOSupplier that is used to create the output stream to write text to. By default, this is the <code>System.out</code> stream.</p></section><section><a id="stylesheet"></a>
<h2>stylesheet</h2>
<p>The <code>styleSheet</code> parameter specifies the <code>InputStream</code> IOSupplier that is used to read the stylesheet that styles the XML output.</p></section><section><a id="IReportable"></a>
<h2>IReportable</h2>
<p>The <code>IReportable</code> parameter identifies the objects that the report should run against.
Implementations of <code>IReportable</code> generally do things like walk directory trees, or archives.</p></section></section><section><a id="Reporter"></a>
<h1>Reporter</h1>
<p>The reporter uses the <code>ReporterConfiguration</code> to configure the report. It then begins to read the files.
Each file is a <code>Document</code> the reporter determines the Document type and if appropriate reads the header information (50 lines) from the document.</p>
<p>The header information is passed to the licenses. The processing of the file stops when a license is triggered (found) or the end of the header is reached.</p>
<p>The information retrieved is used to create an XML document that may be styled by the defined stylesheet.</p>
<p>The reporter utilizes the <code>RatReport</code> interface to determine what actions to take with the documents.
Currently the <code>RatReport</code> interface is used to define license adding capabilities, report claim aggregation, and multiplexed reports.
Additional capabilities can be implemented by implementing a <code>RatReport</code> and inserting it into the processing chain.</p></section> </main>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
Copyright &copy; 2016-2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
Apache Creadur, Creadur, Apache RAT, Apache Tentacles, Apache Whisker, Apache and the ASF logo are trademarks
of The Apache Software Foundation.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
</div>
</div>
</footer>
</body>
</html>