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, org.nuiton.plugin.Plugin
Direct Known Subclasses:
ParserJavaMojo, ParserXmlMojo

public abstract class AbstractI18nParserMojo
extends AbstractI18nMojo

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  boolean force
          To force reparse of all sources.
protected  boolean keysModifier
          Deprecated. since 1.2, will no more used
protected  org.nuiton.io.SortedProperties oldLanguage
           
protected  org.nuiton.io.SortedProperties oldParser
           
protected  boolean safeMode
          Deprecated. since 1.2, no more used
protected  boolean showTouchedFiles
          flag to display touched files while parsing.
protected  long t0
           
protected  boolean treateDefaultEntry
          treate default entry
 
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 doAction()
           
protected abstract  File getDefaultBasedir()
           
protected abstract  String[] getDefaultExcludes()
           
protected abstract  String[] getDefaultIncludes()
           
protected abstract  String getKeyModifierEnd()
          Deprecated. since 1.2, no more used, incompatible with multi-threading parsing
protected abstract  String getKeyModifierStart()
          Deprecated. since 1.2, no more used, incompatible with multi-threading parsing
static String getLogEntry(String msg, int nbFiles, long time, long all)
          Construit une chaine de log formatée.
protected abstract  String getOutGetter()
           
 void init()
           
 boolean isForce()
           
 boolean isStrictMode()
           
abstract  FileParser newFileParser()
           
abstract  org.nuiton.io.FileUpdater newFileUpdater(SourceEntry entry)
           
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.apache.maven.plugin.Mojo
getLog, setLog
 

Field Detail

keysModifier

@Deprecated
protected boolean keysModifier
Deprecated. since 1.2, will no more used
Active la modification de cle.

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

Note: Ce paramètre n'est plus actif, la fonctionnalité n'est plus disponible et sera remplacé par un autre goal.

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

@Deprecated
protected boolean safeMode
Deprecated. since 1.2, no more used
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

force

protected boolean force
To force reparse of all sources.

Since:
1.2
Is defined by:
expression:
${i18n.force}
default-value:
false

oldParser

protected org.nuiton.io.SortedProperties oldParser

oldLanguage

protected org.nuiton.io.SortedProperties oldLanguage

t0

protected long t0
Constructor Detail

AbstractI18nParserMojo

public AbstractI18nParserMojo()
Method Detail

getOutGetter

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

getKeyModifierStart

@Deprecated
protected abstract String getKeyModifierStart()
Deprecated. since 1.2, no more used, incompatible with multi-threading parsing

Returns:
the starting regex expression to catch keys in key modifier

getKeyModifierEnd

@Deprecated
protected abstract String getKeyModifierEnd()
Deprecated. since 1.2, no more used, incompatible with multi-threading parsing

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

newFileParser

public abstract FileParser newFileParser()

newFileUpdater

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

isStrictMode

public boolean isStrictMode()

isForce

public boolean isForce()

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

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


Copyright © 2007-2010 CodeLutin. All Rights Reserved.