Class AbstractI18nMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.tentackle.pdo.DomainContextProvider
    Direct Known Subclasses:
    PullMojo, PushMojo

    public abstract class AbstractI18nMojo
    extends org.tentackle.maven.AbstractTentackleMojo
    implements org.tentackle.pdo.DomainContextProvider
    Base class for i18n mojos.
    Author:
    harald
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int bundleCount
      Bundle bundleCount.
      protected java.util.List<java.lang.String> classpathElements
      Project classpath.
      protected org.tentackle.pdo.DomainContext context
      The domain context to access the stored bundles.
      protected int errors
      Error bundleCount.
      protected java.lang.String locales
      Additional locales except the default one.
      protected java.util.List<java.lang.String> localeSuffixes
      Additional locale suffixes to scan for property files.
      Without leading underscore.
      java.lang.String password
      The backend password.
      protected int updates
      Number of updated translations.
      protected java.lang.String url
      The backend URL.
      java.lang.String user
      The backend username.
      protected int warnings
      Warning bundleCount.
      • Fields inherited from class org.tentackle.maven.AbstractTentackleMojo

        charset, filesets, mavenProject, resourceDirs, verbosity, verbosityLevel
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()  
      org.tentackle.pdo.DomainContext getDomainContext()  
      abstract void processBundle​(java.lang.ClassLoader classLoader, java.lang.String bundleName, java.lang.String locale, java.lang.String resourceName)
      Process the given bundle resource name.
      The resource name must not start with a leading slash because this method directly uses the classloader's getResourceAsStream method.
      protected boolean validate()  
      • Methods inherited from class org.tentackle.maven.AbstractTentackleMojo

        determineEncoding, determineVerbosity, findResourceDirs, getCanonicalPath, getPathRelativeToBasedir, getResourceDirName
      • 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.tentackle.pdo.DomainContextProvider

        on, op
    • Field Detail

      • classpathElements

        @Parameter(defaultValue="${project.compileClasspathElements}",
                   readonly=true,
                   required=true)
        protected java.util.List<java.lang.String> classpathElements
        Project classpath.
      • url

        @Parameter(required=true)
        protected java.lang.String url
        The backend URL.
      • user

        @Parameter(required=true)
        public java.lang.String user
        The backend username.
      • password

        @Parameter
        public java.lang.String password
        The backend password.
      • locales

        @Parameter
        protected java.lang.String locales
        Additional locales except the default one.
      • localeSuffixes

        protected java.util.List<java.lang.String> localeSuffixes
        Additional locale suffixes to scan for property files.
        Without leading underscore.
      • context

        protected org.tentackle.pdo.DomainContext context
        The domain context to access the stored bundles.
      • bundleCount

        protected int bundleCount
        Bundle bundleCount.
      • errors

        protected int errors
        Error bundleCount.
      • warnings

        protected int warnings
        Warning bundleCount.
      • updates

        protected int updates
        Number of updated translations.
    • Constructor Detail

      • AbstractI18nMojo

        public AbstractI18nMojo()
    • Method Detail

      • getDomainContext

        public org.tentackle.pdo.DomainContext getDomainContext()
        Specified by:
        getDomainContext in interface org.tentackle.pdo.DomainContextProvider
      • validate

        protected boolean validate()
                            throws org.apache.maven.plugin.MojoExecutionException
        Overrides:
        validate in class org.tentackle.maven.AbstractTentackleMojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • 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
      • processBundle

        public abstract void processBundle​(java.lang.ClassLoader classLoader,
                                           java.lang.String bundleName,
                                           java.lang.String locale,
                                           java.lang.String resourceName)
        Process the given bundle resource name.
        The resource name must not start with a leading slash because this method directly uses the classloader's getResourceAsStream method.
        Parameters:
        classLoader - the project classloader
        resourceName - the bundle resource name without leading slash
        bundleName - the original bundle class name
        locale - the locale, null if default