org.nuiton.i18n.plugin.bundle
Class BundleMojo

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.bundle.AbstractI18nBundleMojo
                  extended by org.nuiton.i18n.plugin.bundle.AbstractMakeI18nBundleMojo
                      extended by org.nuiton.i18n.plugin.bundle.BundleMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.nuiton.plugin.Plugin, org.nuiton.plugin.PluginWithEncoding

public class BundleMojo
extends AbstractMakeI18nBundleMojo

Generate an aggregate i18n bundle for all dependencies of the project.

The main idea is to have a final unique i18n bundle for a application to launch, this really improve i18n loading time to have a unique named bundle, no need to seek in all dependencies...

Moreover, this permits also to deal with order of i18n keys, more precisly, we want to use the higher level i18n key for an application. If the i18n key is present on a library, we want to be able to override it in application (or user wants it:)).

This goal permits this using the dependencies graph order of artifacts.

Since:
0.12
Author:
tchemit
Is defined to be executed in:
goal:
collect-i18n-artifacts
Is defined by the goal name:
bundle
Is bound to the specified phase of the standard build lifecycle:
generate-resources
Requires the dependencies in this specified scope:
runtime
Requires a Maven project to run:
true

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 addBundleOuputDirParent
          A flag to use the parent of directory AbstractMakeI18nBundleMojo.bundleOutputDir as directory to add in build ressources.
protected  boolean generateDefinitionFile
          A flag to generate the i18n definition file.
 
Fields inherited from class org.nuiton.i18n.plugin.bundle.AbstractMakeI18nBundleMojo
bundleOutputDir, bundleOutputName, checkBundle, failsIfWarning, showEmpty, unsafeMapping
 
Fields inherited from class org.nuiton.i18n.plugin.bundle.AbstractI18nBundleMojo
collectOutputDir, collectOutputName
 
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
BundleMojo()
           
 
Method Summary
protected  void doAction()
           
protected  void generateDefinitionFile(String version, Map<Locale,String> bundleDico)
           
protected  URL[] getCollectI18nResources(Locale locale)
          Pour obtenir les urls des fichiers i18n d'un projet (avec recherche dans ses dépendances).
 void init()
           
 
Methods inherited from class org.nuiton.i18n.plugin.bundle.AbstractMakeI18nBundleMojo
failsIfWarning
 
Methods inherited from class org.nuiton.i18n.plugin.bundle.AbstractI18nBundleMojo
getCollectOutputFile, getLinesAsURL
 
Methods inherited from class org.nuiton.i18n.plugin.AbstractI18nMojo
addGetter, backupFile, checkBundle, checkPackaging, getArtifactId, getBackupFile, getEncoding, getGetterFile, getI18nFile, getProject, isSilent, isStrictMode, 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.apache.maven.plugin.Mojo
execute, getLog, setLog
 

Field Detail

addBundleOuputDirParent

protected boolean addBundleOuputDirParent
A flag to use the parent of directory AbstractMakeI18nBundleMojo.bundleOutputDir as directory to add in build ressources.

If the flag is not activated, the, we use directly the given AbstractMakeI18nBundleMojo.bundleOutputDir directory.

Note : By default we use the parent directory, since this is more natural, only special cases should desactivate this parameter.

Since:
2.0
Is defined by:
expression:
${i18n.addBundleOuputDirParent}
default-value:
true

generateDefinitionFile

protected boolean generateDefinitionFile
A flag to generate the i18n definition file.

This file contains all generated bundles and the paths of all i18n artifacts used to make it.

Since:
2.0
Is defined by:
expression:
${i18n.generateDefinitionFile}
default-value:
true
Constructor Detail

BundleMojo

public BundleMojo()
Method Detail

init

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

doAction

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

generateDefinitionFile

protected void generateDefinitionFile(String version,
                                      Map<Locale,String> bundleDico)
                               throws IOException
Throws:
IOException

getCollectI18nResources

protected URL[] getCollectI18nResources(Locale locale)
                                 throws IOException
Description copied from class: AbstractI18nBundleMojo
Pour obtenir les urls des fichiers i18n d'un projet (avec recherche dans ses dépendances).

Note: L'ordre des urls reflète l'ordre des dépendances.

Specified by:
getCollectI18nResources in class AbstractI18nBundleMojo
Parameters:
locale - la locale a traiter
Returns:
les urls des bundles i18n detectees pour le projet.
Throws:
IOException


Copyright © 2007-2010 CodeLutin. All Rights Reserved.