|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.maven.plugin.AbstractMojo
org.nuiton.plugin.AbstractPlugin
org.nuiton.license.plugin.AbstractLicenseMojo
org.nuiton.license.plugin.AbstractLicenseWithDescriptorMojo
org.nuiton.license.plugin.UpdateFileHeaderMojo
public class UpdateFileHeaderMojo
The goal to update (or add) the header on some files described in
AbstractLicenseWithDescriptorMojo.descriptor file.
update-header goal which can not deal with
Copyright.
This goal use a specific project file descriptor project.xml to
describe all files to update for a whole project.
| 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 | |
|---|---|
protected boolean |
addSvnKeyWords
A flag to add svn:keywords on new header. |
protected boolean |
canUpdateCopyright
A flag to authorize update of the copyright part of the header. |
protected boolean |
canUpdateDescription
A flag to authorize update of the description part of the header. |
protected boolean |
canUpdateLicense
A flag to authorize update of the license part of the header. |
protected boolean |
clearAfterOperation
A flag to clear everything after execution. |
static String[] |
DEFAULT_EXCLUDES
|
static String[] |
DEFAULT_INCLUDES
|
static String[] |
DEFAULT_ROOTS
|
protected boolean |
dryRun
A flag to test plugin but modify no file. |
protected String[] |
excludes
Specific files to excludes, separated by a comma. |
protected Map<String,String> |
extraExtensions
To associate extra extension files to an existing comment style. |
protected String |
ignoreTag
A tag to place on files that will be ignored by the plugin. |
protected String |
inceptionYear
Inception year of the project. |
protected String[] |
includes
Specific files to includes, separated by a comma. |
protected String |
organizationName
Name of project's organization. |
protected String |
projectName
Name of project (or module). |
protected String[] |
roots
To specify the base dir from which we apply the license. |
protected boolean |
skipUpdateLicense
A flag to skip the goal. |
protected boolean |
updateCopyright
A flag to update copyright application time (change copyright last year if required) according to the last commit made on the processed file. |
| Fields inherited from interface org.apache.maven.plugin.Mojo |
|---|
ROLE |
| Constructor Summary | |
|---|---|
UpdateFileHeaderMojo()
|
|
| Method Summary | |
|---|---|
protected FileHeader |
buildDefaultFileHeader(License license,
String projectName,
String inceptionYear,
String copyrightHolder,
boolean addSvnKeyWords,
String encoding)
Build a default header given the parameters. |
protected void |
clear()
|
void |
doAction()
|
protected void |
finalize()
|
protected void |
finalizeFile(File file,
File processFile)
|
protected String |
getCommentStyleForExtenion(String extension)
Obtain the known Comment style from the given extension |
FileHeader |
getFileHeader()
|
Set<File> |
getFiles(org.nuiton.license.plugin.UpdateFileHeaderMojo.FileState state)
|
Map<String,List<File>> |
getFilesToTreateByCommentStyle()
|
UpdateFileHeaderFilter |
getFilter()
|
String |
getIgnoreTag()
|
String |
getInceptionYear()
|
String |
getOrganizationName()
|
Set<File> |
getProcessedFiles()
|
FileHeaderProcessor |
getProcessor()
|
String |
getProjectName()
|
EnumMap<org.nuiton.license.plugin.UpdateFileHeaderMojo.FileState,Set<File>> |
getResult()
|
long |
getTimestamp()
|
FileHeaderTransformer |
getTransformer()
|
FileHeaderTransformer |
getTransformer(String transformerName)
|
Map<String,FileHeaderTransformer> |
getTransformers()
|
void |
init()
|
boolean |
isAddSvnKeyWords()
|
boolean |
isCanUpdateCopyright()
|
boolean |
isCanUpdateDescription()
|
boolean |
isCanUpdateLicense()
|
boolean |
isClearAfterOperation()
|
boolean |
isDryRun()
|
boolean |
isSkip()
When is sets to true, will skip execution. |
boolean |
isUpdateCopyright()
|
protected Map<String,List<File>> |
obtainFilesToTreateByCommentStyle()
|
protected void |
prepareProcessFile(File file)
|
protected void |
processCommentStyle(String commentStyle,
List<File> filesToTreat)
|
protected boolean |
processFile(File file,
File processFile)
Process the given file and save the result in the given
processFile. |
protected void |
reportType(org.nuiton.license.plugin.UpdateFileHeaderMojo.FileState state,
StringBuilder buffer)
|
void |
setAddSvnKeyWords(boolean addSvnKeyWords)
|
void |
setCanUpdateCopyright(boolean canUpdateCopyright)
|
void |
setCanUpdateDescription(boolean canUpdateDescription)
|
void |
setCanUpdateLicense(boolean canUpdateLicense)
|
void |
setClearAfterOperation(boolean clearAfterOperation)
|
void |
setDryRun(boolean dryRun)
|
void |
setExcludes(String excludes)
|
void |
setExcludes(String[] excludes)
|
void |
setFilesToTreateByCommentStyle(Map<String,List<File>> filesToTreateByCommentStyle)
|
void |
setFilter(UpdateFileHeaderFilter filter)
|
void |
setHeader(FileHeader header)
|
void |
setIgnoreTag(String ignoreTag)
|
void |
setInceptionYear(String inceptionYear)
|
void |
setIncludes(String includes)
|
void |
setIncludes(String[] includes)
|
void |
setOrganizationName(String organizationName)
|
void |
setProcessor(FileHeaderProcessor processor)
|
void |
setProjectName(String projectName)
|
void |
setRoots(String roots)
|
void |
setRoots(String[] roots)
|
void |
setSkip(boolean skipUpdateLicense)
Changes internal state skip to execute (or not) goal. |
void |
setSkipUpdateLicense(boolean skipUpdateLicense)
|
void |
setTimestamp(long timestamp)
|
void |
setTransformer(FileHeaderTransformer transformer)
|
void |
setTransformers(Map<String,FileHeaderTransformer> transformers)
|
void |
setUpdateCopyright(boolean updateCopyright)
|
protected void |
validateLicenseProjectDescriptor(LicenseProjectDescriptor licenseProjectDescriptor)
|
| Methods inherited from class org.nuiton.license.plugin.AbstractLicenseWithDescriptorMojo |
|---|
checkLicense, checkSkip, getDescriptor, getEncoding, getLicense, getLicenseName, getLicenseProjectDescriptor, getLicenseResolver, getLicenseStore, getMainLicense, isKeepBackup, setDescriptor, setEncoding, setKeepBackup, setLicenseName, setLicenseProjectDescriptor, setLicenseResolver, setLicenseStore |
| 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, 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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.nuiton.license.plugin.header.FileHeaderProcessorConfiguration |
|---|
getLog |
| Methods inherited from interface org.nuiton.plugin.Plugin |
|---|
getProject, isVerbose, setProject, setVerbose |
| Methods inherited from interface org.apache.maven.plugin.Mojo |
|---|
execute, getLog, setLog |
| Field Detail |
|---|
protected String projectName
protected String organizationName
protected String inceptionYear
protected boolean addSvnKeyWords
Author, Id, Rev, URL and Date
protected boolean canUpdateDescription
protected boolean canUpdateCopyright
protected boolean canUpdateLicense
protected boolean updateCopyright
protected String ignoreTag
%%Ignore-License
protected boolean skipUpdateLicense
protected boolean dryRun
protected boolean clearAfterOperation
protected String[] roots
protected String[] includes
protected String[] excludes
protected Map<String,String> extraExtensions
java2 and jdata
as java files (says using the java comment style, declare this
in your plugin configuration :
<extraExtensions> <java2>java</java2> <jdata>java</jdata> </extraExtensions>Note: This parameter is not useable if you are still using a project file descriptor.
public static final String[] DEFAULT_INCLUDES
public static final String[] DEFAULT_EXCLUDES
public static final String[] DEFAULT_ROOTS
| Constructor Detail |
|---|
public UpdateFileHeaderMojo()
| Method Detail |
|---|
public void init()
throws Exception
init in class AbstractLicenseWithDescriptorMojoExceptionprotected Map<String,List<File>> obtainFilesToTreateByCommentStyle()
public void doAction()
throws Exception
doAction in class org.nuiton.plugin.AbstractPluginException
protected void processCommentStyle(String commentStyle,
List<File> filesToTreat)
throws IOException
IOException
protected void prepareProcessFile(File file)
throws IOException
IOException
protected boolean processFile(File file,
File processFile)
throws IOException
file and save the result in the given
processFile.
file - the file to processprocessFile - the ouput processed file
true if prepareProcessFile can be finalize, otherwise need to be delete
IOException - if any pb while treatment
protected void finalizeFile(File file,
File processFile)
throws IOException
IOException
protected void finalize()
throws Throwable
finalize in class ObjectThrowableprotected void clear()
protected void reportType(org.nuiton.license.plugin.UpdateFileHeaderMojo.FileState state,
StringBuilder buffer)
protected FileHeader buildDefaultFileHeader(License license,
String projectName,
String inceptionYear,
String copyrightHolder,
boolean addSvnKeyWords,
String encoding)
throws IOException
license - the license type ot use in headerprojectName - project name as header descriptioninceptionYear - first year of copyrightcopyrightHolder - holder of copyrightencoding - encoding used to read or write filesaddSvnKeyWords - a flag to add in description section svn keywords
IOException - if any problem while creating file headerprotected String getCommentStyleForExtenion(String extension)
extension - the extension to match with a comment style
public FileHeaderTransformer getTransformer(String transformerName)
throws IllegalArgumentException,
IllegalStateException
IllegalArgumentException
IllegalStateException
protected void validateLicenseProjectDescriptor(LicenseProjectDescriptor licenseProjectDescriptor)
throws org.apache.maven.plugin.MojoFailureException
validateLicenseProjectDescriptor in class AbstractLicenseWithDescriptorMojoorg.apache.maven.plugin.MojoFailureExceptionpublic boolean isClearAfterOperation()
public long getTimestamp()
public String getProjectName()
public String getInceptionYear()
public String getOrganizationName()
public boolean isUpdateCopyright()
public boolean isCanUpdateDescription()
public boolean isCanUpdateCopyright()
public boolean isCanUpdateLicense()
public String getIgnoreTag()
public boolean isDryRun()
public UpdateFileHeaderFilter getFilter()
public FileHeader getFileHeader()
getFileHeader in interface FileHeaderProcessorConfigurationpublic FileHeaderTransformer getTransformer()
getTransformer in interface FileHeaderProcessorConfigurationpublic boolean isSkip()
AbstractLicenseWithDescriptorMojotrue, will skip execution.
This will take effects in method AbstractLicenseWithDescriptorMojo.checkSkip().
So the method AbstractPlugin.doAction() will never be invoked.
isSkip in class AbstractLicenseWithDescriptorMojotrue if goal will not be executedpublic Set<File> getProcessedFiles()
public EnumMap<org.nuiton.license.plugin.UpdateFileHeaderMojo.FileState,Set<File>> getResult()
public Set<File> getFiles(org.nuiton.license.plugin.UpdateFileHeaderMojo.FileState state)
public boolean isAddSvnKeyWords()
public FileHeaderProcessor getProcessor()
public Map<String,FileHeaderTransformer> getTransformers()
public Map<String,List<File>> getFilesToTreateByCommentStyle()
public void setSkip(boolean skipUpdateLicense)
AbstractLicenseWithDescriptorMojoskip to execute (or not) goal.
setSkip in class AbstractLicenseWithDescriptorMojoskipUpdateLicense - new state valuepublic void setDryRun(boolean dryRun)
public void setTimestamp(long timestamp)
public void setProjectName(String projectName)
public void setSkipUpdateLicense(boolean skipUpdateLicense)
public void setInceptionYear(String inceptionYear)
public void setOrganizationName(String organizationName)
public void setUpdateCopyright(boolean updateCopyright)
public void setIgnoreTag(String ignoreTag)
public void setAddSvnKeyWords(boolean addSvnKeyWords)
public void setClearAfterOperation(boolean clearAfterOperation)
public void setTransformer(FileHeaderTransformer transformer)
public void setHeader(FileHeader header)
public void setProcessor(FileHeaderProcessor processor)
public void setFilter(UpdateFileHeaderFilter filter)
public void setCanUpdateDescription(boolean canUpdateDescription)
public void setCanUpdateCopyright(boolean canUpdateCopyright)
public void setCanUpdateLicense(boolean canUpdateLicense)
public void setTransformers(Map<String,FileHeaderTransformer> transformers)
public void setFilesToTreateByCommentStyle(Map<String,List<File>> filesToTreateByCommentStyle)
public void setRoots(String[] roots)
public void setRoots(String roots)
public void setIncludes(String[] includes)
public void setIncludes(String includes)
public void setExcludes(String[] excludes)
public void setExcludes(String excludes)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||