com.soebes.maven.plugins.mlv.licenses
Class LicenseValidator

java.lang.Object
  extended by com.soebes.maven.plugins.mlv.licenses.LicenseValidator

public class LicenseValidator
extends Object

This class offers you methods to categorize licenses into the different categories.

Author:
Karl Heinz Marbaise

Nested Class Summary
static class LicenseValidator.Category
           
 
Field Summary
private  LicensesContainer licensesContainer
          Where the licenses are stored.
private  boolean strictChecking
           
 
Constructor Summary
LicenseValidator(LicensesContainer licensesContainer)
           
 
Method Summary
private  boolean check(List<LicenseItem> checkList, org.apache.maven.model.License cl)
          This will check the given License against the given list of licenses.
private  String checkId(List<LicenseItem> checkList, org.apache.maven.model.License cl)
           
private  boolean checkNames(LicenseItem item, org.apache.maven.model.License cl)
          Check the given License Name against the CheckLicense which can contain more than one.
private  boolean checkNamesAndURLs(LicenseItem item, org.apache.maven.model.License cl)
          This method will check if the given License name and URL is existing in the given CheckLicense class which contains a single License which can be described with multiple names and multiple URL's.
private  boolean checkNamesOrURLs(LicenseItem item, org.apache.maven.model.License cl)
          This method will check if the given License name or url is existing in the given CheckLicense class which contains a single License which can be described with multiple names and multiple URL's.
private  boolean checkUrls(LicenseItem item, org.apache.maven.model.License cl)
          Check the given License URL against the CheckLicense which can contain more than one.
 List<LicenseItem> getInvalid()
          This will return the Invalid license list from the license.xml file or an empty list if no such area is defined in the license.xml file.
 String getInvalidId(org.apache.maven.model.License cl)
           
 ArrayList<String> getInvalidIds(ArrayList<org.apache.maven.model.License> licenses)
           
 List<LicenseItem> getValid()
          This will return the valid licenses or an empty List if no such entry in the license.xml file exist.
 String getValidId(org.apache.maven.model.License cl)
          This will return the Id of the License.
 ArrayList<String> getValidIds(ArrayList<org.apache.maven.model.License> licenses)
          This method will get the Id's from the valid area of the licenses.xml file.
 List<LicenseItem> getWarning()
          This will return the list of licenses which are defined in the warning area of the license.xml file or an empty list if no such area has been defined in the license.xml file.
 String getWarningId(org.apache.maven.model.License cl)
           
 ArrayList<String> getWarningIds(ArrayList<org.apache.maven.model.License> licenses)
           
 boolean isCategory(ArrayList<org.apache.maven.model.License> licenses, LicenseValidator.Category category)
           
 boolean isInvalid(ArrayList<org.apache.maven.model.License> licenses)
          The given list of licenses has to be part of the invalid section of the configuration file which means in other word an conjunction (logical and).
 boolean isInvalid(org.apache.maven.model.License cl)
          This will check if the given license is part of the invalid category or not.
 boolean isStrictChecking()
           
 boolean isUnknown(ArrayList<org.apache.maven.model.License> licenses)
          TBD: Enhance description A list of licenses will be categorized as Unknown if one or more licenses can be categorized into different categories.
 boolean isUnknown(org.apache.maven.model.License license)
          Check if a given license is not part of one the categories invalid, valid or warning.
 boolean isValid(ArrayList<org.apache.maven.model.License> licenses)
          The given list of licenses has to be part of the valid section of the configuration file which means in other word an conjunction (logical and).
 boolean isValid(org.apache.maven.model.License cl)
          This will check if the given license is part of the valid licenses or not.
 boolean isWarning(ArrayList<org.apache.maven.model.License> licenses)
          The given list of licenses has to be part of the warning section of the configuration file which means in other word an conjunction (logical and).
 boolean isWarning(org.apache.maven.model.License cl)
          This will check if the given license is part of the warning category or not.
 void setInvalid(ArrayList<LicenseItem> invalid)
           
 void setStrictChecking(boolean strictChecking)
           
 void setValid(List<LicenseItem> valid)
           
 void setWarning(ArrayList<LicenseItem> warning)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

licensesContainer

private final LicensesContainer licensesContainer
Where the licenses are stored.


strictChecking

private boolean strictChecking
Constructor Detail

LicenseValidator

public LicenseValidator(LicensesContainer licensesContainer)
Method Detail

getValid

public List<LicenseItem> getValid()
This will return the valid licenses or an empty List if no such entry in the license.xml file exist.

Returns:
The list of LicenseItem

setValid

public void setValid(List<LicenseItem> valid)

getInvalid

public List<LicenseItem> getInvalid()
This will return the Invalid license list from the license.xml file or an empty list if no such area is defined in the license.xml file.

Returns:
The List of Invalid licenses.

setInvalid

public void setInvalid(ArrayList<LicenseItem> invalid)

getWarning

public List<LicenseItem> getWarning()
This will return the list of licenses which are defined in the warning area of the license.xml file or an empty list if no such area has been defined in the license.xml file.

