|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.maven.plugin.AbstractMojo org.codehaus.mojo.license.AbstractLicenseMojo org.codehaus.mojo.license.AbstractLicenseNameMojo org.codehaus.mojo.license.UpdateFileHeaderMojo
public class UpdateFileHeaderMojo
The goal to update (or add) the header on project source files.
This goal replace theupdate-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.
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()
Do plugin action. |
protected void |
finalize()
|
protected void |
finalizeFile(File file,
File processFile)
|
FileHeader |
getFileHeader()
|
Set<File> |
getFiles(org.codehaus.mojo.license.UpdateFileHeaderMojo.FileState state)
|
Map<String,List<File>> |
getFilesToTreateByCommentStyle()
|
protected void |
getFilesToTreateForRoots(String[] includes,
String[] excludes,
List<String> roots,
Map<File,String[]> files)
Collects some file. |
UpdateFileHeaderFilter |
getFilter()
|
String |
getIgnoreTag()
|
String |
getInceptionYear()
|
String |
getOrganizationName()
|
Set<File> |
getProcessedFiles()
|
FileHeaderProcessor |
getProcessor()
|
String |
getProjectName()
|
EnumMap<org.codehaus.mojo.license.UpdateFileHeaderMojo.FileState,Set<File>> |
getResult()
|
long |
getTimestamp()
|
FileHeaderTransformer |
getTransformer()
|
FileHeaderTransformer |
getTransformer(String transformerName)
|
Map<String,FileHeaderTransformer> |
getTransformers()
|
void |
init()
Method to initialize the mojo before doing any concrete actions. |
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.codehaus.mojo.license.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)
|
Methods inherited from class org.codehaus.mojo.license.AbstractLicenseNameMojo |
---|
checkSkip, getLicense, getLicense, getLicenseName, getLicenseResolver, getLicenseStore, isKeepBackup, setKeepBackup, setLicenseName, setLicenseResolver, setLicenseStore |
Methods inherited from class org.codehaus.mojo.license.AbstractLicenseMojo |
---|
acceptPackaging, addResourceDir, afterExecute, checkEncoding, checkPackaging, execute, getBuildTimestamp, getEncoding, getProject, getSession, hasClassPath, isVerbose, rejectPackaging, setEncoding, setProject, setSession, setVerbose |
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.codehaus.mojo.license.header.FileHeaderProcessorConfiguration |
---|
getLog |
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
AbstractLicenseMojo
AbstractLicenseMojo.doAction()
method.
init
in class AbstractLicenseNameMojo
Exception
- if anyprotected Map<String,List<File>> obtainFilesToTreateByCommentStyle()
public void doAction() throws Exception
AbstractLicenseMojo
AbstractLicenseMojo.execute()
invoke this method only and only if :
AbstractLicenseMojo.checkPackaging()
returns true
.AbstractLicenseMojo.init()
returns true
.
doAction
in class AbstractLicenseMojo
Exception
- if anyprotected 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 treatmentprotected void finalizeFile(File file, File processFile) throws IOException
IOException
protected void finalize() throws Throwable
finalize
in class Object
Throwable
protected void clear()
protected void reportType(org.codehaus.mojo.license.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 headerpublic FileHeaderTransformer getTransformer(String transformerName) throws IllegalArgumentException, IllegalStateException
IllegalArgumentException
IllegalStateException
public 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 FileHeaderProcessorConfiguration
public FileHeaderTransformer getTransformer()
getTransformer
in interface FileHeaderProcessorConfiguration
public boolean isSkip()
AbstractLicenseNameMojo
true
, will skip execution.
This will take effects in method AbstractLicenseNameMojo.checkSkip()
.
So the method AbstractLicenseMojo.doAction()
will never be invoked.
isSkip
in class AbstractLicenseNameMojo
true
if goal will not be executedpublic Set<File> getProcessedFiles()
public EnumMap<org.codehaus.mojo.license.UpdateFileHeaderMojo.FileState,Set<File>> getResult()
public Set<File> getFiles(org.codehaus.mojo.license.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)
AbstractLicenseNameMojo
skip
to execute (or not) goal.
setSkip
in class AbstractLicenseNameMojo
skipUpdateLicense
- 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)
protected void getFilesToTreateForRoots(String[] includes, String[] excludes, List<String> roots, Map<File,String[]> files)
includes
- includesexcludes
- excludesroots
- root directories to treatefiles
- cache of file detected indexed by their root directory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |