|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.maven.plugin.AbstractMojo
org.jvnet.hudson.maven.plugins.hudson.AbstractHudsonMojo
public abstract class AbstractHudsonMojo
Base class for working with Hudson.
| Nested Class Summary | |
|---|---|
protected static interface |
AbstractHudsonMojo.JobClosure
Callback interface for the forEachJob method. |
protected static class |
AbstractHudsonMojo.PluginType
Enum that defines the update types we can add plugins configurations for. |
| Field Summary | |
|---|---|
protected org.apache.commons.httpclient.HttpClient |
httpClient
HttpClient instance for methods to use. |
protected java.net.URL |
hudsonURL
Hudson URL. |
protected org.apache.maven.project.MavenProject |
project
The Maven Project Object. |
protected org.apache.maven.settings.Settings |
settings
Maven settings. |
| Fields inherited from interface org.apache.maven.plugin.Mojo |
|---|
ROLE |
| Constructor Summary | |
|---|---|
AbstractHudsonMojo()
|
|
| Method Summary | |
|---|---|
protected void |
configurePlugin(org.jdom.Document jobDoc,
AbstractHudsonMojo.PluginType pluginType,
org.jdom.Element element)
Configure a Hudson plugin by adding or replacing its configuration in the configuration document. |
protected void |
createHudsonURL()
Create the base URL for Hudson. |
protected java.net.URL |
createJobBuildURL(java.lang.String jobName)
Create the URL for building a job from Hudson. |
protected java.net.URL |
createJobConfigURL(java.lang.String jobName)
Create the URL for getting a job config in Hudson. |
protected java.net.URL |
createJobListURL()
Create the URL for getting a job list from Hudson. |
protected void |
createOrChange(org.jdom.Element element,
java.lang.String name,
int value)
If a child element exists, change it's value. |
protected void |
createOrChange(org.jdom.Element element,
java.lang.String name,
java.lang.String value)
If a child element exists, change it's value. |
protected void |
doPost(java.net.URL url,
int expectedStatus)
Make an HTTP Post to the URL, erroring out if the returned status doesn't make an expectation. |
protected void |
doPost(java.net.URL url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity,
int expectedStatus)
Make an HTTP Post to the URL, erroring out if the returned status doesn't make an expectation. |
protected org.apache.maven.settings.Server |
findServer()
Search the Maven Settings object for a Server object that matches the URL provided. |
protected void |
forEachJob(AbstractHudsonMojo.JobClosure closure)
Perform some task for each job in the CI server. |
protected org.jdom.Document |
getDocumentFromHudson(java.net.URL url)
|
protected java.util.List<java.lang.String> |
getJobList()
Fetch the job list from Hudson. |
protected org.jdom.Document |
loadJobConfig(java.lang.String name)
|
protected void |
rebuildJob(java.lang.String job)
Request a rebuild of the job. |
protected void |
saveJobConfig(java.lang.String name,
org.jdom.Document jobDoc)
Save the job's configuration. |
protected void |
setupClient()
Configure the HttpClient instance with any necessary authentication parameters. |
| 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 |
|---|
execute |
| Field Detail |
|---|
protected final org.apache.commons.httpclient.HttpClient httpClient
protected java.net.URL hudsonURL
protected org.apache.maven.project.MavenProject project
protected org.apache.maven.settings.Settings settings
| Constructor Detail |
|---|
public AbstractHudsonMojo()
| Method Detail |
|---|
protected void configurePlugin(org.jdom.Document jobDoc,
AbstractHudsonMojo.PluginType pluginType,
org.jdom.Element element)
jobDoc - the job DocumentpluginType - the type of Plugin (publisher, trigger, etc.)element - the new plugin element
protected void createHudsonURL()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException - if there's no hudson url
java.net.MalformedURLException - if the hudson url is badly formed
protected java.net.URL createJobBuildURL(java.lang.String jobName)
throws org.apache.maven.plugin.MojoExecutionException
jobName - The name of the job
org.apache.maven.plugin.MojoExecutionException
protected java.net.URL createJobConfigURL(java.lang.String jobName)
throws org.apache.maven.plugin.MojoExecutionException
jobName - The name of the job
org.apache.maven.plugin.MojoExecutionException - if something goes wrong
protected java.net.URL createJobListURL()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException - if something goes wrong
protected void createOrChange(org.jdom.Element element,
java.lang.String name,
int value)
element - the parent Elementname - the child element namevalue - the child element's new text value
protected void createOrChange(org.jdom.Element element,
java.lang.String name,
java.lang.String value)
element - the parent Elementname - the child element namevalue - the child element's new text value
protected void doPost(java.net.URL url,
int expectedStatus)
throws java.io.IOException,
org.apache.maven.plugin.MojoExecutionException
url - the URL to POST to.expectedStatus - expected HTTP status code
java.io.IOException - if something goes wrong
org.apache.maven.plugin.MojoExecutionException - if the status doesn't match
protected void doPost(java.net.URL url,
org.apache.commons.httpclient.methods.RequestEntity requestEntity,
int expectedStatus)
throws java.io.IOException,
org.apache.maven.plugin.MojoExecutionException
url - the URL to POST to.requestEntity - an entity to include with the POST.expectedStatus - expected HTTP status code.
java.io.IOException - if something goes wrong
org.apache.maven.plugin.MojoExecutionException - if the status doesn't matchprotected org.apache.maven.settings.Server findServer()
protected void forEachJob(AbstractHudsonMojo.JobClosure closure)
throws org.apache.maven.plugin.MojoExecutionException
closure - the action to take per job
org.apache.maven.plugin.MojoExecutionException - if something goes wrong
protected org.jdom.Document getDocumentFromHudson(java.net.URL url)
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected java.util.List<java.lang.String> getJobList()
throws org.apache.maven.plugin.MojoExecutionException,
java.io.IOException
org.apache.maven.plugin.MojoExecutionException
java.io.IOException
protected org.jdom.Document loadJobConfig(java.lang.String name)
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void rebuildJob(java.lang.String job)
throws org.apache.maven.plugin.MojoExecutionException
job - the job name
org.apache.maven.plugin.MojoExecutionException
protected void saveJobConfig(java.lang.String name,
org.jdom.Document jobDoc)
throws org.apache.maven.plugin.MojoExecutionException
name - the job namejobDoc - the job config document
org.apache.maven.plugin.MojoExecutionExceptionprotected void setupClient()
client - hudsonURL -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||