Returns:
The list of Warning licenses.

setWarning

public void setWarning(ArrayList<LicenseItem> warning)

checkNamesAndURLs

private boolean checkNamesAndURLs(LicenseItem item,
                                  org.apache.maven.model.License cl)
This method will check if the given License name and URL is existing in the given CheckLicense class which contains a single License which can be described with multiple names and multiple URL's.

Parameters:
item - The Instance of the CheckLicense class.
cl - The instance of the License to check
Returns:
true if the given license URL and Name are

checkNamesOrURLs

private boolean checkNamesOrURLs(LicenseItem item,
                                 org.apache.maven.model.License cl)
This method will check if the given License name or url is existing in the given CheckLicense class which contains a single License which can be described with multiple names and multiple URL's. This will

Parameters:
item - The Instance of the CheckLicense class.
cl - The instance of the License to check
Returns:
true if the given license URL and Name are

check

private boolean check(List<LicenseItem> checkList,
                      org.apache.maven.model.License cl)
This will check the given License against the given list of licenses.

Parameters:
checkList - The list of licenses which will be used to check against.
cl - The license which will be check to be part of the above list.
Returns:
true if the license has an equal name and/or equal URL false otherwise.

checkId

private String checkId(List<LicenseItem> checkList,
                       org.apache.maven.model.License cl)

isValid

public boolean isValid(org.apache.maven.model.License cl)
This will check if the given license is part of the valid licenses or not.

Parameters:
cl - License which will be checked.
Returns:
true if License is part of the valid licenses category, false otherwise.

getValidId

public String getValidId(org.apache.maven.model.License cl)
This will return the Id of the License.

Parameters:
cl -
Returns:
null if not found or the id of the found license.

isValid

public boolean isValid(ArrayList<org.apache.maven.model.License> licenses)
The given list of licenses has to be part of the valid section of the configuration file which means in other word an conjunction (logical and).

Parameters:
licenses -
Returns:

getValidIds

public ArrayList<String> getValidIds(ArrayList<org.apache.maven.model.License> licenses)
This method will get the Id's from the valid area of the licenses.xml file. //FIXME: More docs. analyze..

Parameters:
licenses -
Returns:

getInvalidIds

public ArrayList<String> getInvalidIds(ArrayList<org.apache.maven.model.License> licenses)

getWarningIds

public ArrayList<String> getWarningIds(ArrayList<org.apache.maven.model.License> licenses)

isInvalid

public boolean isInvalid(ArrayList<org.apache.maven.model.License> licenses)
The given list of licenses has to be part of the invalid section of the configuration file which means in other word an conjunction (logical and).

Parameters:
licenses -
Returns:

isWarning

public boolean isWarning(ArrayList<org.apache.maven.model.License> licenses)
The given list of licenses has to be part of the warning section of the configuration file which means in other word an conjunction (logical and).

Parameters:
licenses -
Returns:

isUnknown

public boolean isUnknown(ArrayList<org.apache.maven.model.License> licenses)
TBD: Enhance description A list of licenses will be categorized as Unknown if one or more licenses can be categorized into different categories. For example if you have a list with three licenses isValid isWarning isInvalid isUnknown A X B X C X

Parameters:
licenses - The list with the licenses which will be checked.
Returns:
true if a license is from no category.

isUnknown

public boolean isUnknown(org.apache.maven.model.License license)
Check if a given license is not part of one the categories invalid, valid or warning.

Parameters:
license -
Returns:
true not part of any category false otherwise.

isInvalid

public boolean isInvalid(org.apache.maven.model.License cl)
This will check if the given license is part of the invalid category or not.

Parameters:
cl - License which will be checked.
Returns:
true if License part of the invalid licenses false otherwise.

getInvalidId

public String getInvalidId(org.apache.maven.model.License cl)

isWarning

public boolean isWarning(org.apache.maven.model.License cl)
This will check if the given license is part of the warning category or not.

Parameters:
cl - License which will be checked.
Returns:
true if License part of the warning licenses false otherwise.

getWarningId

public String getWarningId(org.apache.maven.model.License cl)

checkUrls

private boolean checkUrls(LicenseItem item,
                          org.apache.maven.model.License cl)
Check the given License URL against the CheckLicense which can contain more than one.

Parameters:
item - The CheckLicense instance which is used to check.
cl - The license which will be checked
Returns:
true if the License URL is equal to one of the URLs in CheckLicense.

checkNames

private boolean checkNames(LicenseItem item,
                           org.apache.maven.model.License cl)
Check the given License Name against the CheckLicense which can contain more than one.

Parameters:
item - The CheckLicense instance which is used to check.
cl - The license which will be checked
Returns:
true if the License name is equal to one of the Names in CheckLicense.

isCategory

public boolean isCategory(ArrayList<org.apache.maven.model.License> licenses,
                          LicenseValidator.Category category)

setStrictChecking

public void setStrictChecking(boolean strictChecking)

isStrictChecking

public boolean isStrictChecking()


Copyright © 2009-2011 SoftwareEntwicklung Beratung Schulung. All Rights Reserved.