org.codehaus.mojo.license
Class DefaultThirdPartyTool

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.mojo.license.DefaultThirdPartyTool
All Implemented Interfaces:
ThirdPartyTool, org.codehaus.plexus.logging.LogEnabled

public class DefaultThirdPartyTool
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements ThirdPartyTool

Default implementation of the third party tool.

Version:
$Id: DefaultThirdPartyTool.java 14410 2011-08-10 20:54:51Z tchemit $
Author:
Tony Chemit

Field Summary
static String DESCRIPTOR_CLASSIFIER
           
static String DESCRIPTOR_TYPE
           
 
Fields inherited from interface org.codehaus.mojo.license.ThirdPartyTool
ROLE
 
Constructor Summary
DefaultThirdPartyTool()
           
 
Method Summary
 void addLicense(LicenseMap licenseMap, org.apache.maven.project.MavenProject project, org.apache.maven.model.License license)
          Add a given license to the given licenseMap for the given project.
 void addLicense(LicenseMap licenseMap, org.apache.maven.project.MavenProject project, List<?> licenses)
          Add a given licenses to the given licenseMap for the given project.
 void addLicense(LicenseMap licenseMap, org.apache.maven.project.MavenProject project, String licenseName)
          Add a license (name and url are licenseName) to the given licenseMap for the given project.
 void attachThirdPartyDescriptor(org.apache.maven.project.MavenProject project, File file)
          For the given project, attach the given file as a third-party file.
 SortedSet<org.apache.maven.project.MavenProject> getProjectsWithNoLicense(LicenseMap licenseMap, boolean doLog)
          From the given licenseMap, obtain all the projects with no license.
 SortedProperties loadThirdPartyDescriptorsForUnsafeMapping(String encoding, Collection<org.apache.maven.project.MavenProject> projects, SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies, LicenseMap licenseMap, org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories)
          
 SortedProperties loadUnsafeMapping(LicenseMap licenseMap, SortedMap<String,org.apache.maven.project.MavenProject> artifactCache, String encoding, File missingFile)
          
 void mergeLicenses(LicenseMap licenseMap, String... licenses)
          For a given licenseMap, merge all licenses.
 File resolvThirdPartyDescriptor(org.apache.maven.project.MavenProject project, org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> repositories)
          Obtain the third party file from the repository.
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIPTOR_CLASSIFIER

public static final String DESCRIPTOR_CLASSIFIER
See Also:
Constant Field Values

DESCRIPTOR_TYPE

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

DefaultThirdPartyTool

public DefaultThirdPartyTool()
Method Detail

attachThirdPartyDescriptor

public void attachThirdPartyDescriptor(org.apache.maven.project.MavenProject project,
                                       File file)
For the given project, attach the given file as a third-party file.

The file will be attached as with a classifier third-parties and a type properties.

Specified by:
attachThirdPartyDescriptor in interface ThirdPartyTool
Parameters:
project - the project on which to attch the third-party file
file - the third-party file to attach.

getProjectsWithNoLicense

public SortedSet<org.apache.maven.project.MavenProject> getProjectsWithNoLicense(LicenseMap licenseMap,
                                                                                 boolean doLog)
From the given licenseMap, obtain all the projects with no license.

Specified by:
getProjectsWithNoLicense in interface ThirdPartyTool
Parameters:
licenseMap - the license map to query
doLog - a flag to add debug logs
Returns:
the set of projects with no license

loadThirdPartyDescriptorsForUnsafeMapping

public SortedProperties loadThirdPartyDescriptorsForUnsafeMapping(String encoding,
                                                                  Collection<org.apache.maven.project.MavenProject> projects,
                                                                  SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies,
                                                                  LicenseMap licenseMap,
                                                                  org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                                                                  List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories)
                                                           throws ThirdPartyToolException,
                                                                  IOException

Specified by:
loadThirdPartyDescriptorsForUnsafeMapping in interface ThirdPartyTool
Parameters:
encoding - encoding used to read or write properties files
projects - all projects where to read third parties descriptors
unsafeDependencies - all unsafe projects
licenseMap - license map where to store new licenses
localRepository - local repository
remoteRepositories - remote repositories
Returns:
the map of loaded missing from the remote missing third party files
Throws:
ThirdPartyToolException - if any
IOException - if any

resolvThirdPartyDescriptor

public File resolvThirdPartyDescriptor(org.apache.maven.project.MavenProject project,
                                       org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                                       List<org.apache.maven.artifact.repository.ArtifactRepository> repositories)
                                throws ThirdPartyToolException
Obtain the third party file from the repository.

Will first search in the local repository, then into the remote repositories and will resolv it.

Specified by:
resolvThirdPartyDescriptor in interface ThirdPartyTool
Parameters:
project - the project
localRepository - the local repository
repositories - the remote repositories
Returns:
the locale file resolved into the local repository
Throws:
ThirdPartyToolException - if any

addLicense

public void addLicense(LicenseMap licenseMap,
                       org.apache.maven.project.MavenProject project,
                       String licenseName)
Add a license (name and url are licenseName) to the given licenseMap for the given project.

Specified by:
addLicense in interface ThirdPartyTool
Parameters:
licenseMap - the license map where to add the license
project - the project
licenseName - the name of the license

addLicense

public void addLicense(LicenseMap licenseMap,
                       org.apache.maven.project.MavenProject project,
                       org.apache.maven.model.License license)
Add a given license to the given licenseMap for the given project.

Specified by:
addLicense in interface ThirdPartyTool
Parameters:
licenseMap - the license map where to add the license
project - the project
license - the license to add

addLicense

public void addLicense(LicenseMap licenseMap,
                       org.apache.maven.project.MavenProject project,
                       List<?> licenses)
Add a given licenses to the given licenseMap for the given project.

Specified by:
addLicense in interface ThirdPartyTool
Parameters:
licenseMap - the license map where to add the licenses
project - the project
licenses - the licenses to add

mergeLicenses

public void mergeLicenses(LicenseMap licenseMap,
                          String... licenses)
For a given licenseMap, merge all licenses.

The first value of the licenses is the license to keep and all other values will be merged into the first one.

Specified by:
mergeLicenses in interface ThirdPartyTool
Parameters:
licenseMap - the license map to merge
licenses - all the licenses to merge (the first license will be the unique one to kkep)

loadUnsafeMapping

public SortedProperties loadUnsafeMapping(LicenseMap licenseMap,
                                          SortedMap<String,org.apache.maven.project.MavenProject> artifactCache,
                                          String encoding,
                                          File missingFile)
                                   throws IOException

Specified by:
loadUnsafeMapping in interface ThirdPartyTool
Throws:
IOException


Copyright © 2010-2012 The Kuali Foundation. All Rights Reserved.