Class AbstractI18nParserMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.nuiton.plugin.AbstractPlugin
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, I18nParserConfiguration, org.nuiton.plugin.Plugin, org.nuiton.plugin.PluginWithEncoding
Direct Known Subclasses:
AbstractParserXmlMojo, ParserGWTJavaMojo, ParserJavaMojo, ParserStruts2Mojo

public abstract class AbstractI18nParserMojo extends AbstractI18nGenerateMojo implements I18nParserConfiguration
Abstract implementation for parsing goal.
Author:
Tony Chemit - chemit@codelutin.com
  • Field Details

    • src

      @Parameter(property="i18n.src", defaultValue="${basedir}/src/main/resources/i18n", required=true) protected File src
      Directory where to find project i18n files.
    • strictMode

      @Parameter(property="i18n.strictMode", defaultValue="false") protected boolean strictMode
      Strict mode to only keep in user i18n detected i18n keys and remove obsolete keys. Note : By default not active. Use this with care since it can delete keys. Moreover if this flag is activated, then all files will be parsed.
    • cp

      @Parameter(property="i18n.cp", defaultValue="${basedir}/target/classes") protected File cp
      Build directory (used to know if files in sources are up-to-date).
    • treateDefaultEntry

      @Parameter(property="i18n.treateDefaultEntry", defaultValue="true") protected boolean treateDefaultEntry
      To treat default entry offered by the mojo.
    • entries

      @Parameter(property="i18n.entries") protected I18nSourceEntry[] entries
      Source entries (src+includes+excludes) to process.
    • showTouchedFiles

      @Parameter(property="i18n.showTouchedFiles", defaultValue="${maven.verbose}") protected boolean showTouchedFiles
      Flag to display touched files while parsing. Note: the value will be always true if AbstractI18nMojo.verbose is set at true.
      Since:
      0.9
    • backupGetter

      @Parameter(property="i18n.backupGetter", defaultValue="false") protected boolean backupGetter
      Flag to save previous getter in a backup before doing parsing. Note: by default, do not perform backup (but it was here originaly so let it possible...)
      Since:
      1.0.2
    • force

      @Parameter(property="i18n.force", defaultValue="false") protected boolean force
      To force reparse of all sources.
      Since:
      1.2
    • acceptKeyFormat

      @Parameter(property="i18n.acceptKeyFormat") protected String acceptKeyFormat
      A regex pattern to accept incoming keys. Only incoming keys which match the pattern will be kept.
      Since:
      2.5
    • acceptPattern

      protected Pattern acceptPattern
    • oldParser

      protected org.nuiton.io.SortedProperties oldParser
    • oldLanguage

      protected org.nuiton.io.SortedProperties oldLanguage
    • t0

      protected long t0
  • Constructor Details

    • AbstractI18nParserMojo

      public AbstractI18nParserMojo()
  • Method Details

    • getOutGetter

      protected abstract String getOutGetter()
      Returns:
      the outGetter to use for the instance (java.getter,...)
    • getDefaultIncludes

      protected abstract String[] getDefaultIncludes()
      Returns:
      the default includes to add to directory scanner
    • getDefaultExcludes

      protected abstract String[] getDefaultExcludes()
      Returns:
      the default excludes to add to directory scanner
    • getDefaultBasedir

      protected abstract File getDefaultBasedir()
      Returns:
      the default src directory to use in directory scanner
    • newFileParser

      public abstract FileParser newFileParser(Pattern acceptPattern)
      Parameters:
      acceptPattern - optional pattern to accept incoming keys
      Returns:
      a new file parser to be used in the parser consumer parserExecutor
      Since:
      1.2
    • newFileUpdater

      public abstract org.nuiton.io.FileUpdater newFileUpdater(SourceEntry entry)
      Parameters:
      entry - the incoming source entry to attach to the file updater
      Returns:
      a new file updater to detects files to treate
    • isForce

      public boolean isForce()
    • init

      public void init() throws Exception
      Overrides:
      init in class AbstractI18nMojo
      Throws:
      Exception
    • onEnterEntry

      protected boolean onEnterEntry(I18nSourceEntry entry)
    • doAction

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

      public boolean isShowTouchedFiles()
      Specified by:
      isShowTouchedFiles in interface I18nParserConfiguration
    • getResult

      public org.nuiton.io.SortedProperties getResult()
      Specified by:
      getResult in interface I18nParserConfiguration
    • isStrictMode

      public boolean isStrictMode()
    • addDefaultEntry

      protected void addDefaultEntry()
      Add the default entry to entries given in configuration. This is a convinient method to simplify the configuration of the plugin.
    • saveGetterFile

      protected void saveGetterFile() throws IOException
      Save the result in the getter file.
      Throws:
      IOException - if any io pb
    • getLogEntry

      public static String getLogEntry(String msg, int nbFiles, long time, long all)
      Construit une chaine de log formatée.
      Parameters:
      msg - le prefix du message
      nbFiles - le nombre de fichiers actuellement traités
      time - le time de traitement de ce fichier
      all - le temps de traitement de tous les fichiers
      Returns:
      la chaine de log formatée