org.nuiton
Class AbstractPlugin

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.nuiton.AbstractPlugin
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
LicensePlugin, RunJavaPlugin, ThirdPartyPlugin

public abstract class AbstractPlugin
extends org.apache.maven.plugin.AbstractMojo

Un MOJO de base pour les autres MOJO concrets avec les options communes.

Author:
chemit

Field Summary
protected  java.lang.String skipAfterInitMessage
           
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
protected AbstractPlugin(java.lang.String skipAfterInitMessage)
           
 
Method Summary
protected  void addCompileSourceRoots(java.io.File srcDir)
           
protected  void addResourceDir(java.lang.String dir)
           
protected  void addTestCompileSourceRoots(java.io.File srcDir)
           
protected  void addTestResourceDir(java.lang.String dir)
           
protected  void copyFile(java.io.File srcFile, java.io.File destFile)
          Does the actual copy of the file and logging.
protected  void copyFile(java.lang.String content, java.io.File destFile, java.lang.String encoding)
          Does the actual copy of the content to a fileand logging.
protected abstract  void doAction()
          Do plugin action.
protected abstract  boolean ensurePackaging()
           
 void execute()
           
protected  java.util.Map<java.lang.String,java.lang.String> getFilesToTreate(java.lang.String[] includes, java.lang.String[] excludes, java.io.File srcDir, MirroredFileUpdater updater)
           
protected  void getFilesToTreateForRoots(java.lang.String[] includes, java.lang.String[] excludes, java.util.List<java.lang.String> roots, java.util.Map<java.io.File,java.lang.String[]> files, MirroredFileUpdater updater)
           
abstract  org.apache.maven.project.MavenProject getProject()
           
protected abstract  boolean init()
          la methode qui est lancee au debut de la methode execute() pour preparer l'init du goal.
protected  java.net.URLClassLoader initClassLoader(org.apache.maven.project.MavenProject project, java.io.File src, boolean addSourcesToClassPath, boolean testPhase, boolean addResourcesToClassPath, boolean addCompileClassPath, boolean addProjectClassPath)
           
protected  boolean isFileNewerThanPomFile(java.io.File f)
          Test if a file exists and is newer than the pom file.
abstract  boolean isVerbose()
           
protected  void removeCompileSourceRoots(java.io.File srcDir)
           
protected  void removeTestCompileSourceRoots(java.io.File srcDir)
           
abstract  void setProject(org.apache.maven.project.MavenProject project)
           
abstract  void setVerbose(boolean verbose)
           
 void writeFile(java.io.File destFile, java.lang.String content, java.lang.String encoding)
           
 
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
 

Field Detail

skipAfterInitMessage

protected final java.lang.String skipAfterInitMessage
Constructor Detail

AbstractPlugin

protected AbstractPlugin(java.lang.String skipAfterInitMessage)
Method Detail

ensurePackaging

protected abstract boolean ensurePackaging()

init

protected abstract boolean init()
                         throws java.lang.Exception
la methode qui est lancee au debut de la methode execute() pour preparer l'init du goal.

Returns:
true if there is something to generate, false otherwise.
Throws:
java.lang.Exception - if any

doAction

protected abstract void doAction()
                          throws java.lang.Exception
Do plugin action.

The method execute() invoke this method only and only if :

Throws:
java.lang.Exception - if any

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

getProject

public abstract org.apache.maven.project.MavenProject getProject()

setProject

public abstract void setProject(org.apache.maven.project.MavenProject project)

isVerbose

public abstract boolean isVerbose()

setVerbose

public abstract void setVerbose(boolean verbose)

copyFile

protected void copyFile(java.io.File srcFile,
                        java.io.File destFile)
                 throws org.apache.maven.plugin.MojoExecutionException
Does the actual copy of the file and logging.

Parameters:
srcFile - represents the file to copy.
destFile - file name of destination file.
Throws:
org.apache.maven.plugin.MojoExecutionException - with a message if an error occurs.

copyFile

protected void copyFile(java.lang.String content,
                        java.io.File destFile,
                        java.lang.String encoding)
                 throws org.apache.maven.plugin.MojoExecutionException
Does the actual copy of the content to a fileand logging.

Parameters:
content - represents the content to writeFile into file.
destFile - file name of destination file.
encoding - encoding to use to writeFile file
Throws:
org.apache.maven.plugin.MojoExecutionException - with a message if an error occurs.

writeFile

public void writeFile(java.io.File destFile,
                      java.lang.String content,
                      java.lang.String encoding)
               throws java.io.IOException
Throws:
java.io.IOException

isFileNewerThanPomFile

protected boolean isFileNewerThanPomFile(java.io.File f)
Test if a file exists and is newer than the pom file.

Parameters:
f - the file to test
Returns:
true if file exists and is newer than the pom file, false otherwise.

getFilesToTreateForRoots

protected void getFilesToTreateForRoots(java.lang.String[] includes,
                                        java.lang.String[] excludes,
                                        java.util.List<java.lang.String> roots,
                                        java.util.Map<java.io.File,java.lang.String[]> files,
                                        MirroredFileUpdater updater)

getFilesToTreate

protected java.util.Map<java.lang.String,java.lang.String> getFilesToTreate(java.lang.String[] includes,
                                                                            java.lang.String[] excludes,
                                                                            java.io.File srcDir,
                                                                            MirroredFileUpdater updater)

addCompileSourceRoots

protected void addCompileSourceRoots(java.io.File srcDir)

removeCompileSourceRoots

protected void removeCompileSourceRoots(java.io.File srcDir)

addTestCompileSourceRoots

protected void addTestCompileSourceRoots(java.io.File srcDir)

removeTestCompileSourceRoots

protected void removeTestCompileSourceRoots(java.io.File srcDir)

addResourceDir

protected void addResourceDir(java.lang.String dir)

addTestResourceDir

protected void addTestResourceDir(java.lang.String dir)

initClassLoader

protected java.net.URLClassLoader initClassLoader(org.apache.maven.project.MavenProject project,
                                                  java.io.File src,
                                                  boolean addSourcesToClassPath,
                                                  boolean testPhase,
                                                  boolean addResourcesToClassPath,
                                                  boolean addCompileClassPath,
                                                  boolean addProjectClassPath)
                                           throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException


Copyright © 2009 CodeLutin. All Rights Reserved.