org.nuiton.i18n.plugin.bundle
Class CollectI18nArtifactsMojo

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.CollectI18nArtifactsMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.nuiton.plugin.Plugin

public class CollectI18nArtifactsMojo
extends AbstractI18nBundleMojo

Detects any i18n artifacts and store the result as a file.

Created: 24 déc. 2009

Since:
1.0.2
Version:
$Revision: 1711 $

Mise a jour: $Date: 2010-03-09 19:18:28 +0100 (mar., 09 mars 2010) $ par : $Author: tchemit $

Author:
tchemit
Is defined by the goal name:
collect-i18n-artifacts
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  org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
          Artifact metadata source component.
protected  org.apache.maven.artifact.resolver.ArtifactCollector collector
          Artifact collector component.
protected  org.apache.maven.shared.dependency.tree.DependencyTreeBuilder dependencyTreeBuilder
          Dependency tree builder component.
protected  org.apache.maven.artifact.factory.ArtifactFactory factory
          Artifact Factory component.
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          Local Repository.
 
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
CollectI18nArtifactsMojo()
           
 
Method Summary
protected  I18nArtifact[] detectI18nArtifacts()
          Detecte les I18nArtifact et les retourne dans l'ordre de chargement dans le système i18n, i.e l'ordre des dependances entre artifacts.
protected  void doAction()
           
protected  URL[] getCollectI18nResources(Locale locale)
          Pour obtenir les urls des fichiers i18n d'un projet (avec recherche dans ses dépendances).
 void init()
           
protected  void storeCollectI18nResources(File bundleOut, URL[] urls)
           
 
Methods inherited from class org.nuiton.i18n.plugin.bundle.AbstractI18nBundleMojo
getCollectOutputFile
 
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

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
Local Repository.

Since:
1.0.2
Is defined by:
expression:
${localRepository}
Is readonly.
Is required.

dependencyTreeBuilder

protected org.apache.maven.shared.dependency.tree.DependencyTreeBuilder dependencyTreeBuilder
Dependency tree builder component.

Since:
1.0.2
Is a Plexus component defined by:

factory

protected org.apache.maven.artifact.factory.ArtifactFactory factory
Artifact Factory component.

Since:
1.0.2
Is a Plexus component defined by:

artifactMetadataSource

protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
Artifact metadata source component.

Since:
1.0.2
Is a Plexus component defined by:

collector

protected org.apache.maven.artifact.resolver.ArtifactCollector collector
Artifact collector component.

Since:
1.0.2
Is a Plexus component defined by:
Constructor Detail

CollectI18nArtifactsMojo

public CollectI18nArtifactsMojo()
Method Detail

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

getCollectI18nResources

protected URL[] getCollectI18nResources(Locale locale)
                                 throws IOException,
                                        org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException
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
org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException

storeCollectI18nResources

protected void storeCollectI18nResources(File bundleOut,
                                         URL[] urls)
                                  throws IOException
Throws:
IOException

detectI18nArtifacts

protected I18nArtifact[] detectI18nArtifacts()
                                      throws IOException,
                                             org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException
Detecte les I18nArtifact et les retourne dans l'ordre de chargement dans le système i18n, i.e l'ordre des dependances entre artifacts.

Returns:
les artifacts i18nables triés par leur ordre de chargement dans le système i18n.
Throws:
IOException - while detecting bundles from artifacts
org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException - if any error while building the depencendy tree


Copyright © 2007-2010 CodeLutin. All Rights Reserved.