org.nuiton.i18n.plugin.parser
Class AbstractI18nParserMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.nuiton.plugin.AbstractPlugin
          extended by org.nuiton.i18n.plugin.AbstractI18nMojo
              extended by org.nuiton.i18n.plugin.parser.AbstractI18nParserMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, Parser, org.nuiton.plugin.Plugin
Direct Known Subclasses:
ParserJavaMojo, ParserXmlMojo

public abstract class AbstractI18nParserMojo
extends AbstractI18nMojo
implements Parser

Abstract implementation for parsing goal.

Author:
tony

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 backupGetter
          flag to save previous getter in a backup before doing parsing.
protected  I18nSourceEntry[] entries
          Source entries (src+includes+excludes) .
protected  List<ParserEvent> events
          Liste des évènements
protected  int fileTreated
           
protected  boolean keysModifier
          Active la modification de cle.
protected  org.nuiton.io.SortedProperties oldLanguage
           
protected  org.nuiton.io.SortedProperties oldParser
           
protected  org.nuiton.io.SortedProperties result
           
protected  boolean safeMode
          flag to save at eachfile treated the getter file
protected  boolean showTouchedFiles
          flag to display touched files while parsing.
protected  long t0
           
protected  boolean touchFile
           
protected  List<File> treadedFiles
           
protected  boolean treateDefaultEntry
          treate default entry
protected  I18nLogger verboseLog
          logger verbeux
 
Fields inherited from class org.nuiton.i18n.plugin.AbstractI18nMojo
artifactId, bundles, encoding, genSrc, locales, out, project, silent, src, strictMode, verbose
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractI18nParserMojo()
           
 
Method Summary
protected  void addDefaultEntry()
          Add the default entry to entries given in configuration.
protected  void addParserEvent(ParserEvent parserEvent)
          Ajoute un évènement
protected  void doAction()
           
protected abstract  File getDefaultBasedir()
           
protected abstract  String[] getDefaultExcludes()
           
protected abstract  String[] getDefaultIncludes()
           
protected abstract  String getKeyModifierEnd()
           
protected abstract  String getKeyModifierStart()
           
protected abstract  String getOutGetter()
           
protected  I18nLogger getVerboseLog()
           
 void init()
           
 boolean isStrictMode()
           
abstract  org.nuiton.io.FileUpdater newFileUpdater(SourceEntry entry)
           
 void parse()
          Lancement du parser
protected  void parseEntry(SourceEntry entry)
          launch parsing on a given entry.
protected  void removeParserEvent(ParserEvent parserEvent)
          Supprime un évènement
protected  void saveGetterFile()
          Save the result in the getter file.
 
Methods inherited from class org.nuiton.i18n.plugin.AbstractI18nMojo
addGetter, backupFile, checkBundle, checkPackaging, getArtifactId, getBackupFile, getEncoding, getGetterFile, getI18nFile, getProject, isVerbose, needGeneration, setEncoding, setProject, setVerbose
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addTestResourceDir, addUrlToUrlsList, afterExecute, checkResource, checkRunOnceDone, checkSkip, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getTemplate, 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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nuiton.i18n.plugin.parser.Parser
parseFile, parseLine
 
Methods inherited from interface org.apache.maven.plugin.Mojo
getLog, setLog
 

Field Detail

keysModifier

protected boolean keysModifier
Active la modification de cle.

Note: par defaut, on ne l'active pas (build sur serveur non ui).

Is defined by:
expression:
${i18n.keysModifier}
default-value:
false

treateDefaultEntry

protected boolean treateDefaultEntry
treate default entry

Is defined by:
expression:
${i18n.treateDefaultEntry}
default-value:
true

entries

protected I18nSourceEntry[] entries
Source entries (src+includes+excludes) .

Is defined by:
expression:
${i18n.entries}

showTouchedFiles

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
Is defined by:
expression:
${i18n.showTouchedFiles}
default-value:
${maven.verbose}

safeMode

protected boolean safeMode
flag to save at eachfile treated the getter file

Since:
0.9
Is defined by:
expression:
${i18n.safeMode}
default-value:
false

backupGetter

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
Is defined by:
expression:
${i18n.backupGetter}
default-value:
false

events

protected List<ParserEvent> events
Liste des évènements


result

protected org.nuiton.io.SortedProperties result

oldParser

protected org.nuiton.io.SortedProperties oldParser

oldLanguage

protected org.nuiton.io.SortedProperties oldLanguage

fileTreated

protected int fileTreated

t0

protected long t0

touchFile

protected boolean touchFile

treadedFiles

protected List<File> treadedFiles

verboseLog

protected I18nLogger verboseLog
logger verbeux

Constructor Detail

AbstractI18nParserMojo

public AbstractI18nParserMojo()
Method Detail

getOutGetter

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

getKeyModifierStart

protected abstract String getKeyModifierStart()
Returns:
the starting regex expression to catch keys in key modifier

getKeyModifierEnd

protected abstract String getKeyModifierEnd()
Returns:
the ending regex expression to catch keys in key modifier

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

newFileUpdater

public abstract org.nuiton.io.FileUpdater newFileUpdater(SourceEntry entry)

isStrictMode

public boolean isStrictMode()

getVerboseLog

protected I18nLogger getVerboseLog()

init

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

doAction

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

parse

public void parse()
           throws IOException
Description copied from interface: Parser
Lancement du parser

Specified by:
parse in interface Parser
Throws:
IOException - if any io pb

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.


parseEntry

protected final void parseEntry(SourceEntry entry)
                         throws IOException
launch parsing on a given entry.

Parameters:
entry - currentEntry to treate
Throws:
IOException - if any io pb.

saveGetterFile

protected void saveGetterFile()
                       throws IOException
Save the result in the getter file.

Throws:
IOException - if any io pb

addParserEvent

protected void addParserEvent(ParserEvent parserEvent)
Ajoute un évènement

Parameters:
parserEvent - l'évènement d'ajout

removeParserEvent

protected void removeParserEvent(ParserEvent parserEvent)
Supprime un évènement

Parameters:
parserEvent - l'évènement de suppression


Copyright © 2007-2010 CodeLutin. All Rights Reserved.