public abstract class AbstractCrowdinMojo
extends org.apache.maven.plugin.AbstractMojo
Mojos.| Modifier and Type | Field and Description |
|---|---|
protected org.apache.http.impl.client.CloseableHttpClient |
client
The HTTP client
|
protected String |
comment
The custom comment header to add to translation files if
AbstractFileSet.addComment is true. |
protected String |
crowdinServerId
Server id in settings.xml.
|
protected File |
downloadFolder
The folder where the downloaded language files should be placed.
|
protected Path |
downloadFolderPath
The folder where the downloaded language files should be places as a
Path. |
protected String |
lineSeparator
The string to use as line separator.
|
protected org.apache.maven.execution.MavenSession |
mavenSession
The Maven Session object.
|
protected org.apache.maven.project.MavenProject |
project
The current Maven project
|
protected String |
rootBranch
The git branch that should be treated as root in Crowdin versions
management.
|
protected org.apache.maven.settings.Server |
server
The
Server to use for Crowdin credentials |
protected List<StatusFile> |
statusFiles
A list of
StatusFile elements that defines status files. |
protected List<TranslationFileSet> |
translationFileSets
A list of
TranslationFileSet elements that defines a set of
translation files. |
| Constructor and Description |
|---|
AbstractCrowdinMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
cleanDownloadFolder()
Deletes all files and folders in
downloadFolder. |
protected void |
createClient()
Initializes
client with a new CloseableHttpClient
instance unless one has already been created. |
protected String |
getBranch()
Gets the Crowdin branch name that matches the name of the current Git
branch.
|
protected String |
getBranch(boolean create,
org.jdom2.Document projectDetails)
Creates or gets the Crowdin branch name that matches the name of the
current Git branch.
|
protected void |
initializeParameters()
Initializes the
Mojo parameters since they are set via reflection
and can't be handled in the constructor. |
protected void |
initializeServer()
Initializes
server by retrieving the appropriate Server
instance from the Maven settings and validating its settings. |
static boolean |
isBlank(CharSequence cs)
Evaluates if the specified character sequence is
null, empty or
only consists of whitespace. |
protected void |
setClient(org.apache.http.impl.client.CloseableHttpClient client)
Sets the
CloseableHttpClient. |
protected void |
setComment(String comment)
Sets the
comment value. |
protected void |
setCrowdinServerId(String serverId)
Sets the
crowdinServerId value. |
protected void |
setDownloadFolder(File folder)
Sets the
downloadFolder and downloadFolderPath values. |
protected void |
setDownloadFolder(Path folder)
Sets the
downloadFolder and downloadFolderPath values. |
protected void |
setLineSeparator(String lineSeparator)
Sets the
lineSeparator value. |
protected void |
setProject(org.apache.maven.project.MavenProject value)
Sets the
project value. |
protected void |
setRootBranch(String branch)
Sets the
rootBranch value. |
protected void |
setServer(org.apache.maven.settings.Server server)
Sets the
Server to use for Crowdin credentials. |
protected void |
setStatusFiles(List<StatusFile> statusFiles)
Sets the
StatusFiles. |
protected void |
setTranslationFileSets(List<TranslationFileSet> translationFileSets)
Sets the
TranslationFileSets. |
getLog, getPluginContext, setLog, setPluginContextprotected org.apache.maven.execution.MavenSession mavenSession
protected org.apache.maven.project.MavenProject project
protected File downloadFolder
protected Path downloadFolderPath
Path. Since Maven doesn't seem to be able to handle Path
as a parameter, the File downloadFolder is used as an
intermediate.protected String comment
AbstractFileSet.addComment is true. If not configured,
a generic "do not modify" comment will be added.protected String lineSeparator
\n, \r or
\r\n as needed. If not specified, the default will be used.protected String rootBranch
protected String crowdinServerId
<username> is project identifier,
<password> is API key.protected List<TranslationFileSet> translationFileSets
TranslationFileSet elements that defines a set of
translation files.protected List<StatusFile> statusFiles
StatusFile elements that defines status files.protected org.apache.http.impl.client.CloseableHttpClient client
protected org.apache.maven.settings.Server server
Server to use for Crowdin credentialsprotected void setProject(org.apache.maven.project.MavenProject value)
project value.value - the MavenProject to set.protected void setDownloadFolder(Path folder)
downloadFolder and downloadFolderPath values.folder - the Path representing a folder to set.protected void setDownloadFolder(File folder)
downloadFolder and downloadFolderPath values.folder - the File representing a folder to set.protected void setComment(String comment)
comment value.comment - the comment to set.protected void setLineSeparator(String lineSeparator)
lineSeparator value.lineSeparator - the line-separator to set.protected void setRootBranch(String branch)
rootBranch value.branch - the Git root branch name.protected void setCrowdinServerId(String serverId)
crowdinServerId value.serverId - The Maven server id to set.crowdinServerIdprotected void setTranslationFileSets(List<TranslationFileSet> translationFileSets)
TranslationFileSets.translationFileSets - the TranslationFileSets to set.protected void setStatusFiles(List<StatusFile> statusFiles)
StatusFiles.statusFiles - the StatusFiles to set.protected void setClient(org.apache.http.impl.client.CloseableHttpClient client)
CloseableHttpClient.client - the CloseableHttpClient to set.protected void setServer(org.apache.maven.settings.Server server)
Server to use for Crowdin credentials.server - the Server to set.protected void initializeServer()
throws org.apache.maven.plugin.MojoExecutionException
server by retrieving the appropriate Server
instance from the Maven settings and validating its settings.org.apache.maven.plugin.MojoExecutionException - If a required parameter is missing or the
specified crowdinServerId isn't configured.protected void createClient()
throws org.apache.maven.plugin.MojoExecutionException
client with a new CloseableHttpClient
instance unless one has already been created.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.protected void initializeParameters()
throws org.apache.maven.plugin.MojoExecutionException
Mojo parameters since they are set via reflection
and can't be handled in the constructor.org.apache.maven.plugin.MojoExecutionException - If an error occurs during initialization.@Nullable protected String getBranch() throws org.apache.maven.plugin.MojoExecutionException
null if the current git branch is the
Crowdin root.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nullable protected String getBranch(boolean create, @Nullable org.jdom2.Document projectDetails) throws org.apache.maven.plugin.MojoExecutionException
create - whether the branch should be created at Crowdin if it
doesn't exist.projectDetails - the Document containing the project
details. If null the project details will be retrieved
from Crowdin.null if the current git branch is the
Crowdin root.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.protected void cleanDownloadFolder()
throws org.apache.maven.plugin.MojoExecutionException
downloadFolder.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.public static boolean isBlank(@Nullable CharSequence cs)
null, empty or
only consists of whitespace.cs - the CharSequence to evaluate.cs is null, empty or only consists of
whitespace, false otherwise.Copyright © 2018. All rights reserved.