Class AbstractCrowdinMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.exoplatform.crowdin.mojo.AbstractCrowdinMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
DownloadTranslationsMojo, RestoreTranslationMojo, UpdateCrowdInMojo, UpdateSourcesMojo, UploadTranslationMojo

public abstract class AbstractCrowdinMojo extends org.apache.maven.plugin.AbstractMojo
Author:
Philippe Aristote
  • Field Details

    • DEFAULT_TRANSLATIONS_REGISTRY_FILE_PATH

      public static final String DEFAULT_TRANSLATIONS_REGISTRY_FILE_PATH
      See Also:
    • crowdInArchive

      protected File crowdInArchive
  • Constructor Details

    • AbstractCrowdinMojo

      public AbstractCrowdinMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • loadProperties

      protected Properties loadProperties(String _propertiesFile) throws IOException
      A convenience method to load properties file
      Parameters:
      _propertiesFile - the name/path of the file to load
      Returns:
      the Properties file
      Throws:
      IOException
    • crowdInMojoExecute

      public abstract void crowdInMojoExecute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      The core method of the Mojo. Has to be overriden in each concrete Mojo.
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • getWorkingDir

      public File getWorkingDir()
    • isDryRun

      public boolean isDryRun()
    • isForce

      public boolean isForce()
    • getHelper

      public CrowdinAPIHelper getHelper()
    • getFactory

      public CrowdinFileFactory getFactory()
    • getProjectId

      public String getProjectId()
    • getProjectKey

      public String getProjectKey()
    • getTranslationsArchivePath

      public String getTranslationsArchivePath()
    • setTranslationsArchivePath

      public void setTranslationsArchivePath(String translationsArchivePath)
    • getTranslationsRegistryFilePath

      public String getTranslationsRegistryFilePath()
    • setTranslationsRegistryFilePath

      public void setTranslationsRegistryFilePath(String translationsRegistryFilePath)
    • getLanguages

      public List<String> getLanguages()
    • getApplyApprovedOnlyOption

      public String getApplyApprovedOnlyOption()
    • getProject

      public org.apache.maven.project.MavenProject getProject()
      The Maven Project Object
    • getMavenSession

      public org.apache.maven.execution.MavenSession getMavenSession()
    • getPluginManager

      public org.apache.maven.plugin.BuildPluginManager getPluginManager()
    • getProperties

      public Properties getProperties()
      Returns:
      The list of properties files that contain pointers to each file to manage with Crowdin
      Format: project-name-version=path/to/file.properties
      Example: cs-2.2.x=cs-2.2.x.properties
    • initDir

      protected void initDir(String _filePath)
      Create parent directories of a file
      Parameters:
      _filePath - the full path of the parent of that file
    • isAllPropertyFilesExisted

      protected boolean isAllPropertyFilesExisted()
    • initTranslations

      protected void initTranslations(CrowdinFile _master)
      A function that initializes translations of the master file given in parameter then upload these translations into Crowdin accordingly
      Parameters:
      _master - The master file of which translations will be detected and uploaded.
    • prepareAndUploadTranslation

      protected void prepareAndUploadTranslation(String transName, CrowdinFile _master, File file, boolean autoApprovedImported)
      prepareCrowdinTranslation and uploadTranslation
      Parameters:
      transName -
      _master -
      file -
    • printFileContent

      protected String printFileContent(File file)
    • execGit

      protected void execGit(File workingDirectory, String params) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • execGit

      protected void execGit(File workingDirectory, String params, org.twdata.maven.mojoexecutor.MojoExecutor.Element... successCodes) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException