org.jvnet.hudson.maven.plugins.hudson
Class AddJobMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.jvnet.hudson.maven.plugins.hudson.AbstractHudsonMojo
          extended by org.jvnet.hudson.maven.plugins.hudson.AddJobMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
ReplaceJobMojo

public class AddJobMojo
extends AbstractHudsonMojo

Goal which creates a Hudson job.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jvnet.hudson.maven.plugins.hudson.AbstractHudsonMojo
AbstractHudsonMojo.JobClosure, AbstractHudsonMojo.PluginType
 
Field Summary
 
Fields inherited from class org.jvnet.hudson.maven.plugins.hudson.AbstractHudsonMojo
httpClient, hudsonURL, project, settings
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AddJobMojo()
           
 
Method Summary
protected  java.lang.String createPayload()
          Create a paylod XML for submission to Hudson.
protected  java.net.URL createPostURL()
          Create the URL for posting to Hudson.
 void execute()
          Add the job to Hudson, if necessary.
protected  java.lang.String getJobName()
          Determine the job name.
protected  boolean jobExists()
          Method to check if a job already exists.
protected  void postPayload(java.net.URL postURL, java.lang.String payload)
          Post the XML payload to Hudson.
 
Methods inherited from class org.jvnet.hudson.maven.plugins.hudson.AbstractHudsonMojo
configurePlugin, createHudsonURL, createJobBuildURL, createJobConfigURL, createJobListURL, createOrChange, createOrChange, doPost, doPost, findServer, forEachJob, getDocumentFromHudson, getJobList, loadJobConfig, rebuildJob, saveJobConfig, setupClient
 
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
 

Constructor Detail

AddJobMojo

public AddJobMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Add the job to Hudson, if necessary.

Throws:
org.apache.maven.plugin.MojoExecutionException - if something goes wrong

createPayload

protected java.lang.String createPayload()
                                  throws org.apache.maven.plugin.MojoExecutionException
Create a paylod XML for submission to Hudson.

Returns:
the XML to post to Hudson
Throws:
org.apache.maven.plugin.MojoExecutionException - if something goes wrong

createPostURL

protected java.net.URL createPostURL()
                              throws org.apache.maven.plugin.MojoExecutionException
Create the URL for posting to Hudson.

Returns:
the URL to post to on Hudson
Throws:
org.apache.maven.plugin.MojoExecutionException

getJobName

protected java.lang.String getJobName()
Determine the job name. Will use jobName if available.

Returns:
the job name

jobExists

protected boolean jobExists()
                     throws org.apache.maven.plugin.MojoExecutionException
Method to check if a job already exists.

Parameters:
hudsonURL - The Base Hudson URL
Returns:
true if the job already exists in Hudson
Throws:
org.apache.maven.plugin.MojoExecutionException

postPayload

protected void postPayload(java.net.URL postURL,
                           java.lang.String payload)
                    throws org.apache.maven.plugin.MojoExecutionException
Post the XML payload to Hudson.

Parameters:
postURL - The URL to post to
payload - The XML payload
Throws:
org.apache.maven.plugin.MojoExecutionException


Copyright © 1981-2010 MTV Networks. All Rights Reserved.