org.nuiton.i18n.plugin.parser
Class AbstractI18nParser

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.nuiton.i18n.plugin.AbstractI18nPlugin
          extended by org.nuiton.i18n.plugin.parser.AbstractI18nParser
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, Parser
Direct Known Subclasses:
ParserJava, ParserXml

public abstract class AbstractI18nParser
extends AbstractI18nPlugin
implements Parser

Abstract implementation for parsing goal.

Author:
tony

Field Summary
protected  I18nSourceEntry[] entries
          Source entries (src+includes+excludes) .
protected  int fileTreated
           
protected  PluginHelper.SortedProperties oldLanguage
           
protected  PluginHelper.SortedProperties oldParser
           
protected  PluginHelper.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  java.util.List<java.io.File> treadedFiles
           
protected  boolean treateDefaultEntry
          treate default entry
 
Fields inherited from class org.nuiton.i18n.plugin.AbstractI18nPlugin
artifactId, bundles, DIRECTORY_INSTALL, encoding, events, genSrc, keepBackup, keysModifier, locales, out, silent, src, strictMode, verbose, verboseLog
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractI18nParser()
           
 
Method Summary
protected  void addDefaultEntry()
          Add the default entry to entries given in configuration.
 void execute()
           
protected abstract  java.io.File getDefaultBasedir()
           
protected abstract  java.lang.String[] getDefaultExcludes()
           
protected abstract  java.lang.String[] getDefaultIncludes()
           
protected abstract  java.lang.String getKeyModifierEnd()
           
protected abstract  java.lang.String getKeyModifierStart()
           
protected abstract  java.lang.String getOutGetter()
           
 void init()
           
 boolean isStrictMode()
           
abstract  FileUpdater newFileUpdater(SourceEntry entry)
           
 void parse()
          launch the parse on every given entries.
protected  void parseEntry(SourceEntry entry)
          launch parsing on a given entry.
protected  void saveGetterFile()
          Save the result in the getter file.
 
Methods inherited from class org.nuiton.i18n.plugin.AbstractI18nPlugin
addGetter, addParserEvent, backupFile, checkBundle, copyFile, getArtifactId, getGetterFile, getGetterFileBackup, getI18nFile, getI18nFileBackup, getVerboseLog, needGeneration, removeParserEvent
 
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
 

Field Detail

treateDefaultEntry

protected boolean treateDefaultEntry
treate default entry


entries

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


showTouchedFiles

protected boolean showTouchedFiles
flag to display touched files while parsing.

Note: the value will be always true if AbstractI18nPlugin.verbose is set at true.

Since:
0.9

safeMode

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

Since:
0.9

result

protected PluginHelper.SortedProperties result

oldParser

protected PluginHelper.SortedProperties oldParser

oldLanguage

protected PluginHelper.SortedProperties oldLanguage

fileTreated

protected int fileTreated

t0

protected long t0

touchFile

protected boolean touchFile

treadedFiles

protected java.util.List<java.io.File> treadedFiles
Constructor Detail

AbstractI18nParser

public AbstractI18nParser()
Method Detail

getOutGetter

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

getKeyModifierStart

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

getKeyModifierEnd

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

getDefaultIncludes

protected abstract java.lang.String[] getDefaultIncludes()
Returns:
the default includes to add to directory scanner

getDefaultExcludes

protected abstract java.lang.String[] getDefaultExcludes()
Returns:
the default excludes to add to directory scanner

getDefaultBasedir

protected abstract java.io.File getDefaultBasedir()
Returns:
the default src directory to use in directory scanner

newFileUpdater

public abstract FileUpdater newFileUpdater(SourceEntry entry)

isStrictMode

public boolean isStrictMode()

init

public void init()
Overrides:
init in class AbstractI18nPlugin

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException
Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

parse

public void parse()
           throws java.io.IOException
launch the parse on every given entries.

Specified by:
parse in interface Parser
Throws:
java.io.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 java.io.IOException
launch parsing on a given entry.

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

saveGetterFile

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

Throws:
java.io.IOException - if any io pb


Copyright © 2007-2009 CodeLutin. All Rights Reserved.