org.nuiton.license.plugin
Class AbstractLicenseWithDescriptorMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.nuiton.plugin.AbstractPlugin
          extended by org.nuiton.license.plugin.AbstractLicenseMojo
              extended by org.nuiton.license.plugin.AbstractLicenseWithDescriptorMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.nuiton.plugin.Plugin, org.nuiton.plugin.PluginWithEncoding
Direct Known Subclasses:
UpdateFileHeaderMojo, UpdateProjectLicenseMojo

public abstract class AbstractLicenseWithDescriptorMojo
extends AbstractLicenseMojo
implements org.nuiton.plugin.PluginWithEncoding

Abstract mojo which using descriptor file and owns a licenseStore.

Since:
2.1
Author:
tchemit

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
org.nuiton.plugin.Plugin.InitState, org.nuiton.plugin.Plugin.Packaging
 
Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractLicenseWithDescriptorMojo()
           
 
Method Summary
protected  void checkLicense(String licenseName)
          Check if the given license name is valid (not null, nor empty) and exists in the license store.
protected  boolean checkSkip()
           
 File getDescriptor()
          Deprecated. 
 String getEncoding()
           
 License getLicense(String licenseName)
           
 String getLicenseName()
           
 LicenseProjectDescriptor getLicenseProjectDescriptor()
          Deprecated. 
 String getLicenseResolver()
           
 LicenseStore getLicenseStore()
           
 License getMainLicense()
           
protected  void init()
           
 boolean isKeepBackup()
           
abstract  boolean isSkip()
          When is sets to true, will skip execution.
 void setDescriptor(File descriptor)
          Deprecated. 
 void setEncoding(String encoding)
           
 void setKeepBackup(boolean keepBackup)
           
 void setLicenseName(String licenseName)
           
 void setLicenseProjectDescriptor(LicenseProjectDescriptor licenseProjectDescriptor)
          Deprecated. 
 void setLicenseResolver(String licenseResolver)
           
 void setLicenseStore(LicenseStore licenseStore)
           
abstract  void setSkip(boolean skip)
          Changes internal state skip to execute (or not) goal.
protected  void validateLicenseProjectDescriptor(LicenseProjectDescriptor licenseProjectDescriptor)
          Deprecated. 
 
Methods inherited from class org.nuiton.license.plugin.AbstractLicenseMojo
createLicenseStore, getBuildTimestamp, getProject, getSession, isVerbose, setProject, setSession, setVerbose
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, backupFile, checkEncoding, checkPackaging, checkResource, checkRunOnceDone, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, doAction, execute, getBackupFile, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, initClassLoader, isExecutionRoot, isFileNewerThanPomFile, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFile
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nuiton.plugin.Plugin
getProject, isVerbose, setProject, setVerbose
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute, getLog, setLog
 

Constructor Detail

AbstractLicenseWithDescriptorMojo

public AbstractLicenseWithDescriptorMojo()
Method Detail

isSkip

public abstract boolean isSkip()
When is sets to true, will skip execution.

This will take effects in method checkSkip(). So the method AbstractPlugin.doAction() will never be invoked.

Returns:
true if goal will not be executed

setSkip

public abstract void setSkip(boolean skip)
Changes internal state skip to execute (or not) goal.

Parameters:
skip - new state value

checkSkip

protected boolean checkSkip()
Overrides:
checkSkip in class org.nuiton.plugin.AbstractPlugin

init

protected void init()
             throws Exception
Specified by:
init in class org.nuiton.plugin.AbstractPlugin
Throws:
Exception

validateLicenseProjectDescriptor

@Deprecated
protected void validateLicenseProjectDescriptor(LicenseProjectDescriptor licenseProjectDescriptor)
                                         throws org.apache.maven.plugin.MojoFailureException
Deprecated. 

Throws:
org.apache.maven.plugin.MojoFailureException

getMainLicense

public License getMainLicense()
                       throws IllegalArgumentException,
                              IllegalStateException,
                              org.apache.maven.plugin.MojoFailureException
Throws:
IllegalArgumentException
IllegalStateException
org.apache.maven.plugin.MojoFailureException

getLicense

public License getLicense(String licenseName)
                   throws IllegalArgumentException,
                          IllegalStateException
Throws:
IllegalArgumentException
IllegalStateException

checkLicense

protected void checkLicense(String licenseName)
                     throws IllegalArgumentException,
                            IllegalStateException,
                            org.apache.maven.plugin.MojoFailureException
Check if the given license name is valid (not null, nor empty) and exists in the license store.

Parameters:
licenseName - the name of the license to check
Throws:
IllegalArgumentException - if license is not valid
IllegalStateException - if license store is not initialized
org.apache.maven.plugin.MojoFailureException - if license does not exist
Since:
2.4.1

getEncoding

public final String getEncoding()
Specified by:
getEncoding in interface org.nuiton.plugin.PluginWithEncoding

setEncoding

public final void setEncoding(String encoding)
Specified by:
setEncoding in interface org.nuiton.plugin.PluginWithEncoding

getDescriptor

@Deprecated
public File getDescriptor()
Deprecated. 


isKeepBackup

public boolean isKeepBackup()

getLicenseName

public String getLicenseName()

getLicenseResolver

public String getLicenseResolver()

getLicenseStore

public LicenseStore getLicenseStore()

getLicenseProjectDescriptor

@Deprecated
public LicenseProjectDescriptor getLicenseProjectDescriptor()
Deprecated. 


setKeepBackup

public void setKeepBackup(boolean keepBackup)

setDescriptor

@Deprecated
public void setDescriptor(File descriptor)
Deprecated. 


setLicenseResolver

public void setLicenseResolver(String licenseResolver)

setLicenseName

public void setLicenseName(String licenseName)

setLicenseStore

public void setLicenseStore(LicenseStore licenseStore)

setLicenseProjectDescriptor

@Deprecated
public void setLicenseProjectDescriptor(LicenseProjectDescriptor licenseProjectDescriptor)
Deprecated. 



Copyright © 2008-2010 CodeLutin. All Rights Reserved.