Package org.nuiton.i18n.plugin
Class AbstractI18nMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.nuiton.plugin.AbstractPlugin
-
- org.nuiton.i18n.plugin.AbstractI18nMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
,org.nuiton.plugin.Plugin
,org.nuiton.plugin.PluginWithEncoding
- Direct Known Subclasses:
AbstractCsvBundleMojo
,AbstractI18nBundleMojo
,AbstractI18nGenerateMojo
,GenerateI18nEnumHelperMojo
public abstract class AbstractI18nMojo extends org.nuiton.plugin.AbstractPlugin implements org.nuiton.plugin.PluginWithEncoding
Lower level i18n mojo abstraction. We defines here all commons parameters and shared behaviour.- Author:
- Tony Chemit - chemit@codelutin.com, Julien Ruchaud - ruchaud@codelutin.com
-
-
Field Summary
Fields Modifier and Type Field Description protected String
bundles
Locales to treate, separated by comma.protected String
encoding
Encoding used to load and store properties.protected Locale[]
locales
locales to processprotected org.apache.maven.execution.MavenSession
mavenSession
protected org.apache.maven.project.MavenProject
project
Dependance du projet.protected boolean
silent
Silent flag to see only errors in console.protected boolean
verbose
Verbose flag.
-
Constructor Summary
Constructors Constructor Description AbstractI18nMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
backupFile(File f)
protected void
checkBundle(Locale locale, Properties propertiesOut, boolean showEmpty, BundleValidation bundleValidation)
protected boolean
checkPackaging()
protected void
failsIfAnyKeyMissingInBundle(boolean failsIfWarning, BundleValidation bundleValidation)
protected void
failsIfAnyKeyMissingValue(boolean failsIfWarning, BundleValidation bundleValidation)
File
getBackupFile(File file)
String
getEncoding()
org.apache.maven.project.MavenProject
getProject()
void
init()
boolean
isSilent()
boolean
isVerbose()
void
setEncoding(String encoding)
void
setProject(org.apache.maven.project.MavenProject project)
void
setVerbose(boolean verbose)
-
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, checkEncoding, checkResource, checkRunOnceDone, checkSkip, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, doAction, execute, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, initClassLoader, isExecutionRoot, isFileNewerThanPomFile, needInvoke, needInvoke, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFile
-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
mavenSession
@Parameter(defaultValue="${session}", readonly=true) protected org.apache.maven.execution.MavenSession mavenSession
-
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
Dependance du projet.- Since:
- 1.0.2
-
bundles
@Parameter(property="i18n.bundles", defaultValue="fr_FR,en_GB", required=true) protected String bundles
Locales to treate, separated by comma. Example :fr_FR,en_GB
-
encoding
@Parameter(property="i18n.encoding", defaultValue="${project.build.sourceEncoding}", required=true) protected String encoding
Encoding used to load and store properties.
-
verbose
@Parameter(property="i18n.verbose", defaultValue="${maven.verbose}") protected boolean verbose
Verbose flag. Note : if not setted, we used themaven.verbose
property.
-
silent
@Parameter(property="i18n.silent", defaultValue="false") protected boolean silent
Silent flag to see only errors in console.- Since:
- 1.0.0-rc-5
-
locales
protected Locale[] locales
locales to process
-
-
Method Detail
-
checkPackaging
protected boolean checkPackaging()
- Overrides:
checkPackaging
in classorg.nuiton.plugin.AbstractPlugin
-
init
public void init() throws Exception
- Specified by:
init
in classorg.nuiton.plugin.AbstractPlugin
- Throws:
Exception
-
checkBundle
protected void checkBundle(Locale locale, Properties propertiesOut, boolean showEmpty, BundleValidation bundleValidation)
-
getBackupFile
public File getBackupFile(File file)
- Overrides:
getBackupFile
in classorg.nuiton.plugin.AbstractPlugin
-
backupFile
protected void backupFile(File f) throws IOException
- Overrides:
backupFile
in classorg.nuiton.plugin.AbstractPlugin
- Throws:
IOException
-
getProject
public org.apache.maven.project.MavenProject getProject()
- Specified by:
getProject
in interfaceorg.nuiton.plugin.Plugin
-
setProject
public void setProject(org.apache.maven.project.MavenProject project)
- Specified by:
setProject
in interfaceorg.nuiton.plugin.Plugin
-
isVerbose
public boolean isVerbose()
- Specified by:
isVerbose
in interfaceorg.nuiton.plugin.Plugin
-
setVerbose
public void setVerbose(boolean verbose)
- Specified by:
setVerbose
in interfaceorg.nuiton.plugin.Plugin
-
isSilent
public boolean isSilent()
-
getEncoding
public String getEncoding()
- Specified by:
getEncoding
in interfaceorg.nuiton.plugin.PluginWithEncoding
-
setEncoding
public void setEncoding(String encoding)
- Specified by:
setEncoding
in interfaceorg.nuiton.plugin.PluginWithEncoding
-
failsIfAnyKeyMissingValue
protected void failsIfAnyKeyMissingValue(boolean failsIfWarning, BundleValidation bundleValidation) throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
failsIfAnyKeyMissingInBundle
protected void failsIfAnyKeyMissingInBundle(boolean failsIfWarning, BundleValidation bundleValidation) throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
-