org.nuiton.helper.plugin
Class ShareServerSecretPlugin

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.nuiton.plugin.AbstractPlugin
          extended by org.nuiton.helper.plugin.ShareServerSecretPlugin
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, Plugin

public class ShareServerSecretPlugin
extends AbstractPlugin

Obtain a server authentication and share it in the maven project properties.

To select data to export from the server with the given serverId, fill the properties :

   usernameOut
   passwordOut
   privateKeyOut
   passphraseOut
 

Since:
1.1.0
Author:
tchemit
Is defined by the goal name:
share-server-secret
Is bound to the specified phase of the standard build lifecycle:
initialize
Requires a Maven project to run:
true

Nested Class Summary
static class ShareServerSecretPlugin.Property
           
 
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
Plugin.InitState, Plugin.Packaging
 
Field Summary
protected  String passphraseOut
          The name of the property where to export the passphrase of the server.
protected  String passwordOut
          The name of the property where to export the password of the server.
protected  String privateKeyOut
          The name of the property where to export the private key of the server.
protected  org.apache.maven.project.MavenProject project
          Project.
protected  boolean runOnce
          A flag to execute only once the mojo.
protected  org.sonatype.plexus.components.sec.dispatcher.SecDispatcher sec
          password decypher
protected  String serverId
          Server id to use for authentication (must be defined in your setting and use the maven >= 2.1.0 password encryption mecanism).
protected  org.apache.maven.settings.Settings settings
          Settings.
protected  String usernameOut
          The name of the property where to export the username of the server.
protected  boolean verbose
          A flag to activate verbose mode.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
ShareServerSecretPlugin()
           
 
Method Summary
 boolean checkSkip()
          Checks if the mojo execution should be skipped.
protected  void doAction()
          Do plugin action.
 String getPassphraseOut()
           
 String getPasswordOut()
           
 String getPrivateKeyOut()
           
 org.apache.maven.project.MavenProject getProject()
           
 String getServerId()
           
 String getUsernameOut()
           
 void init()
          Method to initialize the mojo before doing any concrete actions.
 boolean isVerbose()
           
 void setPassphraseOut(String passphraseOut)
           
 void setPasswordOut(String passwordOut)
           
 void setPrivateKeyOut(String privateKeyOut)
           
 void setProject(org.apache.maven.project.MavenProject project)
           
 void setRunOnce(boolean runOnce)
           
 void setSec(org.sonatype.plexus.components.sec.dispatcher.SecDispatcher sec)
           
 void setServerId(String serverId)
           
 void setSettings(org.apache.maven.settings.Settings settings)
           
 void setUsernameOut(String usernameOut)
           
 void setVerbose(boolean verbose)
           
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, backupFile, checkEncoding, checkPackaging, checkResource, checkRunOnceDone, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getBackupFile, 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
getLog, setLog
 

Field Detail

project

protected org.apache.maven.project.MavenProject project
Project.

Since:
1.1.0
Is defined by:
default-value:
${project}
Is readonly.
Is required.

settings

protected org.apache.maven.settings.Settings settings
Settings.

Since:
1.1.0
Is defined by:
default-value:
${settings}
Is readonly.
Is required.

serverId

protected String serverId
Server id to use for authentication (must be defined in your setting and use the maven >= 2.1.0 password encryption mecanism).

Since:
1.1.0
Is defined by:
expression:
${helper.serverId}
Is required.

usernameOut

protected String usernameOut
The name of the property where to export the username of the server.

Note: If not set - then no export of the username of the server.

Since:
1.1.0
Is defined by:

passwordOut

protected String passwordOut
The name of the property where to export the password of the server.

Note: If not set - then no export of the password of the server.

Note: If the password is crypted (since maven 2.1.0) then decrypt it.

Since:
1.1.0
Is defined by:

passphraseOut

protected String passphraseOut
The name of the property where to export the passphrase of the server.

Note: If not set - then no export of the passphrase of the server.

Note: If the passphrase is crypted (since maven 2.1.0) then decrypt it.

Since:
1.1.0
Is defined by:

privateKeyOut

protected String privateKeyOut
The name of the property where to export the private key of the server.

Note: If not set - then no export of the private key of the server.

Since:
1.1.0
Is defined by:

verbose

protected boolean verbose
A flag to activate verbose mode.

Since:
1.1.0
Is defined by:
expression:
${helper.verbose}
default-value:
${maven.verbose}

runOnce

protected boolean runOnce
A flag to execute only once the mojo.

Note: By default, value is true since it is not necessary to inject twice secrets in session.

Since:
1.1.0
Is defined by:
expression:
${helper.runOnce}
default-value:
true

sec

protected org.sonatype.plexus.components.sec.dispatcher.SecDispatcher sec
password decypher

Since:
1.1.0
Is a Plexus component defined by:
roleHint:
maven-helper-plugin
Constructor Detail

ShareServerSecretPlugin

public ShareServerSecretPlugin()
Method Detail

init

public void init()
          throws Exception
Description copied from class: AbstractPlugin
Method to initialize the mojo before doing any concrete actions.

Note: The method is invoked before the AbstractPlugin.doAction() method.

Specified by:
init in class AbstractPlugin
Throws:
Exception - if any

checkSkip

public boolean checkSkip()
Description copied from class: AbstractPlugin
Checks if the mojo execution should be skipped.

Overrides:
checkSkip in class AbstractPlugin
Returns:
false if the mojo should not be executed.

doAction

protected void doAction()
                 throws Exception
Description copied from class: AbstractPlugin
Do plugin action.

The method AbstractPlugin.execute() invoke this method only and only if :

Specified by:
doAction in class AbstractPlugin
Throws:
Exception - if any

getProject

public org.apache.maven.project.MavenProject getProject()

setProject

public void setProject(org.apache.maven.project.MavenProject project)

isVerbose

public boolean isVerbose()

setVerbose

public void setVerbose(boolean verbose)

getPassphraseOut

public String getPassphraseOut()

setPassphraseOut

public void setPassphraseOut(String passphraseOut)

getPasswordOut

public String getPasswordOut()

setPasswordOut

public void setPasswordOut(String passwordOut)

getPrivateKeyOut

public String getPrivateKeyOut()

setPrivateKeyOut

public void setPrivateKeyOut(String privateKeyOut)

getUsernameOut

public String getUsernameOut()

setUsernameOut

public void setUsernameOut(String usernameOut)

getServerId

public String getServerId()

setServerId

public void setServerId(String serverId)

setSec

public void setSec(org.sonatype.plexus.components.sec.dispatcher.SecDispatcher sec)

setSettings

public void setSettings(org.apache.maven.settings.Settings settings)

setRunOnce

public void setRunOnce(boolean runOnce)


Copyright © 2009-2010 CodeLutin. All Rights Reserved.