org.nuiton.i18n.plugin.parser.impl
Class AbstractParserXmlMojo

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
                  extended by org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo
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:
ParserJspMojo, ParserValidationMojo, ParserXmlUserMojo

public abstract class AbstractParserXmlMojo
extends AbstractI18nParserMojo

Abstract xml parser mojo.

Since:
2.0
Author:
tchemit , jruchaud

Nested Class Summary
static class AbstractParserXmlMojo.XmlFileParser
           
 
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
org.nuiton.plugin.Plugin.InitState, org.nuiton.plugin.Plugin.Packaging
 
Field Summary
protected static int BUFFER_SIZE
          Taille du buffer pour les lectures/écritures
protected  DocumentBuilderFactory documentBuilderFactory
          Document builder factory to load xml files.
protected  XPathFactory factory
          XPath factory used to detect i18n keys in xml files.
protected  Map<String,String> namespaces
          Defines namespaces mapping if needed.
protected  String rules
          available rules to detect i18n keys in xml files.
protected  String[] userRulesFiles
          Extra rules files to use for detecting i18n keys in xml validation files.
 
Fields inherited from class org.nuiton.i18n.plugin.parser.AbstractI18nParserMojo
backupGetter, cp, entries, force, oldLanguage, oldParser, showTouchedFiles, t0, treateDefaultEntry
 
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
AbstractParserXmlMojo()
           
 
Method Summary
protected abstract  String getCoreRuleFile()
           
protected  List<String> getRulefiles()
          Obtain the list of files which define rules to apply.
 String[] getUserRuleFiles()
           
 void init()
           
protected  String loadRules(List<String> files)
           
protected  String loadRulesFile(String fileRules)
           
 FileParser newFileParser()
           
protected abstract  AbstractParserXmlMojo.XmlFileParser newXmlFileParser(XPath xpath, DocumentBuilder builder)
           
 
Methods inherited from class org.nuiton.i18n.plugin.parser.AbstractI18nParserMojo
addDefaultEntry, doAction, getDefaultBasedir, getDefaultExcludes, getDefaultIncludes, getLogEntry, getOutGetter, getResult, isForce, isShowTouchedFiles, isStrictMode, newFileUpdater, onEnterEntry, saveGetterFile
 
Methods inherited from class org.nuiton.i18n.plugin.AbstractI18nMojo
addGetter, backupFile, checkBundle, checkPackaging, getArtifactId, getBackupFile, getEncoding, getGetterFile, getI18nFile, getProject, isSilent, isVerbose, needGeneration, setEncoding, setProject, setVerbose
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, checkEncoding, checkResource, checkRunOnceDone, checkSkip, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, 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.I18nParserConfiguration
getLog, isSilent, isVerbose
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute, getLog, setLog
 

Field Detail

BUFFER_SIZE

protected static final int BUFFER_SIZE
Taille du buffer pour les lectures/écritures

See Also:
Constant Field Values

rules

protected String rules
available rules to detect i18n keys in xml files.


factory

protected XPathFactory factory
XPath factory used to detect i18n keys in xml files.


documentBuilderFactory

protected DocumentBuilderFactory documentBuilderFactory
Document builder factory to load xml files.


userRulesFiles

protected String[] userRulesFiles
Extra rules files to use for detecting i18n keys in xml validation files.

Note : If the coreRulesFile is not defined, then you must fill this parameter.

Since:
2.0
Is defined by:

namespaces

protected Map<String,String> namespaces
Defines namespaces mapping if needed.

Example :

 <namespaces>
 <s>http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd</s>
 </namespaces>
 

Since:
2.0
Is defined by:
Constructor Detail

AbstractParserXmlMojo

public AbstractParserXmlMojo()
Method Detail

getCoreRuleFile

protected abstract String getCoreRuleFile()

newXmlFileParser

protected abstract AbstractParserXmlMojo.XmlFileParser newXmlFileParser(XPath xpath,
                                                                        DocumentBuilder builder)

getRulefiles

protected List<String> getRulefiles()
Obtain the list of files which define rules to apply.

Returns:
the list of path to rule files to used.

init

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

getUserRuleFiles

public final String[] getUserRuleFiles()

newFileParser

public final FileParser newFileParser()
Specified by:
newFileParser in class AbstractI18nParserMojo
Returns:
a new file parser to be used in the parser consumer parserExecutor

loadRules

protected String loadRules(List<String> files)

loadRulesFile

protected String loadRulesFile(String fileRules)
                        throws IOException
Throws:
IOException


Copyright © 2007-2011 CodeLutin. All Rights Reserved.