org.jenkinsci.plugins.rundeck
Class RundeckInstance

java.lang.Object
  extended by org.jenkinsci.plugins.rundeck.RundeckInstance
All Implemented Interfaces:
java.io.Serializable

public class RundeckInstance
extends java.lang.Object
implements java.io.Serializable

Represents a RunDeck instance, and allows to communicate with it in order to schedule jobs. Uses RunDeck 1.1 HTTP API to schedule jobs.

Author:
Vincent Behar
See Also:
Serialized Form

Nested Class Summary
static class RundeckInstance.RundeckJobSchedulingException
          Exception used when a job scheduling failed on a RunDeck instance
static class RundeckInstance.RundeckLoginException
          Exception used when the login failed on a RunDeck instance
 
Constructor Summary
RundeckInstance(java.lang.String url, java.lang.String login, java.lang.String password)
          Build a new RunDeck instance
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getLogin()
           
 java.lang.String getPassword()
           
 java.lang.String getUrl()
           
 int hashCode()
           
 boolean isAlive()
           
 boolean isConfigurationValid()
           
 boolean isLoginValid()
           
 java.lang.String parseExecutionUrl(java.io.InputStream response)
          Parse the xml response from RunDeck, and if it is successful, return the execution url.
 java.lang.String scheduleJobExecution(java.lang.String groupPath, java.lang.String jobName, java.lang.String... options)
          Schedule a job execution, identified by the given groupPath and jobName.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RundeckInstance

public RundeckInstance(java.lang.String url,
                       java.lang.String login,
                       java.lang.String password)
Build a new RunDeck instance

Parameters:
url - of the RunDeck server (http://localhost:4440)
login - to use
password - associated with the login
Method Detail

isConfigurationValid

public boolean isConfigurationValid()
Returns:
true if the configuration is valid, false otherwise

isAlive

public boolean isAlive()
Returns:
true if this RunDeck instance is alive, false otherwise

isLoginValid

public boolean isLoginValid()
Returns:
true if the credentials (login/password) are valid, false otherwise

scheduleJobExecution

public java.lang.String scheduleJobExecution(java.lang.String groupPath,
                                             java.lang.String jobName,
                                             java.lang.String... options)
                                      throws RundeckInstance.RundeckLoginException,
                                             RundeckInstance.RundeckJobSchedulingException
Schedule a job execution, identified by the given groupPath and jobName.

Parameters:
groupPath - of the job (eg "main-group/sub-group")
jobName -
options - varargs of options for the execution, in the form "key=value" (optional)
Returns:
the url of the RunDeck execution page
Throws:
RundeckInstance.RundeckLoginException - if the login failed
RundeckInstance.RundeckJobSchedulingException - if the scheduling failed

parseExecutionUrl

public java.lang.String parseExecutionUrl(java.io.InputStream response)
                                   throws RundeckInstance.RundeckJobSchedulingException
Parse the xml response from RunDeck, and if it is successful, return the execution url.

Parameters:
response -
Returns:
the RunDeck job execution relative url
Throws:
RundeckInstance.RundeckJobSchedulingException - if the response in an error

getUrl

public java.lang.String getUrl()

getLogin

public java.lang.String getLogin()

getPassword

public java.lang.String getPassword()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2004-2011. All Rights Reserved.