org.apache.rat.analysis.license
Class CopyrightHeader

java.lang.Object
  extended by org.apache.rat.analysis.license.BaseLicense
      extended by org.apache.rat.analysis.license.CopyrightHeader
All Implemented Interfaces:
IHeaderMatcher
Direct Known Subclasses:
AppliedApacheSoftwareLicense20

public class CopyrightHeader
extends BaseLicense
implements IHeaderMatcher

Matches a typical Copyright header line only based on a regex pattern which allows for one (starting) year or year range, and a configurable copyright owner.

The matching is done case insensitive

Note also that the copyright owner is appended to the regex pattern, so can support additional regex but also requires escaping where needed,
e.g. use "FooBar \(www\.foobar\.com\)" for matching "FooBar (www.foobar.com)"

Since:
Rat 0.9

Field Summary
static String COPYRIGHT_PREFIX_PATTERN_DEFN
           
 
Constructor Summary
  CopyrightHeader()
           
protected CopyrightHeader(MetaData.Datum licenseFamilyCategory, MetaData.Datum licenseFamilyName, String notes)
           
protected CopyrightHeader(MetaData.Datum licenseFamilyCategory, MetaData.Datum licenseFamilyName, String notes, String copyrightOwner)
           
 
Method Summary
 String getCopyRightOwner()
           
 boolean hasCopyrightPattern()
           
protected  boolean isCopyrightMatch()
           
 boolean match(Document subject, String s)
          Matches the text accumulated to licenses.
protected  boolean matchCopyright(String s)
           
 void reset()
          Resets this matches.
 void setCopyrightOwner(String copyrightOwner)
           
 
Methods inherited from class org.apache.rat.analysis.license.BaseLicense
getLicenseFamilyCategory, getLicenseFamilyName, getNotes, reportOnLicense, setLicenseFamilyCategory, setLicenseFamilyName, setNotes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_PREFIX_PATTERN_DEFN

public static final String COPYRIGHT_PREFIX_PATTERN_DEFN
See Also:
Constant Field Values
Constructor Detail

CopyrightHeader

public CopyrightHeader()

CopyrightHeader

protected CopyrightHeader(MetaData.Datum licenseFamilyCategory,
                          MetaData.Datum licenseFamilyName,
                          String notes)

CopyrightHeader

protected CopyrightHeader(MetaData.Datum licenseFamilyCategory,
                          MetaData.Datum licenseFamilyName,
                          String notes,
                          String copyrightOwner)
Method Detail

setCopyrightOwner

public void setCopyrightOwner(String copyrightOwner)

getCopyRightOwner

public String getCopyRightOwner()

hasCopyrightPattern

public boolean hasCopyrightPattern()

isCopyrightMatch

protected boolean isCopyrightMatch()

matchCopyright

protected boolean matchCopyright(String s)
                          throws RatHeaderAnalysisException
Throws:
RatHeaderAnalysisException

match

public boolean match(Document subject,
                     String s)
              throws RatHeaderAnalysisException
Description copied from interface: IHeaderMatcher
Matches the text accumulated to licenses. TODO probably a poor design choice - hope to fix later

Specified by:
match in interface IHeaderMatcher
Parameters:
subject - TODO
s - next line of text, not null
Returns:
TODO
Throws:
RatHeaderAnalysisException

reset

public void reset()
Description copied from interface: IHeaderMatcher
Resets this matches. Subsequent calls to IHeaderMatcher.match(org.apache.rat.api.Document, java.lang.String) will accumulate new text.

Specified by:
reset in interface IHeaderMatcher


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.