Main entry point to talk to a RunDeck instance.
+ You have 2 methods for authentication : login-based or token-based. If you want to use the first, you need to provide
+ both a "login" and a "password". Otherwise, just provide a "token" (also called "auth-token"). See the RunDeck
+ documentation for generating such a token.
+
Usage :
+ // using login-based authentication :
RundeckClient rundeck = new RundeckClient("http://localhost:4440", "admin", "admin");
+ // or for a token-based authentication :
+ RundeckClient rundeck = new RundeckClient("http://localhost:4440", "PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD");
List<RundeckProject> projects = rundeck.getProjects();
@@ -168,12 +175,21 @@ Main entry point to talk to a RunDeck instance. Constructor Summary
+
RundeckClient(String url,
+ String token)
+
+
+ Instantiate a new RundeckClient for the RunDeck instance at the given url, using token-based
+ authentication.
List the jobs that belongs to the given project, and matches the given criteria (jobFilter, groupPath and jobIds)
@@ -1432,7 +1483,8 @@ public List of RundeckJob : might be empty, but won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Export the definitions of all jobs that belongs to the given project
@@ -1579,7 +1640,8 @@ public InputStream instance, not linked to any network resources - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Export the definitions of all jobs that belongs to the given project
@@ -1606,7 +1669,8 @@ public InputStream instance, not linked to any network resources - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
@@ -1636,7 +1701,8 @@ public InputStream instance, not linked to any network resources - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
@@ -1667,7 +1734,8 @@ public InputStream instance, not linked to any network resources - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Export the definition of a single job, identified by the given ID
@@ -1751,7 +1824,8 @@ public InputStream instance, not linked to any network resources - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Export the definition of a single job, identified by the given ID
@@ -1778,7 +1853,8 @@ public InputStream instance, not linked to any network resources - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Find a job, identified by its project, group and name. Note that the groupPath is optional, as a job does not
@@ -2028,7 +2121,8 @@ public RundeckJob instance - null if not found
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Delete a single job, identified by the given ID
@@ -2077,7 +2174,8 @@ public RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
@@ -2102,7 +2201,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
@@ -2129,7 +2230,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
@@ -2158,7 +2261,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
@@ -2185,7 +2290,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
@@ -2213,7 +2320,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
@@ -2243,7 +2352,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
@@ -2273,7 +2384,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
@@ -2305,7 +2418,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent job with this ID)
-
Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
@@ -2332,7 +2447,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
@@ -2360,7 +2477,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
@@ -2390,7 +2509,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
@@ -2418,7 +2539,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
@@ -2449,7 +2572,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
@@ -2478,7 +2603,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
@@ -2510,7 +2637,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
@@ -2541,7 +2670,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
@@ -2575,7 +2706,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
@@ -2724,7 +2865,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
@@ -2752,7 +2895,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
@@ -2781,7 +2926,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
@@ -2812,7 +2959,8 @@ public RundeckExecution instance for the newly created (and running) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
@@ -3342,7 +3521,8 @@ public RundeckExecution instance for the (finished/aborted) execution - won't be null
Throws:
RundeckApiException - in case of error when calling the API (non-existent project with this name)
-
RundeckClient.exportJobs(FileType format,
+ String project,
+ String jobFilter,
+ String groupPath,
+ String... jobIds)
+
+
+ Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
+ groupPath and jobIds)
RundeckClient.exportJobs(String format,
+ String project,
+ String jobFilter,
+ String groupPath,
+ String... jobIds)
+
+
+ Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
+ groupPath and jobIds)
+
+
+
+ void
+
RundeckClient.exportJobsToFile(String filename,
+ FileType format,
+ String project)
+
+
+ Export the definitions of all jobs that belongs to the given project
+
+
+
+ void
+
RundeckClient.exportJobsToFile(String filename,
+ FileType format,
+ String project,
+ String jobFilter,
+ String groupPath,
+ String... jobIds)
+
+
+ Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
+ groupPath and jobIds)
+
+
+
+ void
+
RundeckClient.exportJobsToFile(String filename,
+ String format,
+ String project)
+
+
+ Export the definitions of all jobs that belongs to the given project
+
+
+
+ void
+
RundeckClient.exportJobsToFile(String filename,
+ String format,
+ String project,
+ String jobFilter,
+ String groupPath,
+ String... jobIds)
+
+
+ Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
+ groupPath and jobIds)
+
+
+
+ void
+
RundeckClient.exportJobToFile(String filename,
+ FileType format,
+ String jobId)
+
+
+ Export the definition of a single job (identified by the given ID)
+
+
+
+ void
+
RundeckClient.exportJobToFile(String filename,
+ String format,
+ String jobId)
+
+
+ Export the definition of a single job (identified by the given ID)
RundeckClient.getHistory(String project,
+ String jobId,
+ String reportId,
+ String user,
+ Long max,
+ Long offset)
+
+
+ Get the (events) history for the given project
RundeckClient.getJobs(String project,
+ String jobFilter,
+ String groupPath,
+ String... jobIds)
+
+
+ List the jobs that belongs to the given project, and matches the given criteria (jobFilter, groupPath and jobIds)
RundeckClient.importJobs(InputStream stream,
+ String fileType,
+ String importBehavior)
+
+
+ Import the definitions of jobs, from the given input stream, using the given behavior
RundeckClient.importJobs(String filename,
+ FileType fileType,
+ RundeckJobsImportMethod importBehavior)
+
+
+ Import the definitions of jobs, from the given file, using the given behavior
RundeckClient.importJobs(String filename,
+ String fileType,
+ String importBehavior)
+
+
+ Import the definitions of jobs, from the given file, using the given behavior
RundeckClient.runAdhocCommand(String project,
+ String command)
+
+
+ Run an ad-hoc command, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocCommand(String project,
+ String command,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc command, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocCommand(String project,
+ String command,
+ Properties nodeFilters)
+
+
+ Run an ad-hoc command, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocCommand(String project,
+ String command,
+ Properties nodeFilters,
+ Integer nodeThreadcount,
+ Boolean nodeKeepgoing)
+
+
+ Run an ad-hoc command, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocCommand(String project,
+ String command,
+ Properties nodeFilters,
+ Integer nodeThreadcount,
+ Boolean nodeKeepgoing,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc command, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocCommand(String project,
+ String command,
+ Properties nodeFilters,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc command, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ InputStream script)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ InputStream script,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ InputStream script,
+ Properties options)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ InputStream script,
+ Properties options,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ InputStream script,
+ Properties options,
+ Properties nodeFilters)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ InputStream script,
+ Properties options,
+ Properties nodeFilters,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ String scriptFilename)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ String scriptFilename,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ String scriptFilename,
+ Properties options)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ String scriptFilename,
+ Properties options,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ String scriptFilename,
+ Properties options,
+ Properties nodeFilters)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ String scriptFilename,
+ Properties options,
+ Properties nodeFilters,
+ Integer nodeThreadcount,
+ Boolean nodeKeepgoing)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runAdhocScript(String project,
+ String scriptFilename,
+ Properties options,
+ Properties nodeFilters,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run an ad-hoc script, and wait until its execution is finished (or aborted) to return.
RundeckClient.runJob(String jobId)
+
+
+ Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
RundeckClient.runJob(String jobId,
+ Properties options)
+
+
+ Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
RundeckClient.runJob(String jobId,
+ Properties options,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
RundeckClient.runJob(String jobId,
+ Properties options,
+ Properties nodeFilters)
+
+
+ Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
RundeckClient.runJob(String jobId,
+ Properties options,
+ Properties nodeFilters,
+ long poolingInterval,
+ TimeUnit poolingUnit)
+
+
+ Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
RundeckClient.triggerAdhocCommand(String project,
+ String command)
+
+
+ Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocCommand(String project,
+ String command,
+ Properties nodeFilters)
+
+
+ Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocCommand(String project,
+ String command,
+ Properties nodeFilters,
+ Integer nodeThreadcount,
+ Boolean nodeKeepgoing)
+
+
+ Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocScript(String project,
+ InputStream script)
+
+
+ Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocScript(String project,
+ InputStream script,
+ Properties options)
+
+
+ Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocScript(String project,
+ InputStream script,
+ Properties options,
+ Properties nodeFilters)
+
+
+ Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocScript(String project,
+ InputStream script,
+ Properties options,
+ Properties nodeFilters,
+ Integer nodeThreadcount,
+ Boolean nodeKeepgoing)
+
+
+ Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocScript(String project,
+ String scriptFilename)
+
+
+ Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocScript(String project,
+ String scriptFilename,
+ Properties options)
+
+
+ Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocScript(String project,
+ String scriptFilename,
+ Properties options,
+ Properties nodeFilters)
+
+
+ Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution).
RundeckClient.triggerAdhocScript(String project,
+ String scriptFilename,
+ Properties options,
+ Properties nodeFilters,
+ Integer nodeThreadcount,
+ Boolean nodeKeepgoing)
+
+
+ Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution).
RundeckClient.triggerJob(String jobId)
+
+
+ Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
+ end of the job execution)
RundeckClient.triggerJob(String jobId,
+ Properties options)
+
+
+ Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
+ end of the job execution)
RundeckClient.triggerJob(String jobId,
+ Properties options,
+ Properties nodeFilters)
+
+
+ Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
+ end of the job execution)
Description: The codec package contains simple encoder and decoders for
various formats such as Base64 and Hexadecimal. In addition to these
widely used encoders and decoders, the codec package also maintains a
- collection of phonetic encoding utilities.
Description: Commons Lang, a package of Java utility classes for the
classes that are in java.lang's hierarchy, or are considered to be so
- standard as to justify existence in java.lang.
Project License: No project license is defined for this project.
xml-apis:xml-apis:jar:1.0.b2 (compile)
XML Commons External Components XML APIs
Description: xml-commons provides an Apache-hosted set of DOM, SAX, and
JAXP interfaces for use in other xml-based projects. Our hope is that we
can standardize on both a common version and packaging scheme for these
critical XML standards interfaces to make the lives of both our developers
and users easier. The External Components portion of xml-commons contains
interfaces that are defined by external standards organizations. For DOM,
that's the W3C; for SAX it's David Megginson and sax.sourceforge.net; for
- JAXP it's Sun.
Description: There is currently no description associated with this project.
Project License: No project license is defined for this project.
xerces:xercesImpl:jar:2.6.2 (compile)
Unnamed - xerces:xercesImpl:jar:2.6.2
Description: There is currently no description associated with this project.
Project License: No project license is defined for this project.
xalan:xalan:jar:2.6.0 (compile)
Unnamed - xalan:xalan:jar:2.6.0
Description: There is currently no description associated with this project.
Project License: No project license is defined for this project.
xml-apis:xml-apis:jar:1.0.b2 (compile)
XML Commons External Components XML APIs
Description: xml-commons provides an Apache-hosted set of DOM, SAX, and
JAXP interfaces for use in other xml-based projects. Our hope is that we
can standardize on both a common version and packaging scheme for these
critical XML standards interfaces to make the lives of both our developers
and users easier. The External Components portion of xml-commons contains
interfaces that are defined by external standards organizations. For DOM,
that's the W3C; for SAX it's David Megginson and sax.sourceforge.net; for
- JAXP it's Sun.
The Apache Software License, Version 2.0: Commons Codec, Commons IO, Commons Lang, Commons Logging, RunDeck API - Java Client, XML Commons External Components XML APIs
The Apache Software License, Version 2.0: Commons Codec, Commons IO, Commons Lang, Commons Logging, RunDeck API - Java Client, XML Commons External Components XML APIs
diff --git a/testapidocs/allclasses-frame.html b/testapidocs/allclasses-frame.html
index 9303b0a..df28861 100644
--- a/testapidocs/allclasses-frame.html
+++ b/testapidocs/allclasses-frame.html
@@ -2,10 +2,10 @@
-
+
-All Classes (RunDeck API - Java Client 1.2 Test API)
+All Classes (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
diff --git a/testapidocs/allclasses-noframe.html b/testapidocs/allclasses-noframe.html
index cd3b051..048d005 100644
--- a/testapidocs/allclasses-noframe.html
+++ b/testapidocs/allclasses-noframe.html
@@ -2,10 +2,10 @@
-
+
-All Classes (RunDeck API - Java Client 1.2 Test API)
+All Classes (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
diff --git a/testapidocs/constant-values.html b/testapidocs/constant-values.html
index 97f8912..eac8bf7 100644
--- a/testapidocs/constant-values.html
+++ b/testapidocs/constant-values.html
@@ -2,10 +2,10 @@
-
+
-Constant Field Values (RunDeck API - Java Client 1.2 Test API)
+Constant Field Values (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Constant Field Values (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Constant Field Values (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Constant Field Values (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/deprecated-list.html b/testapidocs/deprecated-list.html
index f6c9ce8..8622fec 100644
--- a/testapidocs/deprecated-list.html
+++ b/testapidocs/deprecated-list.html
@@ -2,10 +2,10 @@
-
+
-Deprecated List (RunDeck API - Java Client 1.2 Test API)
+Deprecated List (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Deprecated List (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Deprecated List (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Deprecated List (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/help-doc.html b/testapidocs/help-doc.html
index dc9ba39..0e382cd 100644
--- a/testapidocs/help-doc.html
+++ b/testapidocs/help-doc.html
@@ -2,10 +2,10 @@
-
+
-API Help (RunDeck API - Java Client 1.2 Test API)
+API Help (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ API Help (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="API Help (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="API Help (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/index-all.html b/testapidocs/index-all.html
index 61587b9..702c90c 100644
--- a/testapidocs/index-all.html
+++ b/testapidocs/index-all.html
@@ -2,10 +2,10 @@
-
+
-Index (RunDeck API - Java Client 1.2 Test API)
+Index (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Index (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Index (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Index (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/index.html b/testapidocs/index.html
index 520fd35..d34bd2c 100644
--- a/testapidocs/index.html
+++ b/testapidocs/index.html
@@ -2,10 +2,10 @@
-
+
-RunDeck API - Java Client 1.2 Test API
+RunDeck API - Java Client 2.0-SNAPSHOT Test API
diff --git a/testapidocs/org/rundeck/api/parser/EventParserTest.html b/testapidocs/org/rundeck/api/parser/EventParserTest.html
index 3d99ade..87071a1 100644
--- a/testapidocs/org/rundeck/api/parser/EventParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/EventParserTest.html
@@ -2,10 +2,10 @@
-
+
-EventParserTest (RunDeck API - Java Client 1.2 Test API)
+EventParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ EventParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="EventParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="EventParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/ExecutionParserTest.html b/testapidocs/org/rundeck/api/parser/ExecutionParserTest.html
index 7713cb1..3e639b9 100644
--- a/testapidocs/org/rundeck/api/parser/ExecutionParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/ExecutionParserTest.html
@@ -2,10 +2,10 @@
-
+
-ExecutionParserTest (RunDeck API - Java Client 1.2 Test API)
+ExecutionParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ ExecutionParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="ExecutionParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="ExecutionParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/HistoryParserTest.html b/testapidocs/org/rundeck/api/parser/HistoryParserTest.html
index f89c6a8..f92249a 100644
--- a/testapidocs/org/rundeck/api/parser/HistoryParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/HistoryParserTest.html
@@ -2,10 +2,10 @@
-
+
-HistoryParserTest (RunDeck API - Java Client 1.2 Test API)
+HistoryParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ HistoryParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="HistoryParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="HistoryParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/JobParserTest.html b/testapidocs/org/rundeck/api/parser/JobParserTest.html
index 48cd312..42f8e88 100644
--- a/testapidocs/org/rundeck/api/parser/JobParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/JobParserTest.html
@@ -2,10 +2,10 @@
-
+
-JobParserTest (RunDeck API - Java Client 1.2 Test API)
+JobParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ JobParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="JobParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="JobParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/JobsImportResultParserTest.html b/testapidocs/org/rundeck/api/parser/JobsImportResultParserTest.html
index b58aa19..ff84d0e 100644
--- a/testapidocs/org/rundeck/api/parser/JobsImportResultParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/JobsImportResultParserTest.html
@@ -2,10 +2,10 @@
-
+
-JobsImportResultParserTest (RunDeck API - Java Client 1.2 Test API)
+JobsImportResultParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ JobsImportResultParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="JobsImportResultParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="JobsImportResultParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/ListParserTest.html b/testapidocs/org/rundeck/api/parser/ListParserTest.html
index 1ec1dd8..670d565 100644
--- a/testapidocs/org/rundeck/api/parser/ListParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/ListParserTest.html
@@ -2,10 +2,10 @@
-
+
-ListParserTest (RunDeck API - Java Client 1.2 Test API)
+ListParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ ListParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="ListParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="ListParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/NodeParserTest.html b/testapidocs/org/rundeck/api/parser/NodeParserTest.html
index 6ae3e72..cb5afb4 100644
--- a/testapidocs/org/rundeck/api/parser/NodeParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/NodeParserTest.html
@@ -2,10 +2,10 @@
-
+
-NodeParserTest (RunDeck API - Java Client 1.2 Test API)
+NodeParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ NodeParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="NodeParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="NodeParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/ParserHelperTest.html b/testapidocs/org/rundeck/api/parser/ParserHelperTest.html
index 5f33e52..7aba5b7 100644
--- a/testapidocs/org/rundeck/api/parser/ParserHelperTest.html
+++ b/testapidocs/org/rundeck/api/parser/ParserHelperTest.html
@@ -2,10 +2,10 @@
-
+
-ParserHelperTest (RunDeck API - Java Client 1.2 Test API)
+ParserHelperTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ ParserHelperTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="ParserHelperTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="ParserHelperTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/ProjectParserTest.html b/testapidocs/org/rundeck/api/parser/ProjectParserTest.html
index c20eb5a..8c9c6e5 100644
--- a/testapidocs/org/rundeck/api/parser/ProjectParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/ProjectParserTest.html
@@ -2,10 +2,10 @@
-
+
-ProjectParserTest (RunDeck API - Java Client 1.2 Test API)
+ProjectParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ ProjectParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="ProjectParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="ProjectParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/StringParserTest.html b/testapidocs/org/rundeck/api/parser/StringParserTest.html
index 6c7dc23..a67debe 100644
--- a/testapidocs/org/rundeck/api/parser/StringParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/StringParserTest.html
@@ -2,10 +2,10 @@
-
+
-StringParserTest (RunDeck API - Java Client 1.2 Test API)
+StringParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ StringParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="StringParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="StringParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/SystemInfoParserTest.html b/testapidocs/org/rundeck/api/parser/SystemInfoParserTest.html
index e8418cc..36578c9 100644
--- a/testapidocs/org/rundeck/api/parser/SystemInfoParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/SystemInfoParserTest.html
@@ -2,10 +2,10 @@
-
+
-SystemInfoParserTest (RunDeck API - Java Client 1.2 Test API)
+SystemInfoParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ SystemInfoParserTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="SystemInfoParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="SystemInfoParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/AbortParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/AbortParserTest.html
index 07c85ed..54f719a 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/AbortParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/AbortParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.AbortParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.AbortParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.AbortParserTest (RunDeck API - Java Client
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.AbortParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.AbortParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/EventParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/EventParserTest.html
index 093835f..e42dce5 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/EventParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/EventParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.EventParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.EventParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.EventParserTest (RunDeck API - Java Client
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.EventParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.EventParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/ExecutionParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/ExecutionParserTest.html
index 96d57bd..12536e9 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/ExecutionParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/ExecutionParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.ExecutionParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.ExecutionParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.ExecutionParserTest (RunDeck API - Java Cli
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.ExecutionParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.ExecutionParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/HistoryParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/HistoryParserTest.html
index f7d084f..3f4909a 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/HistoryParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/HistoryParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.HistoryParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.HistoryParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.HistoryParserTest (RunDeck API - Java Clien
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.HistoryParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.HistoryParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/JobParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/JobParserTest.html
index 90570bf..fb306a1 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/JobParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/JobParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.JobParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.JobParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.JobParserTest (RunDeck API - Java Client 1.
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.JobParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.JobParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/JobsImportResultParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/JobsImportResultParserTest.html
index 41b19d0..ffbb65e 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/JobsImportResultParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/JobsImportResultParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.JobsImportResultParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.JobsImportResultParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.JobsImportResultParserTest (RunDeck API - J
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.JobsImportResultParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.JobsImportResultParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/ListParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/ListParserTest.html
index d429172..b8c296c 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/ListParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/ListParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.ListParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.ListParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.ListParserTest (RunDeck API - Java Client 1
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.ListParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.ListParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/NodeParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/NodeParserTest.html
index 053d6ad..e04cc7f 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/NodeParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/NodeParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.NodeParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.NodeParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.NodeParserTest (RunDeck API - Java Client 1
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.NodeParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.NodeParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/ParserHelperTest.html b/testapidocs/org/rundeck/api/parser/class-use/ParserHelperTest.html
index a39b9e9..e65d811 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/ParserHelperTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/ParserHelperTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.ParserHelperTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.ParserHelperTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.ParserHelperTest (RunDeck API - Java Client
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.ParserHelperTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.ParserHelperTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/ProjectParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/ProjectParserTest.html
index c8a6757..f7c2c2a 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/ProjectParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/ProjectParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.ProjectParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.ProjectParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.ProjectParserTest (RunDeck API - Java Clien
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.ProjectParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.ProjectParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/StringParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/StringParserTest.html
index 7869766..3e164d0 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/StringParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/StringParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.StringParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.StringParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.StringParserTest (RunDeck API - Java Client
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.StringParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.StringParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/class-use/SystemInfoParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/SystemInfoParserTest.html
index bcbc2dc..f905a9a 100644
--- a/testapidocs/org/rundeck/api/parser/class-use/SystemInfoParserTest.html
+++ b/testapidocs/org/rundeck/api/parser/class-use/SystemInfoParserTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.parser.SystemInfoParserTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.parser.SystemInfoParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.parser.SystemInfoParserTest (RunDeck API - Java Cl
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.parser.SystemInfoParserTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.parser.SystemInfoParserTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/package-frame.html b/testapidocs/org/rundeck/api/parser/package-frame.html
index 304db20..3bafa6d 100644
--- a/testapidocs/org/rundeck/api/parser/package-frame.html
+++ b/testapidocs/org/rundeck/api/parser/package-frame.html
@@ -2,10 +2,10 @@
-
+
-org.rundeck.api.parser (RunDeck API - Java Client 1.2 Test API)
+org.rundeck.api.parser (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
diff --git a/testapidocs/org/rundeck/api/parser/package-summary.html b/testapidocs/org/rundeck/api/parser/package-summary.html
index 2a87ffb..fe4b388 100644
--- a/testapidocs/org/rundeck/api/parser/package-summary.html
+++ b/testapidocs/org/rundeck/api/parser/package-summary.html
@@ -2,10 +2,10 @@
-
+
-org.rundeck.api.parser (RunDeck API - Java Client 1.2 Test API)
+org.rundeck.api.parser (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ org.rundeck.api.parser (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="org.rundeck.api.parser (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="org.rundeck.api.parser (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/package-tree.html b/testapidocs/org/rundeck/api/parser/package-tree.html
index 554ed35..3c603d1 100644
--- a/testapidocs/org/rundeck/api/parser/package-tree.html
+++ b/testapidocs/org/rundeck/api/parser/package-tree.html
@@ -2,10 +2,10 @@
-
+
-org.rundeck.api.parser Class Hierarchy (RunDeck API - Java Client 1.2 Test API)
+org.rundeck.api.parser Class Hierarchy (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ org.rundeck.api.parser Class Hierarchy (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="org.rundeck.api.parser Class Hierarchy (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="org.rundeck.api.parser Class Hierarchy (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/parser/package-use.html b/testapidocs/org/rundeck/api/parser/package-use.html
index 494089e..109b94d 100644
--- a/testapidocs/org/rundeck/api/parser/package-use.html
+++ b/testapidocs/org/rundeck/api/parser/package-use.html
@@ -2,10 +2,10 @@
-
+
-Uses of Package org.rundeck.api.parser (RunDeck API - Java Client 1.2 Test API)
+Uses of Package org.rundeck.api.parser (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Package org.rundeck.api.parser (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Package org.rundeck.api.parser (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Package org.rundeck.api.parser (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/util/ParametersUtilTest.html b/testapidocs/org/rundeck/api/util/ParametersUtilTest.html
index 04328b5..e9f76a1 100644
--- a/testapidocs/org/rundeck/api/util/ParametersUtilTest.html
+++ b/testapidocs/org/rundeck/api/util/ParametersUtilTest.html
@@ -2,10 +2,10 @@
-
+
-ParametersUtilTest (RunDeck API - Java Client 1.2 Test API)
+ParametersUtilTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ ParametersUtilTest (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="ParametersUtilTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="ParametersUtilTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/util/class-use/ParametersUtilTest.html b/testapidocs/org/rundeck/api/util/class-use/ParametersUtilTest.html
index 3358535..ec7d24a 100644
--- a/testapidocs/org/rundeck/api/util/class-use/ParametersUtilTest.html
+++ b/testapidocs/org/rundeck/api/util/class-use/ParametersUtilTest.html
@@ -2,10 +2,10 @@
-
+
-Uses of Class org.rundeck.api.util.ParametersUtilTest (RunDeck API - Java Client 1.2 Test API)
+Uses of Class org.rundeck.api.util.ParametersUtilTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Class org.rundeck.api.util.ParametersUtilTest (RunDeck API - Java Client
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Class org.rundeck.api.util.ParametersUtilTest (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Class org.rundeck.api.util.ParametersUtilTest (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/util/package-frame.html b/testapidocs/org/rundeck/api/util/package-frame.html
index 2755c8c..445cd4e 100644
--- a/testapidocs/org/rundeck/api/util/package-frame.html
+++ b/testapidocs/org/rundeck/api/util/package-frame.html
@@ -2,10 +2,10 @@
-
+
-org.rundeck.api.util (RunDeck API - Java Client 1.2 Test API)
+org.rundeck.api.util (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
diff --git a/testapidocs/org/rundeck/api/util/package-summary.html b/testapidocs/org/rundeck/api/util/package-summary.html
index a96bddd..0650e32 100644
--- a/testapidocs/org/rundeck/api/util/package-summary.html
+++ b/testapidocs/org/rundeck/api/util/package-summary.html
@@ -2,10 +2,10 @@
-
+
-org.rundeck.api.util (RunDeck API - Java Client 1.2 Test API)
+org.rundeck.api.util (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ org.rundeck.api.util (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="org.rundeck.api.util (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="org.rundeck.api.util (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/util/package-tree.html b/testapidocs/org/rundeck/api/util/package-tree.html
index 3bab216..a1fce1f 100644
--- a/testapidocs/org/rundeck/api/util/package-tree.html
+++ b/testapidocs/org/rundeck/api/util/package-tree.html
@@ -2,10 +2,10 @@
-
+
-org.rundeck.api.util Class Hierarchy (RunDeck API - Java Client 1.2 Test API)
+org.rundeck.api.util Class Hierarchy (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ org.rundeck.api.util Class Hierarchy (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="org.rundeck.api.util Class Hierarchy (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="org.rundeck.api.util Class Hierarchy (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/org/rundeck/api/util/package-use.html b/testapidocs/org/rundeck/api/util/package-use.html
index 5cc35dd..351960e 100644
--- a/testapidocs/org/rundeck/api/util/package-use.html
+++ b/testapidocs/org/rundeck/api/util/package-use.html
@@ -2,10 +2,10 @@
-
+
-Uses of Package org.rundeck.api.util (RunDeck API - Java Client 1.2 Test API)
+Uses of Package org.rundeck.api.util (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Uses of Package org.rundeck.api.util (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Uses of Package org.rundeck.api.util (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Uses of Package org.rundeck.api.util (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/testapidocs/overview-frame.html b/testapidocs/overview-frame.html
index bc6407f..5fa9cff 100644
--- a/testapidocs/overview-frame.html
+++ b/testapidocs/overview-frame.html
@@ -2,10 +2,10 @@
-
+
-Overview List (RunDeck API - Java Client 1.2 Test API)
+Overview List (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
diff --git a/testapidocs/overview-summary.html b/testapidocs/overview-summary.html
index 7648518..ee54874 100644
--- a/testapidocs/overview-summary.html
+++ b/testapidocs/overview-summary.html
@@ -2,10 +2,10 @@
-
+
-Overview (RunDeck API - Java Client 1.2 Test API)
+Overview (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Overview (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Overview (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Overview (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
@@ -82,7 +82,7 @@ function windowTitle()
-RunDeck API - Java Client 1.2 Test API
+RunDeck API - Java Client 2.0-SNAPSHOT Test API
diff --git a/testapidocs/overview-tree.html b/testapidocs/overview-tree.html
index 9df766d..2284d30 100644
--- a/testapidocs/overview-tree.html
+++ b/testapidocs/overview-tree.html
@@ -2,10 +2,10 @@
-
+
-Class Hierarchy (RunDeck API - Java Client 1.2 Test API)
+Class Hierarchy (RunDeck API - Java Client 2.0-SNAPSHOT Test API)
@@ -16,7 +16,7 @@ Class Hierarchy (RunDeck API - Java Client 1.2 Test API)
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Class Hierarchy (RunDeck API - Java Client 1.2 Test API)";
+ parent.document.title="Class Hierarchy (RunDeck API - Java Client 2.0-SNAPSHOT Test API)";
}
}
diff --git a/xref-test/index.html b/xref-test/index.html
index fdd3988..0dc919f 100644
--- a/xref-test/index.html
+++ b/xref-test/index.html
@@ -3,7 +3,7 @@
- RunDeck API - Java Client 1.2 Reference
+ RunDeck API - Java Client 2.0-SNAPSHOT Reference
RundeckClient
diff --git a/xref/index.html b/xref/index.html
index fdd3988..0dc919f 100644
--- a/xref/index.html
+++ b/xref/index.html
@@ -3,7 +3,7 @@
- RunDeck API - Java Client 1.2 Reference
+ RunDeck API - Java Client 2.0-SNAPSHOT Reference
diff --git a/xref/org/rundeck/api/ApiCall.html b/xref/org/rundeck/api/ApiCall.html
index b5572e0..d32edcd 100644
--- a/xref/org/rundeck/api/ApiCall.html
+++ b/xref/org/rundeck/api/ApiCall.html
@@ -39,354 +39,372 @@
29import java.util.List;
30import java.util.Map.Entry;
31import org.apache.commons.lang.StringUtils;
-32import org.apache.http.HttpResponse;
-33import org.apache.http.NameValuePair;
-34import org.apache.http.ParseException;
-35import org.apache.http.client.HttpClient;
-36import org.apache.http.client.entity.UrlEncodedFormEntity;
-37import org.apache.http.client.methods.HttpDelete;
-38import org.apache.http.client.methods.HttpGet;
-39import org.apache.http.client.methods.HttpPost;
-40import org.apache.http.client.methods.HttpRequestBase;
-41import org.apache.http.conn.scheme.Scheme;
-42import org.apache.http.conn.ssl.SSLSocketFactory;
-43import org.apache.http.conn.ssl.TrustStrategy;
-44import org.apache.http.entity.mime.HttpMultipartMode;
-45import org.apache.http.entity.mime.MultipartEntity;
-46import org.apache.http.entity.mime.content.InputStreamBody;
-47import org.apache.http.impl.client.DefaultHttpClient;
-48import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
-49import org.apache.http.message.BasicNameValuePair;
-50import org.apache.http.protocol.HTTP;
-51import org.apache.http.util.EntityUtils;
-52import org.dom4j.Document;
-53import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
-54import org.rundeck.api.parser.ParserHelper;
-55import org.rundeck.api.parser.XmlNodeParser;
-56import org.rundeck.api.util.AssertUtil;
-57
-58/**
-59 * Class responsible for making the HTTP API calls
-60 *
-61 * @author Vincent Behar
-62 */
-63classApiCall {
-64
-65privatefinalRundeckClient client;
-66
-67/**
-68 * Build a new instance, linked to the given RunDeck client
-69 *
-70 * @param client holding the RunDeck url and the credentials
-71 * @throws IllegalArgumentException if client is null
-72 */
-73publicApiCall(RundeckClient client) throws IllegalArgumentException {
-74super();
-75this.client = client;
-76 AssertUtil.notNull(client, "The RunDeck Client must not be null !");
-77 }
-78
-79/**
-80 * Try to "ping" the RunDeck instance to see if it is alive
-81 *
-82 * @throws RundeckApiException if the ping fails
-83 */
-84publicvoid ping() throws RundeckApiException {
-85 HttpClient httpClient = instantiateHttpClient();
-86try {
-87 HttpResponse response = httpClient.execute(new HttpGet(client.getUrl()));
-88if (response.getStatusLine().getStatusCode() / 100 != 2) {
-89thrownewRundeckApiException("Invalid HTTP response '" + response.getStatusLine() + "' when pinging "
-90 + client.getUrl());
-91 }
-92 } catch (IOException e) {
-93thrownewRundeckApiException("Failed to ping RunDeck instance at " + client.getUrl(), e);
-94 } finally {
-95 httpClient.getConnectionManager().shutdown();
-96 }
-97 }
-98
-99/**
-100 * Test the credentials (login/password) on the RunDeck instance
-101 *
-102 * @throws RundeckApiLoginException if the login fails
-103 */
-104publicvoid testCredentials() throws RundeckApiLoginException {
-105 HttpClient httpClient = instantiateHttpClient();
-106try {
-107 login(httpClient);
-108 } finally {
-109 httpClient.getConnectionManager().shutdown();
-110 }
-111 }
-112
-113/**
-114 * Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the
-115 * API call. At the end, the given parser will be used to convert the response to a more useful result object.
-116 *
-117 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
-118 * @param parser used to parse the response
-119 * @return the result of the call, as formatted by the parser
-120 * @throws RundeckApiException in case of error when calling the API
-121 * @throws RundeckApiLoginException if the login fails
-122 */
-123public <T> T get(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException,
-124RundeckApiLoginException {
-125return execute(new HttpGet(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath), parser);
-126 }
-127
-128/**
-129 * Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the
-130 * API call.
-131 *
-132 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
-133 * @return a new {@link InputStream} instance, not linked with network resources
-134 * @throws RundeckApiException in case of error when calling the API
-135 * @throws RundeckApiLoginException if the login fails
-136 */
-137public InputStream get(ApiPathBuilder apiPath) throws RundeckApiException, RundeckApiLoginException {
-138 ByteArrayInputStream response = execute(new HttpGet(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath));
-139
-140// try to load the document, to throw an exception in case of error
-141 ParserHelper.loadDocument(response);
-142 response.reset();
-143
-144return response;
-145 }
-146
-147/**
-148 * Execute an HTTP POST request to the RunDeck instance, on the given path. We will login first, and then execute
-149 * the API call. At the end, the given parser will be used to convert the response to a more useful result object.
-150 *
-151 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
-152 * @param parser used to parse the response
-153 * @return the result of the call, as formatted by the parser
-154 * @throws RundeckApiException in case of error when calling the API
-155 * @throws RundeckApiLoginException if the login fails
-156 */
-157public <T> T post(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException,
-158RundeckApiLoginException {
-159 HttpPost httpPost = new HttpPost(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath);
-160
-161// POST a multi-part request, with all attachments
-162 MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
-163for (Entry<String, InputStream> attachment : apiPath.getAttachments().entrySet()) {
-164 entity.addPart(attachment.getKey(), new InputStreamBody(attachment.getValue(), attachment.getKey()));
-165 }
-166 httpPost.setEntity(entity);
-167
-168return execute(httpPost, parser);
-169 }
-170
-171/**
-172 * Execute an HTTP DELETE request to the RunDeck instance, on the given path. We will login first, and then execute
-173 * the API call. At the end, the given parser will be used to convert the response to a more useful result object.
-174 *
-175 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
-176 * @param parser used to parse the response
-177 * @return the result of the call, as formatted by the parser
-178 * @throws RundeckApiException in case of error when calling the API
-179 * @throws RundeckApiLoginException if the login fails
-180 */
-181public <T> T delete(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException,
-182RundeckApiLoginException {
-183return execute(new HttpDelete(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath), parser);
-184 }
-185
-186/**
-187 * Execute an HTTP request to the RunDeck instance. We will login first, and then execute the API call. At the end,
-188 * the given parser will be used to convert the response to a more useful result object.
-189 *
-190 * @param request to execute. see {@link HttpGet}, {@link HttpDelete}, and so on...
-191 * @param parser used to parse the response
-192 * @return the result of the call, as formatted by the parser
-193 * @throws RundeckApiException in case of error when calling the API
-194 * @throws RundeckApiLoginException if the login fails
-195 */
-196private <T> T execute(HttpRequestBase request, XmlNodeParser<T> parser) throws RundeckApiException,
-197RundeckApiLoginException {
-198// execute the request
-199 InputStream response = execute(request);
-200
-201// read and parse the response
-202 Document xmlDocument = ParserHelper.loadDocument(response);
-203return parser.parseXmlNode(xmlDocument);
-204 }
-205
-206/**
-207 * Execute an HTTP request to the RunDeck instance. We will login first, and then execute the API call.
-208 *
-209 * @param request to execute. see {@link HttpGet}, {@link HttpDelete}, and so on...
-210 * @return a new {@link InputStream} instance, not linked with network resources
-211 * @throws RundeckApiException in case of error when calling the API
-212 * @throws RundeckApiLoginException if the login fails
-213 */
-214private ByteArrayInputStream execute(HttpRequestBase request) throws RundeckApiException, RundeckApiLoginException {
-215 HttpClient httpClient = instantiateHttpClient();
-216try {
-217 login(httpClient);
-218
-219// execute the HTTP request
-220 HttpResponse response = null;
-221try {
-222 response = httpClient.execute(request);
-223 } catch (IOException e) {
-224thrownewRundeckApiException("Failed to execute an HTTP " + request.getMethod() + " on url : "
-225 + request.getURI(), e);
-226 }
-227
-228// HTTP client refuses to handle redirects (code 3xx) for DELETE, so we have to do it manually...
-229// See http://rundeck.lighthouseapp.com/projects/59277/tickets/248
-230if (response.getStatusLine().getStatusCode() / 100 == 3
-231 && HttpDelete.METHOD_NAME.equals(request.getMethod())) {
-232 String newLocation = response.getFirstHeader("Location").getValue();
-233try {
-234 EntityUtils.consume(response.getEntity());
-235 } catch (IOException e) {
-236thrownewRundeckApiException("Failed to consume entity (release connection)", e);
-237 }
-238 request = new HttpDelete(newLocation);
-239try {
-240 response = httpClient.execute(request);
-241 } catch (IOException e) {
-242thrownewRundeckApiException("Failed to execute an HTTP " + request.getMethod() + " on url : "
-243 + request.getURI(), e);
-244 }
-245 }
-246
-247// in case of error, we get a redirect to /api/error
-248// that we need to follow manually for POST and DELETE requests (as GET)
-249if (response.getStatusLine().getStatusCode() / 100 == 3) {
-250 String newLocation = response.getFirstHeader("Location").getValue();
-251try {
-252 EntityUtils.consume(response.getEntity());
-253 } catch (IOException e) {
-254thrownewRundeckApiException("Failed to consume entity (release connection)", e);
-255 }
-256 request = new HttpGet(newLocation);
-257try {
-258 response = httpClient.execute(request);
-259 } catch (IOException e) {
-260thrownewRundeckApiException("Failed to execute an HTTP GET on url : " + request.getURI(), e);
-261 }
-262 }
-263
-264// check the response code (should be 2xx, even in case of error : error message is in the XML result)
-265if (response.getStatusLine().getStatusCode() / 100 != 2) {
-266thrownewRundeckApiException("Invalid HTTP response '" + response.getStatusLine() + "' for "
-267 + request.getURI());
-268 }
-269if (response.getEntity() == null) {
-270thrownewRundeckApiException("Empty RunDeck response ! HTTP status line is : "
-271 + response.getStatusLine());
-272 }
-273
-274// return a new inputStream, so that we can close all network resources
-275try {
-276returnnew ByteArrayInputStream(EntityUtils.toByteArray(response.getEntity()));
-277 } catch (IOException e) {
-278thrownewRundeckApiException("Failed to consume entity and convert the inputStream", e);
+32import org.apache.http.HttpException;
+33import org.apache.http.HttpRequest;
+34import org.apache.http.HttpRequestInterceptor;
+35import org.apache.http.HttpResponse;
+36import org.apache.http.NameValuePair;
+37import org.apache.http.ParseException;
+38import org.apache.http.client.HttpClient;
+39import org.apache.http.client.entity.UrlEncodedFormEntity;
+40import org.apache.http.client.methods.HttpDelete;
+41import org.apache.http.client.methods.HttpGet;
+42import org.apache.http.client.methods.HttpPost;
+43import org.apache.http.client.methods.HttpRequestBase;
+44import org.apache.http.conn.scheme.Scheme;
+45import org.apache.http.conn.ssl.SSLSocketFactory;
+46import org.apache.http.conn.ssl.TrustStrategy;
+47import org.apache.http.entity.mime.HttpMultipartMode;
+48import org.apache.http.entity.mime.MultipartEntity;
+49import org.apache.http.entity.mime.content.InputStreamBody;
+50import org.apache.http.impl.client.DefaultHttpClient;
+51import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
+52import org.apache.http.message.BasicNameValuePair;
+53import org.apache.http.protocol.HTTP;
+54import org.apache.http.protocol.HttpContext;
+55import org.apache.http.util.EntityUtils;
+56import org.dom4j.Document;
+57import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
+58import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
+59import org.rundeck.api.parser.ParserHelper;
+60import org.rundeck.api.parser.XmlNodeParser;
+61import org.rundeck.api.util.AssertUtil;
+62
+63/**
+64 * Class responsible for making the HTTP API calls
+65 *
+66 * @author Vincent Behar
+67 */
+68classApiCall {
+69
+70/** RunDeck HTTP header for the auth-token (in case of token-based authentication) */
+71privatestaticfinaltransient String AUTH_TOKEN_HEADER = "X-RunDeck-Auth-Token";
+72
+73/** {@link RundeckClient} instance holding the RunDeck url and the credentials */
+74privatefinalRundeckClient client;
+75
+76/**
+77 * Build a new instance, linked to the given RunDeck client
+78 *
+79 * @param client holding the RunDeck url and the credentials
+80 * @throws IllegalArgumentException if client is null
+81 */
+82publicApiCall(RundeckClient client) throws IllegalArgumentException {
+83super();
+84this.client = client;
+85 AssertUtil.notNull(client, "The RunDeck Client must not be null !");
+86 }
+87
+88/**
+89 * Try to "ping" the RunDeck instance to see if it is alive
+90 *
+91 * @throws RundeckApiException if the ping fails
+92 */
+93publicvoid ping() throws RundeckApiException {
+94 HttpClient httpClient = instantiateHttpClient();
+95try {
+96 HttpResponse response = httpClient.execute(new HttpGet(client.getUrl()));
+97if (response.getStatusLine().getStatusCode() / 100 != 2) {
+98thrownewRundeckApiException("Invalid HTTP response '" + response.getStatusLine() + "' when pinging "
+99 + client.getUrl());
+100 }
+101 } catch (IOException e) {
+102thrownewRundeckApiException("Failed to ping RunDeck instance at " + client.getUrl(), e);
+103 } finally {
+104 httpClient.getConnectionManager().shutdown();
+105 }
+106 }
+107
+108/**
+109 * Test the credentials (login/password) on the RunDeck instance
+110 *
+111 * @throws RundeckApiLoginException if the login fails
+112 */
+113publicvoid testCredentials() throws RundeckApiLoginException {
+114 HttpClient httpClient = instantiateHttpClient();
+115try {
+116 login(httpClient);
+117 } finally {
+118 httpClient.getConnectionManager().shutdown();
+119 }
+120 }
+121
+122/**
+123 * Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the
+124 * API call. At the end, the given parser will be used to convert the response to a more useful result object.
+125 *
+126 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
+127 * @param parser used to parse the response
+128 * @return the result of the call, as formatted by the parser
+129 * @throws RundeckApiException in case of error when calling the API
+130 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+131 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+132 */
+133public <T> T get(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException,
+134 RundeckApiLoginException, RundeckApiTokenException {
+135return execute(new HttpGet(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath), parser);
+136 }
+137
+138/**
+139 * Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the
+140 * API call.
+141 *
+142 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
+143 * @return a new {@link InputStream} instance, not linked with network resources
+144 * @throws RundeckApiException in case of error when calling the API
+145 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+146 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+147 */
+148public InputStream get(ApiPathBuilder apiPath) throws RundeckApiException, RundeckApiLoginException,
+149RundeckApiTokenException {
+150 ByteArrayInputStream response = execute(new HttpGet(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath));
+151
+152// try to load the document, to throw an exception in case of error
+153 ParserHelper.loadDocument(response);
+154 response.reset();
+155
+156return response;
+157 }
+158
+159/**
+160 * Execute an HTTP POST request to the RunDeck instance, on the given path. We will login first, and then execute
+161 * the API call. At the end, the given parser will be used to convert the response to a more useful result object.
+162 *
+163 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
+164 * @param parser used to parse the response
+165 * @return the result of the call, as formatted by the parser
+166 * @throws RundeckApiException in case of error when calling the API
+167 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+168 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+169 */
+170public <T> T post(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException,
+171 RundeckApiLoginException, RundeckApiTokenException {
+172 HttpPost httpPost = new HttpPost(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath);
+173
+174// POST a multi-part request, with all attachments
+175 MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
+176for (Entry<String, InputStream> attachment : apiPath.getAttachments().entrySet()) {
+177 entity.addPart(attachment.getKey(), new InputStreamBody(attachment.getValue(), attachment.getKey()));
+178 }
+179 httpPost.setEntity(entity);
+180
+181return execute(httpPost, parser);
+182 }
+183
+184/**
+185 * Execute an HTTP DELETE request to the RunDeck instance, on the given path. We will login first, and then execute
+186 * the API call. At the end, the given parser will be used to convert the response to a more useful result object.
+187 *
+188 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
+189 * @param parser used to parse the response
+190 * @return the result of the call, as formatted by the parser
+191 * @throws RundeckApiException in case of error when calling the API
+192 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+193 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+194 */
+195public <T> T delete(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException,
+196 RundeckApiLoginException, RundeckApiTokenException {
+197return execute(new HttpDelete(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath), parser);
+198 }
+199
+200/**
+201 * Execute an HTTP request to the RunDeck instance. We will login first, and then execute the API call. At the end,
+202 * the given parser will be used to convert the response to a more useful result object.
+203 *
+204 * @param request to execute. see {@link HttpGet}, {@link HttpDelete}, and so on...
+205 * @param parser used to parse the response
+206 * @return the result of the call, as formatted by the parser
+207 * @throws RundeckApiException in case of error when calling the API
+208 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+209 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+210 */
+211private <T> T execute(HttpRequestBase request, XmlNodeParser<T> parser) throws RundeckApiException,
+212 RundeckApiLoginException, RundeckApiTokenException {
+213// execute the request
+214 InputStream response = execute(request);
+215
+216// read and parse the response
+217 Document xmlDocument = ParserHelper.loadDocument(response);
+218return parser.parseXmlNode(xmlDocument);
+219 }
+220
+221/**
+222 * Execute an HTTP request to the RunDeck instance. We will login first, and then execute the API call.
+223 *
+224 * @param request to execute. see {@link HttpGet}, {@link HttpDelete}, and so on...
+225 * @return a new {@link InputStream} instance, not linked with network resources
+226 * @throws RundeckApiException in case of error when calling the API
+227 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+228 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+229 */
+230private ByteArrayInputStream execute(HttpRequestBase request) throws RundeckApiException, RundeckApiLoginException,
+231RundeckApiTokenException {
+232 HttpClient httpClient = instantiateHttpClient();
+233try {
+234// we only need to manually login in case of login-based authentication
+235// note that in case of token-based auth, the auth (via an HTTP header) is managed by an interceptor.
+236if (client.getToken() == null) {
+237 login(httpClient);
+238 }
+239
+240// execute the HTTP request
+241 HttpResponse response = null;
+242try {
+243 response = httpClient.execute(request);
+244 } catch (IOException e) {
+245thrownewRundeckApiException("Failed to execute an HTTP " + request.getMethod() + " on url : "
+246 + request.getURI(), e);
+247 }
+248
+249// in case of error, we get a redirect to /api/error
+250// that we need to follow manually for POST and DELETE requests (as GET)
+251if (response.getStatusLine().getStatusCode() / 100 == 3) {
+252 String newLocation = response.getFirstHeader("Location").getValue();
+253try {
+254 EntityUtils.consume(response.getEntity());
+255 } catch (IOException e) {
+256thrownewRundeckApiException("Failed to consume entity (release connection)", e);
+257 }
+258 request = new HttpGet(newLocation);
+259try {
+260 response = httpClient.execute(request);
+261 } catch (IOException e) {
+262thrownewRundeckApiException("Failed to execute an HTTP GET on url : " + request.getURI(), e);
+263 }
+264 }
+265
+266// check the response code (should be 2xx, even in case of error : error message is in the XML result)
+267if (response.getStatusLine().getStatusCode() / 100 != 2) {
+268if (response.getStatusLine().getStatusCode() == 403 && client.getToken() != null) {
+269thrownewRundeckApiTokenException("Invalid Token ! Got HTTP response '" + response.getStatusLine()
+270 + "' for " + request.getURI());
+271 } else {
+272thrownewRundeckApiException("Invalid HTTP response '" + response.getStatusLine() + "' for "
+273 + request.getURI());
+274 }
+275 }
+276if (response.getEntity() == null) {
+277thrownewRundeckApiException("Empty RunDeck response ! HTTP status line is : "
+278 + response.getStatusLine());
279 }
-280 } finally {
-281 httpClient.getConnectionManager().shutdown();
-282 }
-283 }
-284
-285/**
-286 * Do the actual work of login, using the given {@link HttpClient} instance. You'll need to re-use this instance
-287 * when making API calls (such as running a job).
-288 *
-289 * @param httpClient pre-instantiated
-290 * @throws RundeckApiLoginException if the login failed
-291 */
-292privatevoid login(HttpClient httpClient) throws RundeckApiLoginException {
-293 String location = client.getUrl() + "/j_security_check";
-294
-295while (true) {
-296 HttpPost postLogin = new HttpPost(location);
-297 List<NameValuePair> params = new ArrayList<NameValuePair>();
-298 params.add(new BasicNameValuePair("j_username", client.getLogin()));
-299 params.add(new BasicNameValuePair("j_password", client.getPassword()));
-300 params.add(new BasicNameValuePair("action", "login"));
+280
+281// return a new inputStream, so that we can close all network resources
+282try {
+283returnnew ByteArrayInputStream(EntityUtils.toByteArray(response.getEntity()));
+284 } catch (IOException e) {
+285thrownewRundeckApiException("Failed to consume entity and convert the inputStream", e);
+286 }
+287 } finally {
+288 httpClient.getConnectionManager().shutdown();
+289 }
+290 }
+291
+292/**
+293 * Do the actual work of login, using the given {@link HttpClient} instance. You'll need to re-use this instance
+294 * when making API calls (such as running a job). Only use this in case of login-based authentication.
+295 *
+296 * @param httpClient pre-instantiated
+297 * @throws RundeckApiLoginException if the login failed
+298 */
+299privatevoid login(HttpClient httpClient) throws RundeckApiLoginException {
+300 String location = client.getUrl() + "/j_security_check";
301
-302 HttpResponse response = null;
-303try {
-304 postLogin.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
-305 response = httpClient.execute(postLogin);
-306 } catch (IOException e) {
-307thrownewRundeckApiLoginException("Failed to post login form on " + location, e);
-308 }
-309
-310if (response.getStatusLine().getStatusCode() / 100 == 3) {
-311// HTTP client refuses to handle redirects (code 3xx) for POST, so we have to do it manually...
-312 location = response.getFirstHeader("Location").getValue();
-313try {
-314 EntityUtils.consume(response.getEntity());
-315 } catch (IOException e) {
-316thrownewRundeckApiLoginException("Failed to consume entity (release connection)", e);
-317 }
-318continue;
-319 }
-320if (response.getStatusLine().getStatusCode() / 100 != 2) {
-321thrownewRundeckApiLoginException("Invalid HTTP response '" + response.getStatusLine() + "' for "
-322 + location);
-323 }
-324try {
-325 String content = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
-326if (StringUtils.contains(content, "j_security_check")) {
-327thrownewRundeckApiLoginException("Login failed for user " + client.getLogin());
-328 }
-329try {
-330 EntityUtils.consume(response.getEntity());
-331 } catch (IOException e) {
-332thrownewRundeckApiLoginException("Failed to consume entity (release connection)", e);
-333 }
-334 } catch (IOException io) {
-335thrownewRundeckApiLoginException("Failed to read RunDeck result", io);
-336 } catch (ParseException p) {
-337thrownewRundeckApiLoginException("Failed to parse RunDeck response", p);
-338 }
-339break;
-340 }
-341 }
-342
-343/**
-344 * Instantiate a new {@link HttpClient} instance, configured to accept all SSL certificates
-345 *
-346 * @return an {@link HttpClient} instance - won't be null
-347 */
-348private HttpClient instantiateHttpClient() {
-349 DefaultHttpClient httpClient = new DefaultHttpClient();
-350
-351// configure SSL
-352 SSLSocketFactory socketFactory = null;
-353try {
-354 socketFactory = new SSLSocketFactory(new TrustStrategy() {
-355
-356 @Override
-357publicboolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
-358returntrue;
-359 }
-360 }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
-361 } catch (KeyManagementException e) {
-362thrownew RuntimeException(e);
-363 } catch (UnrecoverableKeyException e) {
-364thrownew RuntimeException(e);
-365 } catch (NoSuchAlgorithmException e) {
-366thrownew RuntimeException(e);
-367 } catch (KeyStoreException e) {
-368thrownew RuntimeException(e);
-369 }
-370 httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("https", 443, socketFactory));
-371
-372// configure proxy (use system env : http.proxyHost / http.proxyPort)
-373 System.setProperty("java.net.useSystemProxies", "true");
-374 httpClient.setRoutePlanner(new ProxySelectorRoutePlanner(httpClient.getConnectionManager().getSchemeRegistry(),
-375 ProxySelector.getDefault()));
-376
-377return httpClient;
-378 }
-379 }
+302while (true) {
+303 HttpPost postLogin = new HttpPost(location);
+304 List<NameValuePair> params = new ArrayList<NameValuePair>();
+305 params.add(new BasicNameValuePair("j_username", client.getLogin()));
+306 params.add(new BasicNameValuePair("j_password", client.getPassword()));
+307 params.add(new BasicNameValuePair("action", "login"));
+308
+309 HttpResponse response = null;
+310try {
+311 postLogin.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
+312 response = httpClient.execute(postLogin);
+313 } catch (IOException e) {
+314thrownewRundeckApiLoginException("Failed to post login form on " + location, e);
+315 }
+316
+317if (response.getStatusLine().getStatusCode() / 100 == 3) {
+318// HTTP client refuses to handle redirects (code 3xx) for POST, so we have to do it manually...
+319 location = response.getFirstHeader("Location").getValue();
+320try {
+321 EntityUtils.consume(response.getEntity());
+322 } catch (IOException e) {
+323thrownewRundeckApiLoginException("Failed to consume entity (release connection)", e);
+324 }
+325continue;
+326 }
+327if (response.getStatusLine().getStatusCode() / 100 != 2) {
+328thrownewRundeckApiLoginException("Invalid HTTP response '" + response.getStatusLine() + "' for "
+329 + location);
+330 }
+331try {
+332 String content = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
+333if (StringUtils.contains(content, "j_security_check")) {
+334thrownewRundeckApiLoginException("Login failed for user " + client.getLogin());
+335 }
+336try {
+337 EntityUtils.consume(response.getEntity());
+338 } catch (IOException e) {
+339thrownewRundeckApiLoginException("Failed to consume entity (release connection)", e);
+340 }
+341 } catch (IOException io) {
+342thrownewRundeckApiLoginException("Failed to read RunDeck result", io);
+343 } catch (ParseException p) {
+344thrownewRundeckApiLoginException("Failed to parse RunDeck response", p);
+345 }
+346break;
+347 }
+348 }
+349
+350/**
+351 * Instantiate a new {@link HttpClient} instance, configured to accept all SSL certificates
+352 *
+353 * @return an {@link HttpClient} instance - won't be null
+354 */
+355private HttpClient instantiateHttpClient() {
+356 DefaultHttpClient httpClient = new DefaultHttpClient();
+357
+358// configure SSL
+359 SSLSocketFactory socketFactory = null;
+360try {
+361 socketFactory = new SSLSocketFactory(new TrustStrategy() {
+362
+363 @Override
+364publicboolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+365returntrue;
+366 }
+367 }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+368 } catch (KeyManagementException e) {
+369thrownew RuntimeException(e);
+370 } catch (UnrecoverableKeyException e) {
+371thrownew RuntimeException(e);
+372 } catch (NoSuchAlgorithmException e) {
+373thrownew RuntimeException(e);
+374 } catch (KeyStoreException e) {
+375thrownew RuntimeException(e);
+376 }
+377 httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("https", 443, socketFactory));
+378
+379// configure proxy (use system env : http.proxyHost / http.proxyPort)
+380 System.setProperty("java.net.useSystemProxies", "true");
+381 httpClient.setRoutePlanner(new ProxySelectorRoutePlanner(httpClient.getConnectionManager().getSchemeRegistry(),
+382 ProxySelector.getDefault()));
+383
+384// in case of token-based authentication, add the correct HTTP header to all requests via an interceptor
+385 httpClient.addRequestInterceptor(new HttpRequestInterceptor() {
+386
+387 @Override
+388publicvoid process(HttpRequest request, HttpContext context) throws HttpException, IOException {
+389if (client.getToken() != null) {
+390 request.addHeader(AUTH_TOKEN_HEADER, client.getToken());
+391 }
+392 }
+393 });
+394
+395return httpClient;
+396 }
+397 }
diff --git a/xref/org/rundeck/api/RundeckApiException.html b/xref/org/rundeck/api/RundeckApiException.html
index 45163b8..3854f5a 100644
--- a/xref/org/rundeck/api/RundeckApiException.html
+++ b/xref/org/rundeck/api/RundeckApiException.html
@@ -43,22 +43,57 @@
33 }
3435/**
-36 * Specific login-related error
-37 */
-38publicstaticclassRundeckApiLoginExceptionextendsRundeckApiException {
-39
-40privatestaticfinallong serialVersionUID = 1L;
-41
-42publicRundeckApiLoginException(String message) {
-43super(message);
-44 }
-45
-46publicRundeckApiLoginException(String message, Throwable cause) {
-47super(message, cause);
-48 }
-49 }
-50
-51 }
+36 * Specific authentication-related error (either login or token).
+37 *
+38 * @see RundeckApiLoginException
+39 * @see RundeckApiTokenException
+40 */
+41publicstaticclassRundeckApiAuthExceptionextendsRundeckApiException {
+42
+43privatestaticfinallong serialVersionUID = 1L;
+44
+45publicRundeckApiAuthException(String message) {
+46super(message);
+47 }
+48
+49publicRundeckApiAuthException(String message, Throwable cause) {
+50super(message, cause);
+51 }
+52 }
+53
+54/**
+55 * Specific authentication-related error (in case of login-based authentication)
+56 */
+57publicstaticclassRundeckApiLoginExceptionextendsRundeckApiAuthException {
+58
+59privatestaticfinallong serialVersionUID = 1L;
+60
+61publicRundeckApiLoginException(String message) {
+62super(message);
+63 }
+64
+65publicRundeckApiLoginException(String message, Throwable cause) {
+66super(message, cause);
+67 }
+68 }
+69
+70/**
+71 * Specific authentication-related error (in case of token-based authentication)
+72 */
+73publicstaticclassRundeckApiTokenExceptionextendsRundeckApiAuthException {
+74
+75privatestaticfinallong serialVersionUID = 1L;
+76
+77publicRundeckApiTokenException(String message) {
+78super(message);
+79 }
+80
+81publicRundeckApiTokenException(String message, Throwable cause) {
+82super(message, cause);
+83 }
+84 }
+85
+86 }
diff --git a/xref/org/rundeck/api/RundeckClient.html b/xref/org/rundeck/api/RundeckClient.html
index eee41de..f6d94cd 100644
--- a/xref/org/rundeck/api/RundeckClient.html
+++ b/xref/org/rundeck/api/RundeckClient.html
@@ -39,2207 +39,2362 @@
29import org.apache.commons.io.IOUtils;
30import org.apache.commons.lang.StringUtils;
31import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
-32import org.rundeck.api.domain.RundeckAbort;
-33import org.rundeck.api.domain.RundeckExecution;
-34import org.rundeck.api.domain.RundeckExecution.ExecutionStatus;
-35import org.rundeck.api.domain.RundeckHistory;
-36import org.rundeck.api.domain.RundeckJob;
-37import org.rundeck.api.domain.RundeckJobsImportMethod;
-38import org.rundeck.api.domain.RundeckJobsImportResult;
-39import org.rundeck.api.domain.RundeckNode;
-40import org.rundeck.api.domain.RundeckProject;
-41import org.rundeck.api.domain.RundeckSystemInfo;
-42import org.rundeck.api.parser.AbortParser;
-43import org.rundeck.api.parser.ExecutionParser;
-44import org.rundeck.api.parser.HistoryParser;
-45import org.rundeck.api.parser.JobParser;
-46import org.rundeck.api.parser.JobsImportResultParser;
-47import org.rundeck.api.parser.ListParser;
-48import org.rundeck.api.parser.NodeParser;
-49import org.rundeck.api.parser.ProjectParser;
-50import org.rundeck.api.parser.StringParser;
-51import org.rundeck.api.parser.SystemInfoParser;
-52import org.rundeck.api.util.AssertUtil;
-53import org.rundeck.api.util.ParametersUtil;
-54
-55/**
-56 * Main entry point to talk to a RunDeck instance.<br>
-57 * Usage : <br>
-58 * <code>
-59 * <pre>
-60 * RundeckClient rundeck = new RundeckClient("http://localhost:4440", "admin", "admin");
-61 *
-62 * List<RundeckProject> projects = rundeck.getProjects();
-63 *
-64 * RundeckJob job = rundeck.findJob("my-project", "main-group/sub-group", "job-name");
-65 * RundeckExecution execution = rundeck.triggerJob(job.getId(),
-66 * new OptionsBuilder().addOption("version", "1.2.0").toProperties());
-67 *
-68 * List<RundeckExecution> runningExecutions = rundeck.getRunningExecutions("my-project");
+32import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
+33import org.rundeck.api.domain.RundeckAbort;
+34import org.rundeck.api.domain.RundeckExecution;
+35import org.rundeck.api.domain.RundeckExecution.ExecutionStatus;
+36import org.rundeck.api.domain.RundeckHistory;
+37import org.rundeck.api.domain.RundeckJob;
+38import org.rundeck.api.domain.RundeckJobsImportMethod;
+39import org.rundeck.api.domain.RundeckJobsImportResult;
+40import org.rundeck.api.domain.RundeckNode;
+41import org.rundeck.api.domain.RundeckProject;
+42import org.rundeck.api.domain.RundeckSystemInfo;
+43import org.rundeck.api.parser.AbortParser;
+44import org.rundeck.api.parser.ExecutionParser;
+45import org.rundeck.api.parser.HistoryParser;
+46import org.rundeck.api.parser.JobParser;
+47import org.rundeck.api.parser.JobsImportResultParser;
+48import org.rundeck.api.parser.ListParser;
+49import org.rundeck.api.parser.NodeParser;
+50import org.rundeck.api.parser.ProjectParser;
+51import org.rundeck.api.parser.StringParser;
+52import org.rundeck.api.parser.SystemInfoParser;
+53import org.rundeck.api.util.AssertUtil;
+54import org.rundeck.api.util.ParametersUtil;
+55
+56/**
+57 * Main entry point to talk to a RunDeck instance.<br>
+58 * You have 2 methods for authentication : login-based or token-based. If you want to use the first, you need to provide
+59 * both a "login" and a "password". Otherwise, just provide a "token" (also called "auth-token"). See the RunDeck
+60 * documentation for generating such a token.<br>
+61 * <br>
+62 * Usage : <br>
+63 * <code>
+64 * <pre>
+65 * // using login-based authentication :
+66 * RundeckClient rundeck = new RundeckClient("http://localhost:4440", "admin", "admin");
+67 * // or for a token-based authentication :
+68 * RundeckClient rundeck = new RundeckClient("http://localhost:4440", "PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD");69 *
-70 * rundeck.exportJobsToFile("/tmp/jobs.xml", FileType.XML, "my-project");
-71 * rundeck.importJobs("/tmp/jobs.xml", FileType.XML);
-72 * </pre>
-73 * </code>
-74 *
-75 * @author Vincent Behar
-76 */
-77publicclassRundeckClientimplements Serializable {
-78
-79privatestaticfinallong serialVersionUID = 1L;
-80
-81/** Version of the API supported */
-82publicstaticfinaltransientint API_VERSION = 1;
-83
-84/** End-point of the API */
-85publicstaticfinaltransient String API_ENDPOINT = "/api/" + API_VERSION;
+70 * List<RundeckProject> projects = rundeck.getProjects();
+71 *
+72 * RundeckJob job = rundeck.findJob("my-project", "main-group/sub-group", "job-name");
+73 * RundeckExecution execution = rundeck.triggerJob(job.getId(),
+74 * new OptionsBuilder().addOption("version", "1.2.0").toProperties());
+75 *
+76 * List<RundeckExecution> runningExecutions = rundeck.getRunningExecutions("my-project");
+77 *
+78 * rundeck.exportJobsToFile("/tmp/jobs.xml", FileType.XML, "my-project");
+79 * rundeck.importJobs("/tmp/jobs.xml", FileType.XML);
+80 * </pre>
+81 * </code>
+82 *
+83 * @author Vincent Behar
+84 */
+85publicclassRundeckClientimplements Serializable {
86
-87/** Default value for the "pooling interval" used when running jobs/commands/scripts */
-88privatestaticfinaltransientlong DEFAULT_POOLING_INTERVAL = 5;
-89
-90/** Default unit of the "pooling interval" used when running jobs/commands/scripts */
-91privatestaticfinaltransient TimeUnit DEFAULT_POOLING_UNIT = TimeUnit.SECONDS;
-92
-93/** URL of the RunDeck instance ("http://localhost:4440" target="alexandria_uri">http://localhost:4440", "http://rundeck.your-compagny.com/", etc) */
-94privatefinal String url;
-95
-96/** Login to use for authentication on the RunDeck instance */
-97privatefinal String login;
-98
-99/** Password to use for authentication on the RunDeck instance */
-100privatefinal String password;
-101
-102/**
-103 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url
-104 *
-105 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc)
-106 * @param login
-107 * @param password
-108 * @throws IllegalArgumentException if the url, login or password is blank (null, empty or whitespace)
-109 */
-110publicRundeckClient(String url, String login, String password) throws IllegalArgumentException {
-111super();
-112this.url = url;
-113this.login = login;
-114this.password = password;
-115 AssertUtil.notBlank(url, "The RunDeck URL is mandatory !");
-116 AssertUtil.notBlank(login, "The RunDeck login is mandatory !");
-117 AssertUtil.notBlank(password, "The RunDeck password is mandatory !");
-118 }
-119
-120/**
-121 * Try to "ping" the RunDeck instance to see if it is alive
-122 *
-123 * @throws RundeckApiException if the ping fails
-124 */
-125publicvoid ping() throws RundeckApiException {
-126newApiCall(this).ping();
-127 }
-128
-129/**
-130 * Test your credentials (login/password) on the RunDeck instance
-131 *
-132 * @throws RundeckApiLoginException if the login fails
-133 */
-134publicvoid testCredentials() throws RundeckApiLoginException {
-135newApiCall(this).testCredentials();
-136 }
-137
-138/*
-139 * Projects
-140 */
-141
-142/**
-143 * List all projects
-144 *
-145 * @return a {@link List} of {@link RundeckProject} : might be empty, but won't be null
-146 * @throws RundeckApiException in case of error when calling the API
-147 * @throws RundeckApiLoginException if the login failed
-148 */
-149public List<RundeckProject> getProjects() throws RundeckApiException, RundeckApiLoginException {
-150returnnewApiCall(this).get(newApiPathBuilder("/projects"),
-151new ListParser<RundeckProject>(newProjectParser(), "result/projects/project"));
-152 }
-153
-154/**
-155 * Get the definition of a single project, identified by the given name
-156 *
-157 * @param projectName name of the project - mandatory
-158 * @return a {@link RundeckProject} instance - won't be null
-159 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-160 * @throws RundeckApiLoginException if the login failed
-161 * @throws IllegalArgumentException if the projectName is blank (null, empty or whitespace)
-162 */
-163publicRundeckProject getProject(String projectName) throws RundeckApiException, RundeckApiLoginException,
-164 IllegalArgumentException {
-165 AssertUtil.notBlank(projectName, "projectName is mandatory to get the details of a project !");
-166returnnewApiCall(this).get(newApiPathBuilder("/project/", projectName),
-167newProjectParser("result/projects/project"));
-168 }
-169
-170/*
-171 * Jobs
-172 */
-173
-174/**
-175 * List all jobs (for all projects)
-176 *
-177 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null
-178 * @throws RundeckApiException in case of error when calling the API
-179 * @throws RundeckApiLoginException if the login failed
+87privatestaticfinallong serialVersionUID = 1L;
+88
+89/** Version of the API supported */
+90publicstaticfinaltransientint API_VERSION = 2;
+91
+92/** End-point of the API */
+93publicstaticfinaltransient String API_ENDPOINT = "/api/" + API_VERSION;
+94
+95/** Default value for the "pooling interval" used when running jobs/commands/scripts */
+96privatestaticfinaltransientlong DEFAULT_POOLING_INTERVAL = 5;
+97
+98/** Default unit of the "pooling interval" used when running jobs/commands/scripts */
+99privatestaticfinaltransient TimeUnit DEFAULT_POOLING_UNIT = TimeUnit.SECONDS;
+100
+101/** URL of the RunDeck instance ("http://localhost:4440" target="alexandria_uri">http://localhost:4440", "http://rundeck.your-compagny.com/", etc) */
+102privatefinal String url;
+103
+104/** Auth-token for authentication (if not using login-based auth) */
+105privatefinal String token;
+106
+107/** Login to use for authentication on the RunDeck instance (if not using token-based auth) */
+108privatefinal String login;
+109
+110/** Password to use for authentication on the RunDeck instance (if not using token-based auth) */
+111privatefinal String password;
+112
+113/**
+114 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url, using login-based
+115 * authentication.
+116 *
+117 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc)
+118 * @param login to use for authentication on the RunDeck instance
+119 * @param password to use for authentication on the RunDeck instance
+120 * @throws IllegalArgumentException if the url, login or password is blank (null, empty or whitespace)
+121 */
+122publicRundeckClient(String url, String login, String password) throws IllegalArgumentException {
+123super();
+124 AssertUtil.notBlank(url, "The RunDeck URL is mandatory !");
+125 AssertUtil.notBlank(login, "The RunDeck login is mandatory !");
+126 AssertUtil.notBlank(password, "The RunDeck password is mandatory !");
+127this.url = url;
+128this.login = login;
+129this.password = password;
+130this.token = null;
+131 }
+132
+133/**
+134 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url, using token-based
+135 * authentication.
+136 *
+137 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc)
+138 * @param token to use for authentication on the RunDeck instance
+139 * @throws IllegalArgumentException if the url or token is blank (null, empty or whitespace)
+140 */
+141publicRundeckClient(String url, String token) throws IllegalArgumentException {
+142super();
+143 AssertUtil.notBlank(url, "The RunDeck URL is mandatory !");
+144 AssertUtil.notBlank(token, "The RunDeck auth-token is mandatory !");
+145this.url = url;
+146this.token = token;
+147this.login = null;
+148this.password = null;
+149 }
+150
+151/**
+152 * Try to "ping" the RunDeck instance to see if it is alive
+153 *
+154 * @throws RundeckApiException if the ping fails
+155 */
+156publicvoid ping() throws RundeckApiException {
+157newApiCall(this).ping();
+158 }
+159
+160/**
+161 * Test your credentials (login/password) on the RunDeck instance
+162 *
+163 * @throws RundeckApiLoginException if the login fails
+164 */
+165publicvoid testCredentials() throws RundeckApiLoginException {
+166newApiCall(this).testCredentials();
+167 }
+168
+169/*
+170 * Projects
+171 */
+172
+173/**
+174 * List all projects
+175 *
+176 * @return a {@link List} of {@link RundeckProject} : might be empty, but won't be null
+177 * @throws RundeckApiException in case of error when calling the API
+178 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+179 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)180 */
-181public List<RundeckJob> getJobs() throws RundeckApiException, RundeckApiLoginException {
-182 List<RundeckJob> jobs = new ArrayList<RundeckJob>();
-183for (RundeckProject project : getProjects()) {
-184 jobs.addAll(getJobs(project.getName()));
-185 }
-186return jobs;
-187 }
-188
-189/**
-190 * List all jobs that belongs to the given project
-191 *
-192 * @param project name of the project - mandatory
-193 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null
-194 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-195 * @throws RundeckApiLoginException if the login failed
-196 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-197 * @see #getJobs(String, String, String, String...)
-198 */
-199public List<RundeckJob> getJobs(String project) throws RundeckApiException, RundeckApiLoginException,
-200 IllegalArgumentException {
-201return getJobs(project, null, null, new String[0]);
+181public List<RundeckProject> getProjects() throws RundeckApiException, RundeckApiLoginException,
+182RundeckApiTokenException {
+183returnnewApiCall(this).get(newApiPathBuilder("/projects"),
+184new ListParser<RundeckProject>(newProjectParser(), "result/projects/project"));
+185 }
+186
+187/**
+188 * Get the definition of a single project, identified by the given name
+189 *
+190 * @param projectName name of the project - mandatory
+191 * @return a {@link RundeckProject} instance - won't be null
+192 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+193 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+194 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+195 * @throws IllegalArgumentException if the projectName is blank (null, empty or whitespace)
+196 */
+197publicRundeckProject getProject(String projectName) throws RundeckApiException, RundeckApiLoginException,
+198 RundeckApiTokenException, IllegalArgumentException {
+199 AssertUtil.notBlank(projectName, "projectName is mandatory to get the details of a project !");
+200returnnewApiCall(this).get(newApiPathBuilder("/project/", projectName),
+201newProjectParser("result/projects/project"));
202 }
203
-204/**
-205 * List the jobs that belongs to the given project, and matches the given criteria (jobFilter, groupPath and jobIds)
-206 *
-207 * @param project name of the project - mandatory
-208 * @param jobFilter a filter for the job Name - optional
-209 * @param groupPath a group or partial group path to include all jobs within that group path - optional
-210 * @param jobIds a list of Job IDs to include - optional
+204/*
+205 * Jobs
+206 */
+207
+208/**
+209 * List all jobs (for all projects)
+210 * 211 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null
-212 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-213 * @throws RundeckApiLoginException if the login failed
-214 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-215 * @see #getJobs(String)
-216 */
-217public List<RundeckJob> getJobs(String project, String jobFilter, String groupPath, String... jobIds)
-218throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-219 AssertUtil.notBlank(project, "project is mandatory to get all jobs !");
-220returnnewApiCall(this).get(newApiPathBuilder("/jobs").param("project", project)
-221 .param("jobFilter", jobFilter)
-222 .param("groupPath", groupPath)
-223 .param("idlist", StringUtils.join(jobIds, ",")),
-224new ListParser<RundeckJob>(newJobParser(), "result/jobs/job"));
-225 }
-226
-227/**
-228 * Export the definitions of all jobs that belongs to the given project
-229 *
-230 * @param filename path of the file where the content should be saved - mandatory
-231 * @param format of the export. See {@link FileType} - mandatory
-232 * @param project name of the project - mandatory
-233 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-234 * @throws RundeckApiLoginException if the login failed
-235 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is
-236 * invalid
-237 * @throws IOException if we failed to write to the file
-238 * @see #exportJobsToFile(String, FileType, String, String, String, String...)
-239 * @see #exportJobs(String, String)
-240 */
-241publicvoid exportJobsToFile(String filename, String format, String project) throws RundeckApiException,
-242 RundeckApiLoginException, IllegalArgumentException, IOException {
-243 AssertUtil.notBlank(format, "format is mandatory to export jobs !");
-244 exportJobsToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), project);
-245 }
-246
-247/**
-248 * Export the definitions of all jobs that belongs to the given project
-249 *
-250 * @param filename path of the file where the content should be saved - mandatory
-251 * @param format of the export. See {@link FileType} - mandatory
-252 * @param project name of the project - mandatory
-253 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-254 * @throws RundeckApiLoginException if the login failed
-255 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null
-256 * @throws IOException if we failed to write to the file
-257 * @see #exportJobsToFile(String, FileType, String, String, String, String...)
-258 * @see #exportJobs(FileType, String)
-259 */
-260publicvoid exportJobsToFile(String filename, FileType format, String project) throws RundeckApiException,
-261 RundeckApiLoginException, IllegalArgumentException, IOException {
-262 exportJobsToFile(filename, format, project, null, null, new String[0]);
-263 }
-264
-265/**
-266 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
-267 * groupPath and jobIds)
-268 *
-269 * @param filename path of the file where the content should be saved - mandatory
-270 * @param format of the export. See {@link FileType} - mandatory
-271 * @param project name of the project - mandatory
-272 * @param jobFilter a filter for the job Name - optional
-273 * @param groupPath a group or partial group path to include all jobs within that group path - optional
-274 * @param jobIds a list of Job IDs to include - optional
-275 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-276 * @throws RundeckApiLoginException if the login failed
-277 * @throws IllegalArgumentException if the filename, format or project is blank (null, empty or whitespace), or the
-278 * format is invalid
-279 * @throws IOException if we failed to write to the file
-280 * @see #exportJobsToFile(String, FileType, String, String, String, String...)
-281 * @see #exportJobs(FileType, String, String, String, String...)
-282 */
-283publicvoid exportJobsToFile(String filename, String format, String project, String jobFilter, String groupPath,
-284 String... jobIds) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException,
-285 IOException {
-286 AssertUtil.notBlank(format, "format is mandatory to export jobs !");
-287 exportJobsToFile(filename,
-288 FileType.valueOf(StringUtils.upperCase(format)),
-289 project,
-290 jobFilter,
-291 groupPath,
-292 jobIds);
-293 }
-294
-295/**
-296 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
-297 * groupPath and jobIds)
-298 *
-299 * @param filename path of the file where the content should be saved - mandatory
-300 * @param format of the export. See {@link FileType} - mandatory
-301 * @param project name of the project - mandatory
-302 * @param jobFilter a filter for the job Name - optional
-303 * @param groupPath a group or partial group path to include all jobs within that group path - optional
-304 * @param jobIds a list of Job IDs to include - optional
-305 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-306 * @throws RundeckApiLoginException if the login failed
-307 * @throws IllegalArgumentException if the filename or project is blank (null, empty or whitespace), or the format
-308 * is null
-309 * @throws IOException if we failed to write to the file
-310 * @see #exportJobs(FileType, String, String, String, String...)
-311 */
-312publicvoid exportJobsToFile(String filename, FileType format, String project, String jobFilter, String groupPath,
-313 String... jobIds) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException,
-314 IOException {
-315 AssertUtil.notBlank(filename, "filename is mandatory to export a job !");
-316 InputStream inputStream = exportJobs(format, project, jobFilter, groupPath, jobIds);
-317 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream));
-318 }
-319
-320/**
-321 * Export the definitions of all jobs that belongs to the given project
-322 *
-323 * @param format of the export. See {@link FileType} - mandatory
-324 * @param project name of the project - mandatory
-325 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
-326 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-327 * @throws RundeckApiLoginException if the login failed
-328 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is
-329 * invalid
-330 * @see #exportJobs(FileType, String, String, String, String...)
-331 * @see #exportJobsToFile(String, String, String)
-332 */
-333public InputStream exportJobs(String format, String project) throws RundeckApiException, RundeckApiLoginException,
-334 IllegalArgumentException {
-335 AssertUtil.notBlank(format, "format is mandatory to export jobs !");
-336return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project);
-337 }
-338
-339/**
-340 * Export the definitions of all jobs that belongs to the given project
-341 *
-342 * @param format of the export. See {@link FileType} - mandatory
-343 * @param project name of the project - mandatory
-344 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
+212 * @throws RundeckApiException in case of error when calling the API
+213 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+214 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+215 */
+216public List<RundeckJob> getJobs() throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException {
+217 List<RundeckJob> jobs = new ArrayList<RundeckJob>();
+218for (RundeckProject project : getProjects()) {
+219 jobs.addAll(getJobs(project.getName()));
+220 }
+221return jobs;
+222 }
+223
+224/**
+225 * List all jobs that belongs to the given project
+226 *
+227 * @param project name of the project - mandatory
+228 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null
+229 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+230 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+231 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+232 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+233 * @see #getJobs(String, String, String, String...)
+234 */
+235public List<RundeckJob> getJobs(String project) throws RundeckApiException, RundeckApiLoginException,
+236 RundeckApiTokenException, IllegalArgumentException {
+237return getJobs(project, null, null, new String[0]);
+238 }
+239
+240/**
+241 * List the jobs that belongs to the given project, and matches the given criteria (jobFilter, groupPath and jobIds)
+242 *
+243 * @param project name of the project - mandatory
+244 * @param jobFilter a filter for the job Name - optional
+245 * @param groupPath a group or partial group path to include all jobs within that group path - optional
+246 * @param jobIds a list of Job IDs to include - optional
+247 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null
+248 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+249 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+250 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+251 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+252 * @see #getJobs(String)
+253 */
+254public List<RundeckJob> getJobs(String project, String jobFilter, String groupPath, String... jobIds)
+255throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+256 AssertUtil.notBlank(project, "project is mandatory to get all jobs !");
+257returnnewApiCall(this).get(newApiPathBuilder("/jobs").param("project", project)
+258 .param("jobFilter", jobFilter)
+259 .param("groupPath", groupPath)
+260 .param("idlist", StringUtils.join(jobIds, ",")),
+261new ListParser<RundeckJob>(newJobParser(), "result/jobs/job"));
+262 }
+263
+264/**
+265 * Export the definitions of all jobs that belongs to the given project
+266 *
+267 * @param filename path of the file where the content should be saved - mandatory
+268 * @param format of the export. See {@link FileType} - mandatory
+269 * @param project name of the project - mandatory
+270 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+271 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+272 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+273 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is
+274 * invalid
+275 * @throws IOException if we failed to write to the file
+276 * @see #exportJobsToFile(String, FileType, String, String, String, String...)
+277 * @see #exportJobs(String, String)
+278 */
+279publicvoid exportJobsToFile(String filename, String format, String project) throws RundeckApiException,
+280 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+281 AssertUtil.notBlank(format, "format is mandatory to export jobs !");
+282 exportJobsToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), project);
+283 }
+284
+285/**
+286 * Export the definitions of all jobs that belongs to the given project
+287 *
+288 * @param filename path of the file where the content should be saved - mandatory
+289 * @param format of the export. See {@link FileType} - mandatory
+290 * @param project name of the project - mandatory
+291 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+292 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+293 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+294 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null
+295 * @throws IOException if we failed to write to the file
+296 * @see #exportJobsToFile(String, FileType, String, String, String, String...)
+297 * @see #exportJobs(FileType, String)
+298 */
+299publicvoid exportJobsToFile(String filename, FileType format, String project) throws RundeckApiException,
+300 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+301 exportJobsToFile(filename, format, project, null, null, new String[0]);
+302 }
+303
+304/**
+305 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
+306 * groupPath and jobIds)
+307 *
+308 * @param filename path of the file where the content should be saved - mandatory
+309 * @param format of the export. See {@link FileType} - mandatory
+310 * @param project name of the project - mandatory
+311 * @param jobFilter a filter for the job Name - optional
+312 * @param groupPath a group or partial group path to include all jobs within that group path - optional
+313 * @param jobIds a list of Job IDs to include - optional
+314 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+315 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+316 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+317 * @throws IllegalArgumentException if the filename, format or project is blank (null, empty or whitespace), or the
+318 * format is invalid
+319 * @throws IOException if we failed to write to the file
+320 * @see #exportJobsToFile(String, FileType, String, String, String, String...)
+321 * @see #exportJobs(FileType, String, String, String, String...)
+322 */
+323publicvoid exportJobsToFile(String filename, String format, String project, String jobFilter, String groupPath,
+324 String... jobIds) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+325 IllegalArgumentException, IOException {
+326 AssertUtil.notBlank(format, "format is mandatory to export jobs !");
+327 exportJobsToFile(filename,
+328 FileType.valueOf(StringUtils.upperCase(format)),
+329 project,
+330 jobFilter,
+331 groupPath,
+332 jobIds);
+333 }
+334
+335/**
+336 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
+337 * groupPath and jobIds)
+338 *
+339 * @param filename path of the file where the content should be saved - mandatory
+340 * @param format of the export. See {@link FileType} - mandatory
+341 * @param project name of the project - mandatory
+342 * @param jobFilter a filter for the job Name - optional
+343 * @param groupPath a group or partial group path to include all jobs within that group path - optional
+344 * @param jobIds a list of Job IDs to include - optional345 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-346 * @throws RundeckApiLoginException if the login failed
-347 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null
-348 * @see #exportJobs(FileType, String, String, String, String...)
-349 * @see #exportJobsToFile(String, FileType, String)
-350 */
-351public InputStream exportJobs(FileType format, String project) throws RundeckApiException,
-352 RundeckApiLoginException, IllegalArgumentException {
-353return exportJobs(format, project, null, null, new String[0]);
-354 }
-355
-356/**
-357 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
-358 * groupPath and jobIds)
-359 *
-360 * @param format of the export. See {@link FileType} - mandatory
-361 * @param project name of the project - mandatory
-362 * @param jobFilter a filter for the job Name - optional
-363 * @param groupPath a group or partial group path to include all jobs within that group path - optional
-364 * @param jobIds a list of Job IDs to include - optional
-365 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
-366 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-367 * @throws RundeckApiLoginException if the login failed
-368 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is
-369 * invalid
-370 * @see #exportJobs(FileType, String, String, String, String...)
-371 * @see #exportJobsToFile(String, String, String, String, String, String...)
-372 */
-373public InputStream exportJobs(String format, String project, String jobFilter, String groupPath, String... jobIds)
-374throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-375 AssertUtil.notBlank(format, "format is mandatory to export jobs !");
-376return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project, jobFilter, groupPath, jobIds);
-377 }
-378
-379/**
-380 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
-381 * groupPath and jobIds)
-382 *
-383 * @param format of the export. See {@link FileType} - mandatory
-384 * @param project name of the project - mandatory
-385 * @param jobFilter a filter for the job Name - optional
-386 * @param groupPath a group or partial group path to include all jobs within that group path - optional
-387 * @param jobIds a list of Job IDs to include - optional
-388 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
-389 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-390 * @throws RundeckApiLoginException if the login failed
-391 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null
-392 * @see #exportJobsToFile(String, FileType, String, String, String, String...)
+346 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+347 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+348 * @throws IllegalArgumentException if the filename or project is blank (null, empty or whitespace), or the format
+349 * is null
+350 * @throws IOException if we failed to write to the file
+351 * @see #exportJobs(FileType, String, String, String, String...)
+352 */
+353publicvoid exportJobsToFile(String filename, FileType format, String project, String jobFilter, String groupPath,
+354 String... jobIds) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+355 IllegalArgumentException, IOException {
+356 AssertUtil.notBlank(filename, "filename is mandatory to export a job !");
+357 InputStream inputStream = exportJobs(format, project, jobFilter, groupPath, jobIds);
+358 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream));
+359 }
+360
+361/**
+362 * Export the definitions of all jobs that belongs to the given project
+363 *
+364 * @param format of the export. See {@link FileType} - mandatory
+365 * @param project name of the project - mandatory
+366 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
+367 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+368 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+369 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+370 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is
+371 * invalid
+372 * @see #exportJobs(FileType, String, String, String, String...)
+373 * @see #exportJobsToFile(String, String, String)
+374 */
+375public InputStream exportJobs(String format, String project) throws RundeckApiException, RundeckApiLoginException,
+376 RundeckApiTokenException, IllegalArgumentException {
+377 AssertUtil.notBlank(format, "format is mandatory to export jobs !");
+378return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project);
+379 }
+380
+381/**
+382 * Export the definitions of all jobs that belongs to the given project
+383 *
+384 * @param format of the export. See {@link FileType} - mandatory
+385 * @param project name of the project - mandatory
+386 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
+387 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+388 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+389 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+390 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null
+391 * @see #exportJobs(FileType, String, String, String, String...)
+392 * @see #exportJobsToFile(String, FileType, String)393 */
-394public InputStream exportJobs(FileType format, String project, String jobFilter, String groupPath, String... jobIds)
-395throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-396 AssertUtil.notNull(format, "format is mandatory to export jobs !");
-397 AssertUtil.notBlank(project, "project is mandatory to export jobs !");
-398returnnewApiCall(this).get(newApiPathBuilder("/jobs/export").param("format", format)
-399 .param("project", project)
-400 .param("jobFilter", jobFilter)
-401 .param("groupPath", groupPath)
-402 .param("idlist", StringUtils.join(jobIds, ",")));
-403 }
-404
-405/**
-406 * Export the definition of a single job (identified by the given ID)
-407 *
-408 * @param filename path of the file where the content should be saved - mandatory
-409 * @param format of the export. See {@link FileType} - mandatory
-410 * @param jobId identifier of the job - mandatory
-411 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-412 * @throws RundeckApiLoginException if the login failed
-413 * @throws IllegalArgumentException if the filename, format or jobId is blank (null, empty or whitespace), or the
-414 * format is invalid
-415 * @throws IOException if we failed to write to the file
-416 * @see #exportJobToFile(String, FileType, String)
-417 * @see #exportJob(String, String)
-418 * @see #getJob(String)
-419 */
-420publicvoid exportJobToFile(String filename, String format, String jobId) throws RundeckApiException,
-421 RundeckApiLoginException, IllegalArgumentException, IOException {
-422 AssertUtil.notBlank(format, "format is mandatory to export a job !");
-423 exportJobToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), jobId);
-424 }
-425
-426/**
-427 * Export the definition of a single job (identified by the given ID)
-428 *
-429 * @param filename path of the file where the content should be saved - mandatory
-430 * @param format of the export. See {@link FileType} - mandatory
-431 * @param jobId identifier of the job - mandatory
-432 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-433 * @throws RundeckApiLoginException if the login failed
-434 * @throws IllegalArgumentException if the filename or jobId is blank (null, empty or whitespace), or the format is
-435 * null
-436 * @throws IOException if we failed to write to the file
-437 * @see #exportJob(FileType, String)
-438 * @see #getJob(String)
-439 */
-440publicvoid exportJobToFile(String filename, FileType format, String jobId) throws RundeckApiException,
-441 RundeckApiLoginException, IllegalArgumentException, IOException {
-442 AssertUtil.notBlank(filename, "filename is mandatory to export a job !");
-443 InputStream inputStream = exportJob(format, jobId);
-444 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream));
-445 }
-446
-447/**
-448 * Export the definition of a single job, identified by the given ID
-449 *
-450 * @param format of the export. See {@link FileType} - mandatory
-451 * @param jobId identifier of the job - mandatory
-452 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
-453 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-454 * @throws RundeckApiLoginException if the login failed
-455 * @throws IllegalArgumentException if the format or jobId is blank (null, empty or whitespace), or the format is
-456 * invalid
-457 * @see #exportJobToFile(String, String, String)
-458 * @see #getJob(String)
-459 */
-460public InputStream exportJob(String format, String jobId) throws RundeckApiException, RundeckApiLoginException,
-461 IllegalArgumentException {
-462 AssertUtil.notBlank(format, "format is mandatory to export a job !");
-463return exportJob(FileType.valueOf(StringUtils.upperCase(format)), jobId);
-464 }
-465
-466/**
-467 * Export the definition of a single job, identified by the given ID
-468 *
-469 * @param format of the export. See {@link FileType} - mandatory
-470 * @param jobId identifier of the job - mandatory
-471 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
-472 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-473 * @throws RundeckApiLoginException if the login failed
-474 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the format is null
-475 * @see #exportJobToFile(String, FileType, String)
-476 * @see #getJob(String)
-477 */
-478public InputStream exportJob(FileType format, String jobId) throws RundeckApiException, RundeckApiLoginException,
-479 IllegalArgumentException {
-480 AssertUtil.notNull(format, "format is mandatory to export a job !");
-481 AssertUtil.notBlank(jobId, "jobId is mandatory to export a job !");
-482returnnewApiCall(this).get(newApiPathBuilder("/job/", jobId).param("format", format));
-483 }
-484
-485/**
-486 * Import the definitions of jobs, from the given file
-487 *
-488 * @param filename of the file containing the jobs definitions - mandatory
-489 * @param fileType type of the file. See {@link FileType} - mandatory
-490 * @return a {@link RundeckJobsImportResult} instance - won't be null
-491 * @throws RundeckApiException in case of error when calling the API
-492 * @throws RundeckApiLoginException if the login failed
-493 * @throws IllegalArgumentException if the filename or fileType is blank (null, empty or whitespace), or the
-494 * fileType is invalid
-495 * @throws IOException if we failed to read the file
-496 * @see #importJobs(InputStream, String)
-497 * @see #importJobs(String, FileType, RundeckJobsImportMethod)
-498 */
-499publicRundeckJobsImportResult importJobs(String filename, String fileType) throws RundeckApiException,
-500 RundeckApiLoginException, IllegalArgumentException, IOException {
-501 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !");
-502return importJobs(filename, FileType.valueOf(StringUtils.upperCase(fileType)));
-503 }
-504
-505/**
-506 * Import the definitions of jobs, from the given file
-507 *
-508 * @param filename of the file containing the jobs definitions - mandatory
-509 * @param fileType type of the file. See {@link FileType} - mandatory
-510 * @return a {@link RundeckJobsImportResult} instance - won't be null
-511 * @throws RundeckApiException in case of error when calling the API
-512 * @throws RundeckApiLoginException if the login failed
-513 * @throws IllegalArgumentException if the filename is blank (null, empty or whitespace), or the fileType is null
-514 * @throws IOException if we failed to read the file
-515 * @see #importJobs(InputStream, FileType)
-516 * @see #importJobs(String, FileType, RundeckJobsImportMethod)
-517 */
-518publicRundeckJobsImportResult importJobs(String filename, FileType fileType) throws RundeckApiException,
-519 RundeckApiLoginException, IllegalArgumentException, IOException {
-520return importJobs(filename, fileType, (RundeckJobsImportMethod) null);
-521 }
-522
-523/**
-524 * Import the definitions of jobs, from the given file, using the given behavior
-525 *
-526 * @param filename of the file containing the jobs definitions - mandatory
-527 * @param fileType type of the file. See {@link FileType} - mandatory
-528 * @param importBehavior see {@link RundeckJobsImportMethod}
-529 * @return a {@link RundeckJobsImportResult} instance - won't be null
-530 * @throws RundeckApiException in case of error when calling the API
-531 * @throws RundeckApiLoginException if the login failed
-532 * @throws IllegalArgumentException if the filename or fileType is blank (null, empty or whitespace), or the
-533 * fileType or behavior is not valid
-534 * @throws IOException if we failed to read the file
-535 * @see #importJobs(InputStream, String, String)
-536 * @see #importJobs(String, FileType, RundeckJobsImportMethod)
-537 */
-538publicRundeckJobsImportResult importJobs(String filename, String fileType, String importBehavior)
-539throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException, IOException {
-540 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !");
-541return importJobs(filename,
-542 FileType.valueOf(StringUtils.upperCase(fileType)),
-543 RundeckJobsImportMethod.valueOf(StringUtils.upperCase(importBehavior)));
-544 }
-545
-546/**
-547 * Import the definitions of jobs, from the given file, using the given behavior
-548 *
-549 * @param filename of the file containing the jobs definitions - mandatory
-550 * @param fileType type of the file. See {@link FileType} - mandatory
-551 * @param importBehavior see {@link RundeckJobsImportMethod}
-552 * @return a {@link RundeckJobsImportResult} instance - won't be null
-553 * @throws RundeckApiException in case of error when calling the API
-554 * @throws RundeckApiLoginException if the login failed
-555 * @throws IllegalArgumentException if the filename is blank (null, empty or whitespace), or the fileType is null
-556 * @throws IOException if we failed to read the file
-557 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod)
-558 */
-559publicRundeckJobsImportResult importJobs(String filename, FileType fileType, RundeckJobsImportMethod importBehavior)
-560throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException, IOException {
-561 AssertUtil.notBlank(filename, "filename (of jobs file) is mandatory to import jobs !");
-562 FileInputStream stream = null;
-563try {
-564 stream = FileUtils.openInputStream(new File(filename));
-565return importJobs(stream, fileType, importBehavior);
-566 } finally {
-567 IOUtils.closeQuietly(stream);
-568 }
-569 }
-570
-571/**
-572 * Import the definitions of jobs, from the given input stream
-573 *
-574 * @param stream inputStream for reading the definitions - mandatory
-575 * @param fileType type of the file. See {@link FileType} - mandatory
-576 * @return a {@link RundeckJobsImportResult} instance - won't be null
-577 * @throws RundeckApiException in case of error when calling the API
-578 * @throws RundeckApiLoginException if the login failed
-579 * @throws IllegalArgumentException if the stream is null, or the fileType is blank (null, empty or whitespace) or
-580 * invalid
-581 * @see #importJobs(String, String)
-582 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod)
-583 */
-584publicRundeckJobsImportResult importJobs(InputStream stream, String fileType) throws RundeckApiException,
-585 RundeckApiLoginException, IllegalArgumentException {
-586 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !");
-587return importJobs(stream, FileType.valueOf(StringUtils.upperCase(fileType)));
-588 }
-589
-590/**
-591 * Import the definitions of jobs, from the given input stream
-592 *
-593 * @param stream inputStream for reading the definitions - mandatory
-594 * @param fileType type of the file. See {@link FileType} - mandatory
-595 * @return a {@link RundeckJobsImportResult} instance - won't be null
-596 * @throws RundeckApiException in case of error when calling the API
-597 * @throws RundeckApiLoginException if the login failed
-598 * @throws IllegalArgumentException if the stream or fileType is null
-599 * @see #importJobs(String, FileType)
-600 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod)
-601 */
-602publicRundeckJobsImportResult importJobs(InputStream stream, FileType fileType) throws RundeckApiException,
-603 RundeckApiLoginException, IllegalArgumentException {
-604return importJobs(stream, fileType, (RundeckJobsImportMethod) null);
-605 }
-606
-607/**
-608 * Import the definitions of jobs, from the given input stream, using the given behavior
-609 *
-610 * @param stream inputStream for reading the definitions - mandatory
-611 * @param fileType type of the file. See {@link FileType} - mandatory
-612 * @param importBehavior see {@link RundeckJobsImportMethod}
-613 * @return a {@link RundeckJobsImportResult} instance - won't be null
-614 * @throws RundeckApiException in case of error when calling the API
-615 * @throws RundeckApiLoginException if the login failed
-616 * @throws IllegalArgumentException if the stream is null, or the fileType is blank (null, empty or whitespace), or
-617 * the fileType or behavior is not valid
-618 * @see #importJobs(String, String, String)
-619 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod)
-620 */
-621publicRundeckJobsImportResult importJobs(InputStream stream, String fileType, String importBehavior)
-622throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-623 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !");
-624return importJobs(stream,
-625 FileType.valueOf(StringUtils.upperCase(fileType)),
-626 RundeckJobsImportMethod.valueOf(StringUtils.upperCase(importBehavior)));
-627 }
-628
-629/**
-630 * Import the definitions of jobs, from the given input stream, using the given behavior
-631 *
-632 * @param stream inputStream for reading the definitions - mandatory
-633 * @param fileType type of the file. See {@link FileType} - mandatory
-634 * @param importBehavior see {@link RundeckJobsImportMethod}
-635 * @return a {@link RundeckJobsImportResult} instance - won't be null
-636 * @throws RundeckApiException in case of error when calling the API
-637 * @throws RundeckApiLoginException if the login failed
-638 * @throws IllegalArgumentException if the stream or fileType is null
-639 * @see #importJobs(String, FileType, RundeckJobsImportMethod)
-640 */
-641publicRundeckJobsImportResult importJobs(InputStream stream, FileType fileType,
-642RundeckJobsImportMethod importBehavior) throws RundeckApiException, RundeckApiLoginException,
-643 IllegalArgumentException {
-644 AssertUtil.notNull(stream, "inputStream of jobs is mandatory to import jobs !");
-645 AssertUtil.notNull(fileType, "fileType is mandatory to import jobs !");
-646returnnewApiCall(this).post(newApiPathBuilder("/jobs/import").param("format", fileType)
-647 .param("dupeOption", importBehavior)
-648 .attach("xmlBatch", stream),
-649newJobsImportResultParser("result"));
-650 }
-651
-652/**
-653 * Find a job, identified by its project, group and name. Note that the groupPath is optional, as a job does not
-654 * need to belong to a group (either pass null, or an empty string).
-655 *
-656 * @param project name of the project - mandatory
-657 * @param groupPath group to which the job belongs (if it belongs to a group) - optional
-658 * @param name of the job to find - mandatory
-659 * @return a {@link RundeckJob} instance - null if not found
-660 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-661 * @throws RundeckApiLoginException if the login failed
-662 * @throws IllegalArgumentException if the project or the name is blank (null, empty or whitespace)
-663 * @see #getJob(String)
-664 */
-665publicRundeckJob findJob(String project, String groupPath, String name) throws RundeckApiException,
-666 RundeckApiLoginException, IllegalArgumentException {
-667 AssertUtil.notBlank(project, "project is mandatory to find a job !");
-668 AssertUtil.notBlank(name, "job name is mandatory to find a job !");
-669 List<RundeckJob> jobs = getJobs(project, name, groupPath, new String[0]);
-670return jobs.isEmpty() ? null : jobs.get(0);
-671 }
-672
-673/**
-674 * Get the definition of a single job, identified by the given ID
-675 *
-676 * @param jobId identifier of the job - mandatory
-677 * @return a {@link RundeckJob} instance - won't be null
-678 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-679 * @throws RundeckApiLoginException if the login failed
-680 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-681 * @see #findJob(String, String, String)
-682 * @see #exportJob(String, String)
-683 */
-684publicRundeckJob getJob(String jobId) throws RundeckApiException, RundeckApiLoginException,
-685 IllegalArgumentException {
-686 AssertUtil.notBlank(jobId, "jobId is mandatory to get the details of a job !");
-687returnnewApiCall(this).get(newApiPathBuilder("/job/", jobId), newJobParser("joblist/job"));
-688 }
-689
-690/**
-691 * Delete a single job, identified by the given ID
-692 *
-693 * @param jobId identifier of the job - mandatory
-694 * @return the success message (note that in case of error, you'll get an exception)
-695 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-696 * @throws RundeckApiLoginException if the login failed
-697 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-698 */
-699public String deleteJob(String jobId) throws RundeckApiException, RundeckApiLoginException,
-700 IllegalArgumentException {
-701 AssertUtil.notBlank(jobId, "jobId is mandatory to delete a job !");
-702returnnewApiCall(this).delete(newApiPathBuilder("/job/", jobId), newStringParser("result/success/message"));
-703 }
-704
-705/**
-706 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
-707 * end of the job execution)
-708 *
-709 * @param jobId identifier of the job - mandatory
-710 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-711 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-712 * @throws RundeckApiLoginException if the login failed
-713 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-714 * @see #triggerJob(String, Properties, Properties)
-715 * @see #runJob(String)
-716 */
-717publicRundeckExecution triggerJob(String jobId) throws RundeckApiException, RundeckApiLoginException,
-718 IllegalArgumentException {
-719return triggerJob(jobId, null);
-720 }
-721
-722/**
-723 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
-724 * end of the job execution)
-725 *
-726 * @param jobId identifier of the job - mandatory
-727 * @param options of the job - optional. See {@link OptionsBuilder}.
-728 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-729 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-730 * @throws RundeckApiLoginException if the login failed
-731 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-732 * @see #triggerJob(String, Properties, Properties)
-733 * @see #runJob(String, Properties)
-734 */
-735publicRundeckExecution triggerJob(String jobId, Properties options) throws RundeckApiException,
-736 RundeckApiLoginException, IllegalArgumentException {
-737return triggerJob(jobId, options, null);
-738 }
-739
-740/**
-741 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
-742 * end of the job execution)
-743 *
-744 * @param jobId identifier of the job - mandatory
-745 * @param options of the job - optional. See {@link OptionsBuilder}.
-746 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See
-747 * {@link NodeFiltersBuilder}
-748 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-749 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-750 * @throws RundeckApiLoginException if the login failed
-751 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-752 * @see #triggerJob(String)
-753 * @see #runJob(String, Properties, Properties)
-754 */
-755publicRundeckExecution triggerJob(String jobId, Properties options, Properties nodeFilters)
-756throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-757 AssertUtil.notBlank(jobId, "jobId is mandatory to trigger a job !");
-758returnnewApiCall(this).get(newApiPathBuilder("/job/", jobId, "/run").param("argString",
-759 ParametersUtil.generateArgString(options))
-760 .nodeFilters(nodeFilters),
-761newExecutionParser("result/executions/execution"));
-762 }
-763
-764/**
-765 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
-766 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or
-767 * aborted) or is still running.
-768 *
-769 * @param jobId identifier of the job - mandatory
-770 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-771 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-772 * @throws RundeckApiLoginException if the login failed
-773 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-774 * @see #triggerJob(String)
-775 * @see #runJob(String, Properties, Properties, long, TimeUnit)
-776 */
-777publicRundeckExecution runJob(String jobId) throws RundeckApiException, RundeckApiLoginException,
-778 IllegalArgumentException {
-779return runJob(jobId, null);
-780 }
-781
-782/**
-783 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
-784 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or
-785 * aborted) or is still running.
-786 *
-787 * @param jobId identifier of the job - mandatory
-788 * @param options of the job - optional. See {@link OptionsBuilder}.
-789 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-790 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-791 * @throws RundeckApiLoginException if the login failed
-792 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-793 * @see #triggerJob(String, Properties)
-794 * @see #runJob(String, Properties, Properties, long, TimeUnit)
-795 */
-796publicRundeckExecution runJob(String jobId, Properties options) throws RundeckApiException,
-797 RundeckApiLoginException, IllegalArgumentException {
-798return runJob(jobId, options, null);
-799 }
-800
-801/**
-802 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
-803 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or
-804 * aborted) or is still running.
-805 *
-806 * @param jobId identifier of the job - mandatory
-807 * @param options of the job - optional. See {@link OptionsBuilder}.
-808 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See
-809 * {@link NodeFiltersBuilder}
-810 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-811 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-812 * @throws RundeckApiLoginException if the login failed
-813 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-814 * @see #triggerJob(String, Properties, Properties)
-815 * @see #runJob(String, Properties, Properties, long, TimeUnit)
-816 */
-817publicRundeckExecution runJob(String jobId, Properties options, Properties nodeFilters)
-818throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-819return runJob(jobId, options, nodeFilters, DEFAULT_POOLING_INTERVAL, DEFAULT_POOLING_UNIT);
-820 }
-821
-822/**
-823 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
-824 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to
-825 * know if the execution is finished (or aborted) or is still running.
-826 *
-827 * @param jobId identifier of the job - mandatory
-828 * @param options of the job - optional. See {@link OptionsBuilder}.
-829 * @param poolingInterval for checking the status of the execution. Must be > 0.
-830 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-831 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-832 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-833 * @throws RundeckApiLoginException if the login failed
-834 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-835 * @see #triggerJob(String, Properties)
-836 * @see #runJob(String, Properties, Properties, long, TimeUnit)
-837 */
-838publicRundeckExecution runJob(String jobId, Properties options, long poolingInterval, TimeUnit poolingUnit)
-839throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-840return runJob(jobId, options, null, poolingInterval, poolingUnit);
-841 }
-842
-843/**
-844 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
-845 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to
-846 * know if the execution is finished (or aborted) or is still running.
-847 *
-848 * @param jobId identifier of the job - mandatory
-849 * @param options of the job - optional. See {@link OptionsBuilder}.
-850 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See
-851 * {@link NodeFiltersBuilder}
-852 * @param poolingInterval for checking the status of the execution. Must be > 0.
-853 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-854 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-855 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-856 * @throws RundeckApiLoginException if the login failed
-857 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-858 * @see #triggerJob(String, Properties)
-859 * @see #runJob(String, Properties, Properties, long, TimeUnit)
-860 */
-861publicRundeckExecution runJob(String jobId, Properties options, Properties nodeFilters, long poolingInterval,
-862 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-863if (poolingInterval <= 0) {
-864 poolingInterval = DEFAULT_POOLING_INTERVAL;
-865 poolingUnit = DEFAULT_POOLING_UNIT;
-866 }
-867if (poolingUnit == null) {
-868 poolingUnit = DEFAULT_POOLING_UNIT;
-869 }
-870
-871RundeckExecution execution = triggerJob(jobId, options, nodeFilters);
-872while (ExecutionStatus.RUNNING.equals(execution.getStatus())) {
-873try {
-874 Thread.sleep(poolingUnit.toMillis(poolingInterval));
-875 } catch (InterruptedException e) {
-876break;
-877 }
-878 execution = getExecution(execution.getId());
-879 }
-880return execution;
-881 }
-882
-883/*
-884 * Ad-hoc commands
-885 */
-886
-887/**
-888 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
-889 * The command will not be dispatched to nodes, but be executed on the RunDeck server.
-890 *
-891 * @param project name of the project - mandatory
-892 * @param command to be executed - mandatory
-893 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-894 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-895 * @throws RundeckApiLoginException if the login failed
-896 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-897 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean)
-898 * @see #runAdhocCommand(String, String)
-899 */
-900publicRundeckExecution triggerAdhocCommand(String project, String command) throws RundeckApiException,
-901 RundeckApiLoginException, IllegalArgumentException {
-902return triggerAdhocCommand(project, command, null);
-903 }
-904
-905/**
-906 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
-907 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter.
-908 *
-909 * @param project name of the project - mandatory
-910 * @param command to be executed - mandatory
-911 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-912 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-913 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-914 * @throws RundeckApiLoginException if the login failed
-915 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-916 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean)
-917 * @see #runAdhocCommand(String, String, Properties)
-918 */
-919publicRundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters)
-920throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-921return triggerAdhocCommand(project, command, nodeFilters, null, null);
-922 }
-923
-924/**
-925 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
-926 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter.
-927 *
-928 * @param project name of the project - mandatory
-929 * @param command to be executed - mandatory
-930 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-931 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-932 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-933 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-934 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-935 * @throws RundeckApiLoginException if the login failed
-936 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-937 * @see #triggerAdhocCommand(String, String)
-938 * @see #runAdhocCommand(String, String, Properties)
-939 */
-940publicRundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters,
-941 Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, RundeckApiLoginException,
-942 IllegalArgumentException {
-943 AssertUtil.notBlank(project, "project is mandatory to trigger an ad-hoc command !");
-944 AssertUtil.notBlank(command, "command is mandatory to trigger an ad-hoc command !");
-945RundeckExecution execution = newApiCall(this).get(newApiPathBuilder("/run/command").param("project", project)
-946 .param("exec", command)
-947 .param("nodeThreadcount",
-948 nodeThreadcount)
-949 .param("nodeKeepgoing",
-950 nodeKeepgoing)
-951 .nodeFilters(nodeFilters),
-952newExecutionParser("result/execution"));
-953// the first call just returns the ID of the execution, so we need another call to get a "real" execution
-954return getExecution(execution.getId());
-955 }
-956
-957/**
-958 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-959 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-960 * running. The command will not be dispatched to nodes, but be executed on the RunDeck server.
+394public InputStream exportJobs(FileType format, String project) throws RundeckApiException,
+395 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+396return exportJobs(format, project, null, null, new String[0]);
+397 }
+398
+399/**
+400 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
+401 * groupPath and jobIds)
+402 *
+403 * @param format of the export. See {@link FileType} - mandatory
+404 * @param project name of the project - mandatory
+405 * @param jobFilter a filter for the job Name - optional
+406 * @param groupPath a group or partial group path to include all jobs within that group path - optional
+407 * @param jobIds a list of Job IDs to include - optional
+408 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
+409 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+410 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+411 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+412 * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is
+413 * invalid
+414 * @see #exportJobs(FileType, String, String, String, String...)
+415 * @see #exportJobsToFile(String, String, String, String, String, String...)
+416 */
+417public InputStream exportJobs(String format, String project, String jobFilter, String groupPath, String... jobIds)
+418throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+419 AssertUtil.notBlank(format, "format is mandatory to export jobs !");
+420return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project, jobFilter, groupPath, jobIds);
+421 }
+422
+423/**
+424 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter,
+425 * groupPath and jobIds)
+426 *
+427 * @param format of the export. See {@link FileType} - mandatory
+428 * @param project name of the project - mandatory
+429 * @param jobFilter a filter for the job Name - optional
+430 * @param groupPath a group or partial group path to include all jobs within that group path - optional
+431 * @param jobIds a list of Job IDs to include - optional
+432 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
+433 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+434 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+435 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+436 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the format is null
+437 * @see #exportJobsToFile(String, FileType, String, String, String, String...)
+438 */
+439public InputStream exportJobs(FileType format, String project, String jobFilter, String groupPath, String... jobIds)
+440throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+441 AssertUtil.notNull(format, "format is mandatory to export jobs !");
+442 AssertUtil.notBlank(project, "project is mandatory to export jobs !");
+443returnnewApiCall(this).get(newApiPathBuilder("/jobs/export").param("format", format)
+444 .param("project", project)
+445 .param("jobFilter", jobFilter)
+446 .param("groupPath", groupPath)
+447 .param("idlist", StringUtils.join(jobIds, ",")));
+448 }
+449
+450/**
+451 * Export the definition of a single job (identified by the given ID)
+452 *
+453 * @param filename path of the file where the content should be saved - mandatory
+454 * @param format of the export. See {@link FileType} - mandatory
+455 * @param jobId identifier of the job - mandatory
+456 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+457 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+458 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+459 * @throws IllegalArgumentException if the filename, format or jobId is blank (null, empty or whitespace), or the
+460 * format is invalid
+461 * @throws IOException if we failed to write to the file
+462 * @see #exportJobToFile(String, FileType, String)
+463 * @see #exportJob(String, String)
+464 * @see #getJob(String)
+465 */
+466publicvoid exportJobToFile(String filename, String format, String jobId) throws RundeckApiException,
+467 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+468 AssertUtil.notBlank(format, "format is mandatory to export a job !");
+469 exportJobToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), jobId);
+470 }
+471
+472/**
+473 * Export the definition of a single job (identified by the given ID)
+474 *
+475 * @param filename path of the file where the content should be saved - mandatory
+476 * @param format of the export. See {@link FileType} - mandatory
+477 * @param jobId identifier of the job - mandatory
+478 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+479 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+480 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+481 * @throws IllegalArgumentException if the filename or jobId is blank (null, empty or whitespace), or the format is
+482 * null
+483 * @throws IOException if we failed to write to the file
+484 * @see #exportJob(FileType, String)
+485 * @see #getJob(String)
+486 */
+487publicvoid exportJobToFile(String filename, FileType format, String jobId) throws RundeckApiException,
+488 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+489 AssertUtil.notBlank(filename, "filename is mandatory to export a job !");
+490 InputStream inputStream = exportJob(format, jobId);
+491 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream));
+492 }
+493
+494/**
+495 * Export the definition of a single job, identified by the given ID
+496 *
+497 * @param format of the export. See {@link FileType} - mandatory
+498 * @param jobId identifier of the job - mandatory
+499 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
+500 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+501 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+502 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+503 * @throws IllegalArgumentException if the format or jobId is blank (null, empty or whitespace), or the format is
+504 * invalid
+505 * @see #exportJobToFile(String, String, String)
+506 * @see #getJob(String)
+507 */
+508public InputStream exportJob(String format, String jobId) throws RundeckApiException, RundeckApiLoginException,
+509 RundeckApiTokenException, IllegalArgumentException {
+510 AssertUtil.notBlank(format, "format is mandatory to export a job !");
+511return exportJob(FileType.valueOf(StringUtils.upperCase(format)), jobId);
+512 }
+513
+514/**
+515 * Export the definition of a single job, identified by the given ID
+516 *
+517 * @param format of the export. See {@link FileType} - mandatory
+518 * @param jobId identifier of the job - mandatory
+519 * @return an {@link InputStream} instance, not linked to any network resources - won't be null
+520 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+521 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+522 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+523 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the format is null
+524 * @see #exportJobToFile(String, FileType, String)
+525 * @see #getJob(String)
+526 */
+527public InputStream exportJob(FileType format, String jobId) throws RundeckApiException, RundeckApiLoginException,
+528 RundeckApiTokenException, IllegalArgumentException {
+529 AssertUtil.notNull(format, "format is mandatory to export a job !");
+530 AssertUtil.notBlank(jobId, "jobId is mandatory to export a job !");
+531returnnewApiCall(this).get(newApiPathBuilder("/job/", jobId).param("format", format));
+532 }
+533
+534/**
+535 * Import the definitions of jobs, from the given file
+536 *
+537 * @param filename of the file containing the jobs definitions - mandatory
+538 * @param fileType type of the file. See {@link FileType} - mandatory
+539 * @return a {@link RundeckJobsImportResult} instance - won't be null
+540 * @throws RundeckApiException in case of error when calling the API
+541 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+542 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+543 * @throws IllegalArgumentException if the filename or fileType is blank (null, empty or whitespace), or the
+544 * fileType is invalid
+545 * @throws IOException if we failed to read the file
+546 * @see #importJobs(InputStream, String)
+547 * @see #importJobs(String, FileType, RundeckJobsImportMethod)
+548 */
+549publicRundeckJobsImportResult importJobs(String filename, String fileType) throws RundeckApiException,
+550 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+551 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !");
+552return importJobs(filename, FileType.valueOf(StringUtils.upperCase(fileType)));
+553 }
+554
+555/**
+556 * Import the definitions of jobs, from the given file
+557 *
+558 * @param filename of the file containing the jobs definitions - mandatory
+559 * @param fileType type of the file. See {@link FileType} - mandatory
+560 * @return a {@link RundeckJobsImportResult} instance - won't be null
+561 * @throws RundeckApiException in case of error when calling the API
+562 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+563 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+564 * @throws IllegalArgumentException if the filename is blank (null, empty or whitespace), or the fileType is null
+565 * @throws IOException if we failed to read the file
+566 * @see #importJobs(InputStream, FileType)
+567 * @see #importJobs(String, FileType, RundeckJobsImportMethod)
+568 */
+569publicRundeckJobsImportResult importJobs(String filename, FileType fileType) throws RundeckApiException,
+570 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+571return importJobs(filename, fileType, (RundeckJobsImportMethod) null);
+572 }
+573
+574/**
+575 * Import the definitions of jobs, from the given file, using the given behavior
+576 *
+577 * @param filename of the file containing the jobs definitions - mandatory
+578 * @param fileType type of the file. See {@link FileType} - mandatory
+579 * @param importBehavior see {@link RundeckJobsImportMethod}
+580 * @return a {@link RundeckJobsImportResult} instance - won't be null
+581 * @throws RundeckApiException in case of error when calling the API
+582 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+583 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+584 * @throws IllegalArgumentException if the filename or fileType is blank (null, empty or whitespace), or the
+585 * fileType or behavior is not valid
+586 * @throws IOException if we failed to read the file
+587 * @see #importJobs(InputStream, String, String)
+588 * @see #importJobs(String, FileType, RundeckJobsImportMethod)
+589 */
+590publicRundeckJobsImportResult importJobs(String filename, String fileType, String importBehavior)
+591throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException,
+592 IOException {
+593 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !");
+594return importJobs(filename,
+595 FileType.valueOf(StringUtils.upperCase(fileType)),
+596 RundeckJobsImportMethod.valueOf(StringUtils.upperCase(importBehavior)));
+597 }
+598
+599/**
+600 * Import the definitions of jobs, from the given file, using the given behavior
+601 *
+602 * @param filename of the file containing the jobs definitions - mandatory
+603 * @param fileType type of the file. See {@link FileType} - mandatory
+604 * @param importBehavior see {@link RundeckJobsImportMethod}
+605 * @return a {@link RundeckJobsImportResult} instance - won't be null
+606 * @throws RundeckApiException in case of error when calling the API
+607 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+608 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+609 * @throws IllegalArgumentException if the filename is blank (null, empty or whitespace), or the fileType is null
+610 * @throws IOException if we failed to read the file
+611 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod)
+612 */
+613publicRundeckJobsImportResult importJobs(String filename, FileType fileType, RundeckJobsImportMethod importBehavior)
+614throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException,
+615 IOException {
+616 AssertUtil.notBlank(filename, "filename (of jobs file) is mandatory to import jobs !");
+617 FileInputStream stream = null;
+618try {
+619 stream = FileUtils.openInputStream(new File(filename));
+620return importJobs(stream, fileType, importBehavior);
+621 } finally {
+622 IOUtils.closeQuietly(stream);
+623 }
+624 }
+625
+626/**
+627 * Import the definitions of jobs, from the given input stream
+628 *
+629 * @param stream inputStream for reading the definitions - mandatory
+630 * @param fileType type of the file. See {@link FileType} - mandatory
+631 * @return a {@link RundeckJobsImportResult} instance - won't be null
+632 * @throws RundeckApiException in case of error when calling the API
+633 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+634 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+635 * @throws IllegalArgumentException if the stream is null, or the fileType is blank (null, empty or whitespace) or
+636 * invalid
+637 * @see #importJobs(String, String)
+638 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod)
+639 */
+640publicRundeckJobsImportResult importJobs(InputStream stream, String fileType) throws RundeckApiException,
+641 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+642 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !");
+643return importJobs(stream, FileType.valueOf(StringUtils.upperCase(fileType)));
+644 }
+645
+646/**
+647 * Import the definitions of jobs, from the given input stream
+648 *
+649 * @param stream inputStream for reading the definitions - mandatory
+650 * @param fileType type of the file. See {@link FileType} - mandatory
+651 * @return a {@link RundeckJobsImportResult} instance - won't be null
+652 * @throws RundeckApiException in case of error when calling the API
+653 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+654 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+655 * @throws IllegalArgumentException if the stream or fileType is null
+656 * @see #importJobs(String, FileType)
+657 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod)
+658 */
+659publicRundeckJobsImportResult importJobs(InputStream stream, FileType fileType) throws RundeckApiException,
+660 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+661return importJobs(stream, fileType, (RundeckJobsImportMethod) null);
+662 }
+663
+664/**
+665 * Import the definitions of jobs, from the given input stream, using the given behavior
+666 *
+667 * @param stream inputStream for reading the definitions - mandatory
+668 * @param fileType type of the file. See {@link FileType} - mandatory
+669 * @param importBehavior see {@link RundeckJobsImportMethod}
+670 * @return a {@link RundeckJobsImportResult} instance - won't be null
+671 * @throws RundeckApiException in case of error when calling the API
+672 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+673 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+674 * @throws IllegalArgumentException if the stream is null, or the fileType is blank (null, empty or whitespace), or
+675 * the fileType or behavior is not valid
+676 * @see #importJobs(String, String, String)
+677 * @see #importJobs(InputStream, FileType, RundeckJobsImportMethod)
+678 */
+679publicRundeckJobsImportResult importJobs(InputStream stream, String fileType, String importBehavior)
+680throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+681 AssertUtil.notBlank(fileType, "fileType is mandatory to import jobs !");
+682return importJobs(stream,
+683 FileType.valueOf(StringUtils.upperCase(fileType)),
+684 RundeckJobsImportMethod.valueOf(StringUtils.upperCase(importBehavior)));
+685 }
+686
+687/**
+688 * Import the definitions of jobs, from the given input stream, using the given behavior
+689 *
+690 * @param stream inputStream for reading the definitions - mandatory
+691 * @param fileType type of the file. See {@link FileType} - mandatory
+692 * @param importBehavior see {@link RundeckJobsImportMethod}
+693 * @return a {@link RundeckJobsImportResult} instance - won't be null
+694 * @throws RundeckApiException in case of error when calling the API
+695 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+696 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+697 * @throws IllegalArgumentException if the stream or fileType is null
+698 * @see #importJobs(String, FileType, RundeckJobsImportMethod)
+699 */
+700publicRundeckJobsImportResult importJobs(InputStream stream, FileType fileType,
+701RundeckJobsImportMethod importBehavior) throws RundeckApiException, RundeckApiLoginException,
+702 RundeckApiTokenException, IllegalArgumentException {
+703 AssertUtil.notNull(stream, "inputStream of jobs is mandatory to import jobs !");
+704 AssertUtil.notNull(fileType, "fileType is mandatory to import jobs !");
+705returnnewApiCall(this).post(newApiPathBuilder("/jobs/import").param("format", fileType)
+706 .param("dupeOption", importBehavior)
+707 .attach("xmlBatch", stream),
+708newJobsImportResultParser("result"));
+709 }
+710
+711/**
+712 * Find a job, identified by its project, group and name. Note that the groupPath is optional, as a job does not
+713 * need to belong to a group (either pass null, or an empty string).
+714 *
+715 * @param project name of the project - mandatory
+716 * @param groupPath group to which the job belongs (if it belongs to a group) - optional
+717 * @param name of the job to find - mandatory
+718 * @return a {@link RundeckJob} instance - null if not found
+719 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+720 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+721 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+722 * @throws IllegalArgumentException if the project or the name is blank (null, empty or whitespace)
+723 * @see #getJob(String)
+724 */
+725publicRundeckJob findJob(String project, String groupPath, String name) throws RundeckApiException,
+726 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+727 AssertUtil.notBlank(project, "project is mandatory to find a job !");
+728 AssertUtil.notBlank(name, "job name is mandatory to find a job !");
+729 List<RundeckJob> jobs = getJobs(project, name, groupPath, new String[0]);
+730return jobs.isEmpty() ? null : jobs.get(0);
+731 }
+732
+733/**
+734 * Get the definition of a single job, identified by the given ID
+735 *
+736 * @param jobId identifier of the job - mandatory
+737 * @return a {@link RundeckJob} instance - won't be null
+738 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+739 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+740 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+741 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+742 * @see #findJob(String, String, String)
+743 * @see #exportJob(String, String)
+744 */
+745publicRundeckJob getJob(String jobId) throws RundeckApiException, RundeckApiLoginException,
+746 RundeckApiTokenException, IllegalArgumentException {
+747 AssertUtil.notBlank(jobId, "jobId is mandatory to get the details of a job !");
+748returnnewApiCall(this).get(newApiPathBuilder("/job/", jobId), newJobParser("joblist/job"));
+749 }
+750
+751/**
+752 * Delete a single job, identified by the given ID
+753 *
+754 * @param jobId identifier of the job - mandatory
+755 * @return the success message (note that in case of error, you'll get an exception)
+756 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+757 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+758 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+759 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+760 */
+761public String deleteJob(String jobId) throws RundeckApiException, RundeckApiLoginException,
+762 RundeckApiTokenException, IllegalArgumentException {
+763 AssertUtil.notBlank(jobId, "jobId is mandatory to delete a job !");
+764returnnewApiCall(this).delete(newApiPathBuilder("/job/", jobId), newStringParser("result/success/message"));
+765 }
+766
+767/**
+768 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
+769 * end of the job execution)
+770 *
+771 * @param jobId identifier of the job - mandatory
+772 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+773 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+774 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+775 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+776 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+777 * @see #triggerJob(String, Properties, Properties)
+778 * @see #runJob(String)
+779 */
+780publicRundeckExecution triggerJob(String jobId) throws RundeckApiException, RundeckApiLoginException,
+781 RundeckApiTokenException, IllegalArgumentException {
+782return triggerJob(jobId, null);
+783 }
+784
+785/**
+786 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
+787 * end of the job execution)
+788 *
+789 * @param jobId identifier of the job - mandatory
+790 * @param options of the job - optional. See {@link OptionsBuilder}.
+791 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+792 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+793 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+794 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+795 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+796 * @see #triggerJob(String, Properties, Properties)
+797 * @see #runJob(String, Properties)
+798 */
+799publicRundeckExecution triggerJob(String jobId, Properties options) throws RundeckApiException,
+800 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+801return triggerJob(jobId, options, null);
+802 }
+803
+804/**
+805 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the
+806 * end of the job execution)
+807 *
+808 * @param jobId identifier of the job - mandatory
+809 * @param options of the job - optional. See {@link OptionsBuilder}.
+810 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See
+811 * {@link NodeFiltersBuilder}
+812 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+813 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+814 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+815 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+816 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+817 * @see #triggerJob(String)
+818 * @see #runJob(String, Properties, Properties)
+819 */
+820publicRundeckExecution triggerJob(String jobId, Properties options, Properties nodeFilters)
+821throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+822 AssertUtil.notBlank(jobId, "jobId is mandatory to trigger a job !");
+823returnnewApiCall(this).get(newApiPathBuilder("/job/", jobId, "/run").param("argString",
+824 ParametersUtil.generateArgString(options))
+825 .nodeFilters(nodeFilters),
+826newExecutionParser("result/executions/execution"));
+827 }
+828
+829/**
+830 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
+831 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or
+832 * aborted) or is still running.
+833 *
+834 * @param jobId identifier of the job - mandatory
+835 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+836 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+837 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+838 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+839 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+840 * @see #triggerJob(String)
+841 * @see #runJob(String, Properties, Properties, long, TimeUnit)
+842 */
+843publicRundeckExecution runJob(String jobId) throws RundeckApiException, RundeckApiLoginException,
+844 RundeckApiTokenException, IllegalArgumentException {
+845return runJob(jobId, null);
+846 }
+847
+848/**
+849 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
+850 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or
+851 * aborted) or is still running.
+852 *
+853 * @param jobId identifier of the job - mandatory
+854 * @param options of the job - optional. See {@link OptionsBuilder}.
+855 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+856 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+857 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+858 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+859 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+860 * @see #triggerJob(String, Properties)
+861 * @see #runJob(String, Properties, Properties, long, TimeUnit)
+862 */
+863publicRundeckExecution runJob(String jobId, Properties options) throws RundeckApiException,
+864 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+865return runJob(jobId, options, null);
+866 }
+867
+868/**
+869 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
+870 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or
+871 * aborted) or is still running.
+872 *
+873 * @param jobId identifier of the job - mandatory
+874 * @param options of the job - optional. See {@link OptionsBuilder}.
+875 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See
+876 * {@link NodeFiltersBuilder}
+877 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+878 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+879 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+880 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+881 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+882 * @see #triggerJob(String, Properties, Properties)
+883 * @see #runJob(String, Properties, Properties, long, TimeUnit)
+884 */
+885publicRundeckExecution runJob(String jobId, Properties options, Properties nodeFilters)
+886throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+887return runJob(jobId, options, nodeFilters, DEFAULT_POOLING_INTERVAL, DEFAULT_POOLING_UNIT);
+888 }
+889
+890/**
+891 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
+892 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to
+893 * know if the execution is finished (or aborted) or is still running.
+894 *
+895 * @param jobId identifier of the job - mandatory
+896 * @param options of the job - optional. See {@link OptionsBuilder}.
+897 * @param poolingInterval for checking the status of the execution. Must be > 0.
+898 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+899 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+900 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+901 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+902 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+903 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+904 * @see #triggerJob(String, Properties)
+905 * @see #runJob(String, Properties, Properties, long, TimeUnit)
+906 */
+907publicRundeckExecution runJob(String jobId, Properties options, long poolingInterval, TimeUnit poolingUnit)
+908throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+909return runJob(jobId, options, null, poolingInterval, poolingUnit);
+910 }
+911
+912/**
+913 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return.
+914 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to
+915 * know if the execution is finished (or aborted) or is still running.
+916 *
+917 * @param jobId identifier of the job - mandatory
+918 * @param options of the job - optional. See {@link OptionsBuilder}.
+919 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See
+920 * {@link NodeFiltersBuilder}
+921 * @param poolingInterval for checking the status of the execution. Must be > 0.
+922 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+923 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+924 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+925 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+926 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+927 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+928 * @see #triggerJob(String, Properties)
+929 * @see #runJob(String, Properties, Properties, long, TimeUnit)
+930 */
+931publicRundeckExecution runJob(String jobId, Properties options, Properties nodeFilters, long poolingInterval,
+932 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+933 IllegalArgumentException {
+934if (poolingInterval <= 0) {
+935 poolingInterval = DEFAULT_POOLING_INTERVAL;
+936 poolingUnit = DEFAULT_POOLING_UNIT;
+937 }
+938if (poolingUnit == null) {
+939 poolingUnit = DEFAULT_POOLING_UNIT;
+940 }
+941
+942RundeckExecution execution = triggerJob(jobId, options, nodeFilters);
+943while (ExecutionStatus.RUNNING.equals(execution.getStatus())) {
+944try {
+945 Thread.sleep(poolingUnit.toMillis(poolingInterval));
+946 } catch (InterruptedException e) {
+947break;
+948 }
+949 execution = getExecution(execution.getId());
+950 }
+951return execution;
+952 }
+953
+954/*
+955 * Ad-hoc commands
+956 */
+957
+958/**
+959 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
+960 * The command will not be dispatched to nodes, but be executed on the RunDeck server.961 * 962 * @param project name of the project - mandatory963 * @param command to be executed - mandatory
-964 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+964 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null965 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-966 * @throws RundeckApiLoginException if the login failed
-967 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-968 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
-969 * @see #triggerAdhocCommand(String, String)
-970 */
-971publicRundeckExecution runAdhocCommand(String project, String command) throws RundeckApiException,
-972 RundeckApiLoginException, IllegalArgumentException {
-973return runAdhocCommand(project, command, null);
-974 }
-975
-976/**
-977 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-978 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-979 * finished (or aborted) or is still running. The command will not be dispatched to nodes, but be executed on the
-980 * RunDeck server.
-981 *
-982 * @param project name of the project - mandatory
-983 * @param command to be executed - mandatory
-984 * @param poolingInterval for checking the status of the execution. Must be > 0.
-985 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-986 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-987 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-988 * @throws RundeckApiLoginException if the login failed
-989 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-990 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
-991 * @see #triggerAdhocCommand(String, String)
-992 */
-993publicRundeckExecution runAdhocCommand(String project, String command, long poolingInterval, TimeUnit poolingUnit)
-994throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-995return runAdhocCommand(project, command, null, poolingInterval, poolingUnit);
-996 }
-997
-998/**
-999 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1000 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1001 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1002 *
-1003 * @param project name of the project - mandatory
-1004 * @param command to be executed - mandatory
-1005 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-1006 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+966 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+967 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+968 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+969 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean)
+970 * @see #runAdhocCommand(String, String)
+971 */
+972publicRundeckExecution triggerAdhocCommand(String project, String command) throws RundeckApiException,
+973 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+974return triggerAdhocCommand(project, command, null);
+975 }
+976
+977/**
+978 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
+979 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter.
+980 *
+981 * @param project name of the project - mandatory
+982 * @param command to be executed - mandatory
+983 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+984 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+985 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+986 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+987 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+988 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+989 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean)
+990 * @see #runAdhocCommand(String, String, Properties)
+991 */
+992publicRundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters)
+993throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+994return triggerAdhocCommand(project, command, nodeFilters, null, null);
+995 }
+996
+997/**
+998 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution).
+999 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1000 *
+1001 * @param project name of the project - mandatory
+1002 * @param command to be executed - mandatory
+1003 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1004 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1005 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1006 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null1007 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1008 * @throws RundeckApiLoginException if the login failed
-1009 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-1010 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
-1011 * @see #triggerAdhocCommand(String, String, Properties)
-1012 */
-1013publicRundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters)
-1014throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1015return runAdhocCommand(project, command, nodeFilters, null, null);
-1016 }
-1017
-1018/**
-1019 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1020 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1021 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the
-1022 * nodeFilters parameter.
-1023 *
-1024 * @param project name of the project - mandatory
-1025 * @param command to be executed - mandatory
-1026 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-1027 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1028 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1029 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1030 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1031 * @throws RundeckApiLoginException if the login failed
-1032 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-1033 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
-1034 * @see #triggerAdhocCommand(String, String, Properties)
-1035 */
-1036publicRundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters,
-1037long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException,
-1038 IllegalArgumentException {
-1039return runAdhocCommand(project, command, nodeFilters, null, null, poolingInterval, poolingUnit);
-1040 }
-1041
-1042/**
-1043 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1044 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1045 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1046 *
-1047 * @param project name of the project - mandatory
-1048 * @param command to be executed - mandatory
-1049 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-1050 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-1051 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-1052 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1053 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1054 * @throws RundeckApiLoginException if the login failed
-1055 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-1056 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
-1057 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean)
-1058 */
-1059publicRundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters,
-1060 Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, RundeckApiLoginException,
-1061 IllegalArgumentException {
-1062return runAdhocCommand(project,
-1063 command,
-1064 nodeFilters,
-1065 nodeThreadcount,
-1066 nodeKeepgoing,
-1067 DEFAULT_POOLING_INTERVAL,
-1068 DEFAULT_POOLING_UNIT);
-1069 }
-1070
-1071/**
-1072 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1073 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1074 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the
-1075 * nodeFilters parameter.
-1076 *
-1077 * @param project name of the project - mandatory
-1078 * @param command to be executed - mandatory
-1079 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-1080 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-1081 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-1082 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1083 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1084 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1085 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1086 * @throws RundeckApiLoginException if the login failed
-1087 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
-1088 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean)
+1008 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1009 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1010 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+1011 * @see #triggerAdhocCommand(String, String)
+1012 * @see #runAdhocCommand(String, String, Properties)
+1013 */
+1014publicRundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters,
+1015 Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, RundeckApiLoginException,
+1016 RundeckApiTokenException, IllegalArgumentException {
+1017 AssertUtil.notBlank(project, "project is mandatory to trigger an ad-hoc command !");
+1018 AssertUtil.notBlank(command, "command is mandatory to trigger an ad-hoc command !");
+1019RundeckExecution execution = newApiCall(this).get(newApiPathBuilder("/run/command").param("project", project)
+1020 .param("exec", command)
+1021 .param("nodeThreadcount",
+1022 nodeThreadcount)
+1023 .param("nodeKeepgoing",
+1024 nodeKeepgoing)
+1025 .nodeFilters(nodeFilters),
+1026newExecutionParser("result/execution"));
+1027// the first call just returns the ID of the execution, so we need another call to get a "real" execution
+1028return getExecution(execution.getId());
+1029 }
+1030
+1031/**
+1032 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1033 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1034 * running. The command will not be dispatched to nodes, but be executed on the RunDeck server.
+1035 *
+1036 * @param project name of the project - mandatory
+1037 * @param command to be executed - mandatory
+1038 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1039 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1040 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1041 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1042 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+1043 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
+1044 * @see #triggerAdhocCommand(String, String)
+1045 */
+1046publicRundeckExecution runAdhocCommand(String project, String command) throws RundeckApiException,
+1047 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1048return runAdhocCommand(project, command, null);
+1049 }
+1050
+1051/**
+1052 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1053 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1054 * finished (or aborted) or is still running. The command will not be dispatched to nodes, but be executed on the
+1055 * RunDeck server.
+1056 *
+1057 * @param project name of the project - mandatory
+1058 * @param command to be executed - mandatory
+1059 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1060 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1061 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1062 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1063 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1064 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1065 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+1066 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
+1067 * @see #triggerAdhocCommand(String, String)
+1068 */
+1069publicRundeckExecution runAdhocCommand(String project, String command, long poolingInterval, TimeUnit poolingUnit)
+1070throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1071return runAdhocCommand(project, command, null, poolingInterval, poolingUnit);
+1072 }
+1073
+1074/**
+1075 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1076 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1077 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1078 *
+1079 * @param project name of the project - mandatory
+1080 * @param command to be executed - mandatory
+1081 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1082 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1083 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1084 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1085 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1086 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+1087 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
+1088 * @see #triggerAdhocCommand(String, String, Properties)1089 */
-1090publicRundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters,
-1091 Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval, TimeUnit poolingUnit)
-1092throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1093if (poolingInterval <= 0) {
-1094 poolingInterval = DEFAULT_POOLING_INTERVAL;
-1095 poolingUnit = DEFAULT_POOLING_UNIT;
-1096 }
-1097if (poolingUnit == null) {
-1098 poolingUnit = DEFAULT_POOLING_UNIT;
-1099 }
-1100
-1101RundeckExecution execution = triggerAdhocCommand(project, command, nodeFilters, nodeThreadcount, nodeKeepgoing);
-1102while (ExecutionStatus.RUNNING.equals(execution.getStatus())) {
-1103try {
-1104 Thread.sleep(poolingUnit.toMillis(poolingInterval));
-1105 } catch (InterruptedException e) {
-1106break;
-1107 }
-1108 execution = getExecution(execution.getId());
-1109 }
-1110return execution;
-1111 }
-1112
-1113/*
-1114 * Ad-hoc scripts
-1115 */
-1116
-1117/**
-1118 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
-1119 * script will not be dispatched to nodes, but be executed on the RunDeck server.
-1120 *
-1121 * @param project name of the project - mandatory
-1122 * @param scriptFilename filename of the script to be executed - mandatory
-1123 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-1124 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1125 * @throws RundeckApiLoginException if the login failed
-1126 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1127 * @throws IOException if we failed to read the file
-1128 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
-1129 * @see #runAdhocScript(String, String)
-1130 */
-1131publicRundeckExecution triggerAdhocScript(String project, String scriptFilename) throws RundeckApiException,
-1132 RundeckApiLoginException, IllegalArgumentException, IOException {
-1133return triggerAdhocScript(project, scriptFilename, null);
-1134 }
-1135
-1136/**
-1137 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
-1138 * script will not be dispatched to nodes, but be executed on the RunDeck server.
-1139 *
-1140 * @param project name of the project - mandatory
-1141 * @param scriptFilename filename of the script to be executed - mandatory
-1142 * @param options of the script - optional. See {@link OptionsBuilder}.
-1143 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-1144 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1145 * @throws RundeckApiLoginException if the login failed
-1146 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1147 * @throws IOException if we failed to read the file
-1148 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
-1149 * @see #runAdhocScript(String, String, Properties)
-1150 */
-1151publicRundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options)
-1152throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException, IOException {
-1153return triggerAdhocScript(project, scriptFilename, options, null);
-1154 }
-1155
-1156/**
-1157 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
-1158 * script will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1159 *
-1160 * @param project name of the project - mandatory
-1161 * @param scriptFilename filename of the script to be executed - mandatory
-1162 * @param options of the script - optional. See {@link OptionsBuilder}.
-1163 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-1164 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-1165 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1166 * @throws RundeckApiLoginException if the login failed
-1167 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1168 * @throws IOException if we failed to read the file
-1169 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
-1170 * @see #runAdhocScript(String, String, Properties, Properties)
-1171 */
-1172publicRundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options,
-1173 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException,
-1174 IOException {
-1175return triggerAdhocScript(project, scriptFilename, options, nodeFilters, null, null);
-1176 }
-1177
-1178/**
-1179 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
-1180 * script will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1181 *
-1182 * @param project name of the project - mandatory
-1183 * @param scriptFilename filename of the script to be executed - mandatory
-1184 * @param options of the script - optional. See {@link OptionsBuilder}.
-1185 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-1186 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-1187 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-1188 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-1189 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1190 * @throws RundeckApiLoginException if the login failed
-1191 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1192 * @throws IOException if we failed to read the file
-1193 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
-1194 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1195 */
-1196publicRundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options,
-1197 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException,
-1198 RundeckApiLoginException, IllegalArgumentException, IOException {
-1199 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to trigger an ad-hoc script !");
-1200 FileInputStream stream = null;
-1201try {
-1202 stream = FileUtils.openInputStream(new File(scriptFilename));
-1203return triggerAdhocScript(project, stream, options, nodeFilters, nodeThreadcount, nodeKeepgoing);
-1204 } finally {
-1205 IOUtils.closeQuietly(stream);
-1206 }
-1207 }
-1208
-1209/**
-1210 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
-1211 * script will not be dispatched to nodes, but be executed on the RunDeck server.
-1212 *
-1213 * @param project name of the project - mandatory
-1214 * @param script inputStream for reading the script to be executed - mandatory
-1215 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-1216 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1217 * @throws RundeckApiLoginException if the login failed
-1218 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1219 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
-1220 * @see #runAdhocScript(String, InputStream)
-1221 */
-1222publicRundeckExecution triggerAdhocScript(String project, InputStream script) throws RundeckApiException,
-1223 RundeckApiLoginException, IllegalArgumentException {
-1224return triggerAdhocScript(project, script, null);
-1225 }
-1226
-1227/**
-1228 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
-1229 * script will not be dispatched to nodes, but be executed on the RunDeck server.
-1230 *
-1231 * @param project name of the project - mandatory
-1232 * @param script inputStream for reading the script to be executed - mandatory
-1233 * @param options of the script - optional. See {@link OptionsBuilder}.
-1234 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-1235 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1236 * @throws RundeckApiLoginException if the login failed
-1237 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1238 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
-1239 * @see #runAdhocScript(String, InputStream, Properties)
-1240 */
-1241publicRundeckExecution triggerAdhocScript(String project, InputStream script, Properties options)
-1242throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1243return triggerAdhocScript(project, script, options, null);
-1244 }
-1245
-1246/**
-1247 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
-1248 * script will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1249 *
-1250 * @param project name of the project - mandatory
-1251 * @param script inputStream for reading the script to be executed - mandatory
-1252 * @param options of the script - optional. See {@link OptionsBuilder}.
-1253 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-1254 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-1255 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1256 * @throws RundeckApiLoginException if the login failed
-1257 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1258 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
-1259 * @see #runAdhocScript(String, InputStream, Properties, Properties)
-1260 */
-1261publicRundeckExecution triggerAdhocScript(String project, InputStream script, Properties options,
-1262 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1263return triggerAdhocScript(project, script, options, nodeFilters, null, null);
-1264 }
-1265
-1266/**
-1267 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
-1268 * script will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1269 *
-1270 * @param project name of the project - mandatory
-1271 * @param script inputStream for reading the script to be executed - mandatory
-1272 * @param options of the script - optional. See {@link OptionsBuilder}.
-1273 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
-1274 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-1275 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-1276 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
-1277 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1278 * @throws RundeckApiLoginException if the login failed
-1279 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1280 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
-1281 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1282 */
-1283publicRundeckExecution triggerAdhocScript(String project, InputStream script, Properties options,
-1284 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException,
-1285 RundeckApiLoginException, IllegalArgumentException {
-1286 AssertUtil.notBlank(project, "project is mandatory to trigger an ad-hoc script !");
-1287 AssertUtil.notNull(script, "script is mandatory to trigger an ad-hoc script !");
-1288RundeckExecution execution = newApiCall(this).post(newApiPathBuilder("/run/script").param("project", project)
-1289 .attach("scriptFile",
-1290 script)
-1291 .param("argString",
-1292 ParametersUtil.generateArgString(options))
-1293 .param("nodeThreadcount",
-1294 nodeThreadcount)
-1295 .param("nodeKeepgoing",
-1296 nodeKeepgoing)
-1297 .nodeFilters(nodeFilters),
-1298newExecutionParser("result/execution"));
-1299// the first call just returns the ID of the execution, so we need another call to get a "real" execution
-1300return getExecution(execution.getId());
-1301 }
-1302
-1303/**
-1304 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1305 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1306 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server.
-1307 *
-1308 * @param project name of the project - mandatory
-1309 * @param scriptFilename filename of the script to be executed - mandatory
-1310 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1311 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1312 * @throws RundeckApiLoginException if the login failed
-1313 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1314 * @throws IOException if we failed to read the file
-1315 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1316 * @see #triggerAdhocScript(String, String)
-1317 */
-1318publicRundeckExecution runAdhocScript(String project, String scriptFilename) throws RundeckApiException,
-1319 RundeckApiLoginException, IllegalArgumentException, IOException {
-1320return runAdhocScript(project, scriptFilename, null);
-1321 }
-1322
-1323/**
-1324 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1325 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1326 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the
-1327 * RunDeck server.
-1328 *
-1329 * @param project name of the project - mandatory
-1330 * @param scriptFilename filename of the script to be executed - mandatory
-1331 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1332 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1333 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1334 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1335 * @throws RundeckApiLoginException if the login failed
-1336 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1337 * @throws IOException if we failed to read the file
-1338 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1339 * @see #triggerAdhocScript(String, String)
-1340 */
-1341publicRundeckExecution runAdhocScript(String project, String scriptFilename, long poolingInterval,
-1342 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException,
-1343 IOException {
-1344return runAdhocScript(project, scriptFilename, null, poolingInterval, poolingUnit);
-1345 }
-1346
-1347/**
-1348 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1349 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1350 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server.
-1351 *
-1352 * @param project name of the project - mandatory
-1353 * @param scriptFilename filename of the script to be executed - mandatory
-1354 * @param options of the script - optional. See {@link OptionsBuilder}.
-1355 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1356 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1357 * @throws RundeckApiLoginException if the login failed
-1358 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1359 * @throws IOException if we failed to read the file
-1360 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1361 * @see #triggerAdhocScript(String, String, Properties)
-1362 */
-1363publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options)
-1364throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException, IOException {
-1365return runAdhocScript(project, scriptFilename, options, null);
-1366 }
-1367
-1368/**
-1369 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1370 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1371 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the
-1372 * RunDeck server.
-1373 *
-1374 * @param project name of the project - mandatory
-1375 * @param scriptFilename filename of the script to be executed - mandatory
-1376 * @param options of the script - optional. See {@link OptionsBuilder}.
-1377 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1378 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1379 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1380 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1381 * @throws RundeckApiLoginException if the login failed
-1382 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1383 * @throws IOException if we failed to read the file
-1384 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1385 * @see #triggerAdhocScript(String, String, Properties)
-1386 */
-1387publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
-1388long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException,
-1389 IllegalArgumentException, IOException {
-1390return runAdhocScript(project, scriptFilename, options, null, poolingInterval, poolingUnit);
+1090publicRundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters)
+1091throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1092return runAdhocCommand(project, command, nodeFilters, null, null);
+1093 }
+1094
+1095/**
+1096 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1097 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1098 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the
+1099 * nodeFilters parameter.
+1100 *
+1101 * @param project name of the project - mandatory
+1102 * @param command to be executed - mandatory
+1103 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1104 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1105 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1106 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1107 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1108 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1109 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1110 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+1111 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
+1112 * @see #triggerAdhocCommand(String, String, Properties)
+1113 */
+1114publicRundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters,
+1115long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException,
+1116 RundeckApiTokenException, IllegalArgumentException {
+1117return runAdhocCommand(project, command, nodeFilters, null, null, poolingInterval, poolingUnit);
+1118 }
+1119
+1120/**
+1121 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1122 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1123 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1124 *
+1125 * @param project name of the project - mandatory
+1126 * @param command to be executed - mandatory
+1127 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1128 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1129 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1130 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1131 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1132 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1133 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1134 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+1135 * @see #runAdhocCommand(String, String, Properties, Integer, Boolean, long, TimeUnit)
+1136 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean)
+1137 */
+1138publicRundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters,
+1139 Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException, RundeckApiLoginException,
+1140 RundeckApiTokenException, IllegalArgumentException {
+1141return runAdhocCommand(project,
+1142 command,
+1143 nodeFilters,
+1144 nodeThreadcount,
+1145 nodeKeepgoing,
+1146 DEFAULT_POOLING_INTERVAL,
+1147 DEFAULT_POOLING_UNIT);
+1148 }
+1149
+1150/**
+1151 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1152 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1153 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the
+1154 * nodeFilters parameter.
+1155 *
+1156 * @param project name of the project - mandatory
+1157 * @param command to be executed - mandatory
+1158 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1159 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1160 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1161 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1162 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1163 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1164 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1165 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1166 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1167 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace)
+1168 * @see #triggerAdhocCommand(String, String, Properties, Integer, Boolean)
+1169 */
+1170publicRundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters,
+1171 Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval, TimeUnit poolingUnit)
+1172throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1173if (poolingInterval <= 0) {
+1174 poolingInterval = DEFAULT_POOLING_INTERVAL;
+1175 poolingUnit = DEFAULT_POOLING_UNIT;
+1176 }
+1177if (poolingUnit == null) {
+1178 poolingUnit = DEFAULT_POOLING_UNIT;
+1179 }
+1180
+1181RundeckExecution execution = triggerAdhocCommand(project, command, nodeFilters, nodeThreadcount, nodeKeepgoing);
+1182while (ExecutionStatus.RUNNING.equals(execution.getStatus())) {
+1183try {
+1184 Thread.sleep(poolingUnit.toMillis(poolingInterval));
+1185 } catch (InterruptedException e) {
+1186break;
+1187 }
+1188 execution = getExecution(execution.getId());
+1189 }
+1190return execution;
+1191 }
+1192
+1193/*
+1194 * Ad-hoc scripts
+1195 */
+1196
+1197/**
+1198 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
+1199 * script will not be dispatched to nodes, but be executed on the RunDeck server.
+1200 *
+1201 * @param project name of the project - mandatory
+1202 * @param scriptFilename filename of the script to be executed - mandatory
+1203 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+1204 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1205 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1206 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1207 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1208 * @throws IOException if we failed to read the file
+1209 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
+1210 * @see #runAdhocScript(String, String)
+1211 */
+1212publicRundeckExecution triggerAdhocScript(String project, String scriptFilename) throws RundeckApiException,
+1213 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+1214return triggerAdhocScript(project, scriptFilename, null);
+1215 }
+1216
+1217/**
+1218 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
+1219 * script will not be dispatched to nodes, but be executed on the RunDeck server.
+1220 *
+1221 * @param project name of the project - mandatory
+1222 * @param scriptFilename filename of the script to be executed - mandatory
+1223 * @param options of the script - optional. See {@link OptionsBuilder}.
+1224 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+1225 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1226 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1227 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1228 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1229 * @throws IOException if we failed to read the file
+1230 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
+1231 * @see #runAdhocScript(String, String, Properties)
+1232 */
+1233publicRundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options)
+1234throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException,
+1235 IOException {
+1236return triggerAdhocScript(project, scriptFilename, options, null);
+1237 }
+1238
+1239/**
+1240 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
+1241 * script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1242 *
+1243 * @param project name of the project - mandatory
+1244 * @param scriptFilename filename of the script to be executed - mandatory
+1245 * @param options of the script - optional. See {@link OptionsBuilder}.
+1246 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1247 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+1248 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1249 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1250 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1251 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1252 * @throws IOException if we failed to read the file
+1253 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
+1254 * @see #runAdhocScript(String, String, Properties, Properties)
+1255 */
+1256publicRundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options,
+1257 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+1258 IllegalArgumentException, IOException {
+1259return triggerAdhocScript(project, scriptFilename, options, nodeFilters, null, null);
+1260 }
+1261
+1262/**
+1263 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
+1264 * script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1265 *
+1266 * @param project name of the project - mandatory
+1267 * @param scriptFilename filename of the script to be executed - mandatory
+1268 * @param options of the script - optional. See {@link OptionsBuilder}.
+1269 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1270 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1271 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1272 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+1273 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1274 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1275 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1276 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1277 * @throws IOException if we failed to read the file
+1278 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
+1279 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1280 */
+1281publicRundeckExecution triggerAdhocScript(String project, String scriptFilename, Properties options,
+1282 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException,
+1283 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+1284 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to trigger an ad-hoc script !");
+1285 FileInputStream stream = null;
+1286try {
+1287 stream = FileUtils.openInputStream(new File(scriptFilename));
+1288return triggerAdhocScript(project, stream, options, nodeFilters, nodeThreadcount, nodeKeepgoing);
+1289 } finally {
+1290 IOUtils.closeQuietly(stream);
+1291 }
+1292 }
+1293
+1294/**
+1295 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
+1296 * script will not be dispatched to nodes, but be executed on the RunDeck server.
+1297 *
+1298 * @param project name of the project - mandatory
+1299 * @param script inputStream for reading the script to be executed - mandatory
+1300 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+1301 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1302 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1303 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1304 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1305 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
+1306 * @see #runAdhocScript(String, InputStream)
+1307 */
+1308publicRundeckExecution triggerAdhocScript(String project, InputStream script) throws RundeckApiException,
+1309 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1310return triggerAdhocScript(project, script, null);
+1311 }
+1312
+1313/**
+1314 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
+1315 * script will not be dispatched to nodes, but be executed on the RunDeck server.
+1316 *
+1317 * @param project name of the project - mandatory
+1318 * @param script inputStream for reading the script to be executed - mandatory
+1319 * @param options of the script - optional. See {@link OptionsBuilder}.
+1320 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+1321 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1322 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1323 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1324 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1325 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
+1326 * @see #runAdhocScript(String, InputStream, Properties)
+1327 */
+1328publicRundeckExecution triggerAdhocScript(String project, InputStream script, Properties options)
+1329throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1330return triggerAdhocScript(project, script, options, null);
+1331 }
+1332
+1333/**
+1334 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
+1335 * script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1336 *
+1337 * @param project name of the project - mandatory
+1338 * @param script inputStream for reading the script to be executed - mandatory
+1339 * @param options of the script - optional. See {@link OptionsBuilder}.
+1340 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1341 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+1342 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1343 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1344 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1345 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1346 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
+1347 * @see #runAdhocScript(String, InputStream, Properties, Properties)
+1348 */
+1349publicRundeckExecution triggerAdhocScript(String project, InputStream script, Properties options,
+1350 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+1351 IllegalArgumentException {
+1352return triggerAdhocScript(project, script, options, nodeFilters, null, null);
+1353 }
+1354
+1355/**
+1356 * Trigger the execution of an ad-hoc script, and return immediately (without waiting the end of the execution). The
+1357 * script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1358 *
+1359 * @param project name of the project - mandatory
+1360 * @param script inputStream for reading the script to be executed - mandatory
+1361 * @param options of the script - optional. See {@link OptionsBuilder}.
+1362 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder}
+1363 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1364 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1365 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null
+1366 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1367 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1368 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1369 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1370 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
+1371 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1372 */
+1373publicRundeckExecution triggerAdhocScript(String project, InputStream script, Properties options,
+1374 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException,
+1375 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1376 AssertUtil.notBlank(project, "project is mandatory to trigger an ad-hoc script !");
+1377 AssertUtil.notNull(script, "script is mandatory to trigger an ad-hoc script !");
+1378RundeckExecution execution = newApiCall(this).post(newApiPathBuilder("/run/script").param("project", project)
+1379 .attach("scriptFile",
+1380 script)
+1381 .param("argString",
+1382 ParametersUtil.generateArgString(options))
+1383 .param("nodeThreadcount",
+1384 nodeThreadcount)
+1385 .param("nodeKeepgoing",
+1386 nodeKeepgoing)
+1387 .nodeFilters(nodeFilters),
+1388newExecutionParser("result/execution"));
+1389// the first call just returns the ID of the execution, so we need another call to get a "real" execution
+1390return getExecution(execution.getId());
1391 }
13921393/**1394 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck1395 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1396 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1396 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server.1397 * 1398 * @param project name of the project - mandatory1399 * @param scriptFilename filename of the script to be executed - mandatory
-1400 * @param options of the script - optional. See {@link OptionsBuilder}.
-1401 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
-1402 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1403 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1404 * @throws RundeckApiLoginException if the login failed
-1405 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1406 * @throws IOException if we failed to read the file
-1407 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1408 * @see #triggerAdhocScript(String, String, Properties, Properties)
-1409 */
-1410publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
-1411 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException,
-1412 IOException {
-1413return runAdhocScript(project, scriptFilename, options, nodeFilters, null, null);
-1414 }
-1415
-1416/**
-1417 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1418 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1419 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters
-1420 * parameter.
-1421 *
-1422 * @param project name of the project - mandatory
-1423 * @param scriptFilename filename of the script to be executed - mandatory
-1424 * @param options of the script - optional. See {@link OptionsBuilder}.
-1425 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
-1426 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1427 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1428 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1429 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1430 * @throws RundeckApiLoginException if the login failed
-1431 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1432 * @throws IOException if we failed to read the file
-1433 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1434 * @see #triggerAdhocScript(String, String, Properties, Properties)
-1435 */
-1436publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
-1437 Properties nodeFilters, long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException,
-1438 RundeckApiLoginException, IllegalArgumentException, IOException {
-1439return runAdhocScript(project, scriptFilename, options, nodeFilters, null, null, poolingInterval, poolingUnit);
-1440 }
-1441
-1442/**
-1443 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1444 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1445 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1446 *
-1447 * @param project name of the project - mandatory
-1448 * @param scriptFilename filename of the script to be executed - mandatory
-1449 * @param options of the script - optional. See {@link OptionsBuilder}.
-1450 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
-1451 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-1452 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-1453 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1454 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1455 * @throws RundeckApiLoginException if the login failed
-1456 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1457 * @throws IOException if we failed to read the file
-1458 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1459 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
-1460 */
-1461publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
-1462 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException,
-1463 RundeckApiLoginException, IllegalArgumentException, IOException {
-1464return runAdhocScript(project,
-1465 scriptFilename,
-1466 options,
-1467 nodeFilters,
-1468 nodeThreadcount,
-1469 nodeKeepgoing,
-1470 DEFAULT_POOLING_INTERVAL,
-1471 DEFAULT_POOLING_UNIT);
-1472 }
-1473
-1474/**
-1475 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1476 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1477 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters
-1478 * parameter.
-1479 *
-1480 * @param project name of the project - mandatory
-1481 * @param scriptFilename filename of the script to be executed - mandatory
-1482 * @param options of the script - optional. See {@link OptionsBuilder}.
-1483 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
-1484 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-1485 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-1486 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1487 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1488 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1489 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1490 * @throws RundeckApiLoginException if the login failed
-1491 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
-1492 * @throws IOException if we failed to read the file
-1493 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1494 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
-1495 */
-1496publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
-1497 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval,
-1498 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException,
-1499 IOException {
-1500 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to run an ad-hoc script !");
-1501 FileInputStream stream = null;
-1502try {
-1503 stream = FileUtils.openInputStream(new File(scriptFilename));
-1504return runAdhocScript(project,
-1505 stream,
-1506 options,
-1507 nodeFilters,
-1508 nodeThreadcount,
-1509 nodeKeepgoing,
-1510 poolingInterval,
-1511 poolingUnit);
-1512 } finally {
-1513 IOUtils.closeQuietly(stream);
-1514 }
-1515 }
-1516
-1517/**
-1518 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1519 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1520 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server.
-1521 *
-1522 * @param project name of the project - mandatory
-1523 * @param script inputStream for reading the script to be executed - mandatory
+1400 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1401 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1402 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1403 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1404 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1405 * @throws IOException if we failed to read the file
+1406 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1407 * @see #triggerAdhocScript(String, String)
+1408 */
+1409publicRundeckExecution runAdhocScript(String project, String scriptFilename) throws RundeckApiException,
+1410 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+1411return runAdhocScript(project, scriptFilename, null);
+1412 }
+1413
+1414/**
+1415 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1416 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1417 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the
+1418 * RunDeck server.
+1419 *
+1420 * @param project name of the project - mandatory
+1421 * @param scriptFilename filename of the script to be executed - mandatory
+1422 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1423 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1424 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1425 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1426 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1427 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1428 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1429 * @throws IOException if we failed to read the file
+1430 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1431 * @see #triggerAdhocScript(String, String)
+1432 */
+1433publicRundeckExecution runAdhocScript(String project, String scriptFilename, long poolingInterval,
+1434 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+1435 IllegalArgumentException, IOException {
+1436return runAdhocScript(project, scriptFilename, null, poolingInterval, poolingUnit);
+1437 }
+1438
+1439/**
+1440 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1441 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1442 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server.
+1443 *
+1444 * @param project name of the project - mandatory
+1445 * @param scriptFilename filename of the script to be executed - mandatory
+1446 * @param options of the script - optional. See {@link OptionsBuilder}.
+1447 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1448 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1449 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1450 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1451 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1452 * @throws IOException if we failed to read the file
+1453 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1454 * @see #triggerAdhocScript(String, String, Properties)
+1455 */
+1456publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options)
+1457throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException,
+1458 IOException {
+1459return runAdhocScript(project, scriptFilename, options, null);
+1460 }
+1461
+1462/**
+1463 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1464 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1465 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the
+1466 * RunDeck server.
+1467 *
+1468 * @param project name of the project - mandatory
+1469 * @param scriptFilename filename of the script to be executed - mandatory
+1470 * @param options of the script - optional. See {@link OptionsBuilder}.
+1471 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1472 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1473 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1474 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1475 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1476 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1477 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1478 * @throws IOException if we failed to read the file
+1479 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1480 * @see #triggerAdhocScript(String, String, Properties)
+1481 */
+1482publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
+1483long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException,
+1484 RundeckApiTokenException, IllegalArgumentException, IOException {
+1485return runAdhocScript(project, scriptFilename, options, null, poolingInterval, poolingUnit);
+1486 }
+1487
+1488/**
+1489 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1490 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1491 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1492 *
+1493 * @param project name of the project - mandatory
+1494 * @param scriptFilename filename of the script to be executed - mandatory
+1495 * @param options of the script - optional. See {@link OptionsBuilder}.
+1496 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
+1497 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1498 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1499 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1500 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1501 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1502 * @throws IOException if we failed to read the file
+1503 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1504 * @see #triggerAdhocScript(String, String, Properties, Properties)
+1505 */
+1506publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
+1507 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+1508 IllegalArgumentException, IOException {
+1509return runAdhocScript(project, scriptFilename, options, nodeFilters, null, null);
+1510 }
+1511
+1512/**
+1513 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1514 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1515 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters
+1516 * parameter.
+1517 *
+1518 * @param project name of the project - mandatory
+1519 * @param scriptFilename filename of the script to be executed - mandatory
+1520 * @param options of the script - optional. See {@link OptionsBuilder}.
+1521 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
+1522 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1523 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.1524 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null1525 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1526 * @throws RundeckApiLoginException if the login failed
-1527 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1528 * @throws IOException if we failed to read the file
-1529 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1530 * @see #triggerAdhocScript(String, InputStream)
-1531 */
-1532publicRundeckExecution runAdhocScript(String project, InputStream script) throws RundeckApiException,
-1533 RundeckApiLoginException, IllegalArgumentException, IOException {
-1534return runAdhocScript(project, script, null);
-1535 }
-1536
-1537/**
-1538 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1539 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1540 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the
-1541 * RunDeck server.
-1542 *
-1543 * @param project name of the project - mandatory
-1544 * @param script inputStream for reading the script to be executed - mandatory
-1545 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1546 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1547 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1548 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1549 * @throws RundeckApiLoginException if the login failed
-1550 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1551 * @throws IOException if we failed to read the file
-1552 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1553 * @see #triggerAdhocScript(String, InputStream)
-1554 */
-1555publicRundeckExecution runAdhocScript(String project, InputStream script, long poolingInterval,
-1556 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException,
-1557 IOException {
-1558return runAdhocScript(project, script, null, poolingInterval, poolingUnit);
-1559 }
-1560
-1561/**
-1562 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1563 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1564 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server.
-1565 *
-1566 * @param project name of the project - mandatory
-1567 * @param script inputStream for reading the script to be executed - mandatory
-1568 * @param options of the script - optional. See {@link OptionsBuilder}.
-1569 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1570 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1571 * @throws RundeckApiLoginException if the login failed
-1572 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1573 * @throws IOException if we failed to read the file
-1574 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1575 * @see #triggerAdhocScript(String, InputStream, Properties)
-1576 */
-1577publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options)
-1578throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException, IOException {
-1579return runAdhocScript(project, script, options, null);
-1580 }
-1581
-1582/**
-1583 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1584 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1585 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the
-1586 * RunDeck server.
-1587 *
-1588 * @param project name of the project - mandatory
-1589 * @param script inputStream for reading the script to be executed - mandatory
-1590 * @param options of the script - optional. See {@link OptionsBuilder}.
-1591 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1592 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1593 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1594 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1595 * @throws RundeckApiLoginException if the login failed
-1596 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1597 * @throws IOException if we failed to read the file
-1598 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1599 * @see #triggerAdhocScript(String, InputStream, Properties)
-1600 */
-1601publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
-1602long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException,
-1603 IllegalArgumentException, IOException {
-1604return runAdhocScript(project, script, options, null, poolingInterval, poolingUnit);
-1605 }
-1606
-1607/**
-1608 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1609 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1610 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1611 *
-1612 * @param project name of the project - mandatory
-1613 * @param script inputStream for reading the script to be executed - mandatory
-1614 * @param options of the script - optional. See {@link OptionsBuilder}.
-1615 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
-1616 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1617 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1618 * @throws RundeckApiLoginException if the login failed
-1619 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1620 * @throws IOException if we failed to read the file
-1621 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1622 * @see #triggerAdhocScript(String, InputStream, Properties, Properties)
-1623 */
-1624publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
-1625 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException,
-1626 IOException {
-1627return runAdhocScript(project, script, options, nodeFilters, null, null);
-1628 }
-1629
-1630/**
-1631 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1632 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1633 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters
-1634 * parameter.
-1635 *
-1636 * @param project name of the project - mandatory
-1637 * @param script inputStream for reading the script to be executed - mandatory
-1638 * @param options of the script - optional. See {@link OptionsBuilder}.
-1639 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
-1640 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1641 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1642 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1643 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1644 * @throws RundeckApiLoginException if the login failed
-1645 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1646 * @throws IOException if we failed to read the file
-1647 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1648 * @see #triggerAdhocScript(String, InputStream, Properties, Properties)
-1649 */
-1650publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
-1651 Properties nodeFilters, long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException,
-1652 RundeckApiLoginException, IllegalArgumentException, IOException {
-1653return runAdhocScript(project, script, options, nodeFilters, null, null, poolingInterval, poolingUnit);
-1654 }
-1655
-1656/**
-1657 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1658 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
-1659 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter.
-1660 *
-1661 * @param project name of the project - mandatory
-1662 * @param script inputStream for reading the script to be executed - mandatory
-1663 * @param options of the script - optional. See {@link OptionsBuilder}.
-1664 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
-1665 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-1666 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-1667 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1668 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1669 * @throws RundeckApiLoginException if the login failed
-1670 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1671 * @throws IOException if we failed to read the file
-1672 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1673 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
-1674 */
-1675publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
-1676 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException,
-1677 RundeckApiLoginException, IllegalArgumentException, IOException {
-1678return runAdhocScript(project,
-1679 script,
-1680 options,
-1681 nodeFilters,
-1682 nodeThreadcount,
-1683 nodeKeepgoing,
-1684 DEFAULT_POOLING_INTERVAL,
-1685 DEFAULT_POOLING_UNIT);
-1686 }
-1687
-1688/**
-1689 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
-1690 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
-1691 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters
-1692 * parameter.
-1693 *
-1694 * @param project name of the project - mandatory
-1695 * @param script inputStream for reading the script to be executed - mandatory
-1696 * @param options of the script - optional. See {@link OptionsBuilder}.
-1697 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
-1698 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
-1699 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
-1700 * @param poolingInterval for checking the status of the execution. Must be > 0.
-1701 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
-1702 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
-1703 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1704 * @throws RundeckApiLoginException if the login failed
-1705 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
-1706 * @throws IOException if we failed to read the file
-1707 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
-1708 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
-1709 */
-1710publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
-1711 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval,
-1712 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1713if (poolingInterval <= 0) {
-1714 poolingInterval = DEFAULT_POOLING_INTERVAL;
-1715 poolingUnit = DEFAULT_POOLING_UNIT;
-1716 }
-1717if (poolingUnit == null) {
-1718 poolingUnit = DEFAULT_POOLING_UNIT;
-1719 }
-1720
-1721RundeckExecution execution = triggerAdhocScript(project,
-1722 script,
-1723 options,
-1724 nodeFilters,
-1725 nodeThreadcount,
-1726 nodeKeepgoing);
-1727while (ExecutionStatus.RUNNING.equals(execution.getStatus())) {
-1728try {
-1729 Thread.sleep(poolingUnit.toMillis(poolingInterval));
-1730 } catch (InterruptedException e) {
-1731break;
-1732 }
-1733 execution = getExecution(execution.getId());
-1734 }
-1735return execution;
-1736 }
-1737
-1738/*
-1739 * Executions
-1740 */
-1741
-1742/**
-1743 * Get all running executions (for all projects)
-1744 *
-1745 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
-1746 * @throws RundeckApiException in case of error when calling the API
-1747 * @throws RundeckApiLoginException if the login failed
-1748 * @see #getRunningExecutions(String)
-1749 */
-1750public List<RundeckExecution> getRunningExecutions() throws RundeckApiException, RundeckApiLoginException {
-1751 List<RundeckExecution> executions = new ArrayList<RundeckExecution>();
-1752for (RundeckProject project : getProjects()) {
-1753 executions.addAll(getRunningExecutions(project.getName()));
-1754 }
-1755return executions;
-1756 }
-1757
-1758/**
-1759 * Get the running executions for the given project
-1760 *
-1761 * @param project name of the project - mandatory
-1762 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
-1763 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1764 * @throws RundeckApiLoginException if the login failed
-1765 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-1766 * @see #getRunningExecutions()
-1767 */
-1768public List<RundeckExecution> getRunningExecutions(String project) throws RundeckApiException,
-1769 RundeckApiLoginException, IllegalArgumentException {
-1770 AssertUtil.notBlank(project, "project is mandatory get all running executions !");
-1771returnnewApiCall(this).get(newApiPathBuilder("/executions/running").param("project", project),
-1772new ListParser<RundeckExecution>(newExecutionParser(),
-1773"result/executions/execution"));
-1774 }
-1775
-1776/**
-1777 * Get the executions of the given job
-1778 *
-1779 * @param jobId identifier of the job - mandatory
-1780 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
-1781 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-1782 * @throws RundeckApiLoginException if the login failed
-1783 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-1784 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long)
-1785 */
-1786public List<RundeckExecution> getJobExecutions(String jobId) throws RundeckApiException, RundeckApiLoginException,
-1787 IllegalArgumentException {
-1788return getJobExecutions(jobId, (ExecutionStatus) null);
-1789 }
-1790
-1791/**
-1792 * Get the executions of the given job
-1793 *
-1794 * @param jobId identifier of the job - mandatory
-1795 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all)
-1796 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
-1797 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-1798 * @throws RundeckApiLoginException if the login failed
-1799 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is
-1800 * invalid
-1801 * @see #getJobExecutions(String, String, Long, Long)
-1802 */
-1803public List<RundeckExecution> getJobExecutions(String jobId, String status) throws RundeckApiException,
-1804 RundeckApiLoginException, IllegalArgumentException {
-1805return getJobExecutions(jobId,
-1806 StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status)));
-1807 }
-1808
-1809/**
-1810 * Get the executions of the given job
-1811 *
-1812 * @param jobId identifier of the job - mandatory
-1813 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all)
-1814 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
-1815 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-1816 * @throws RundeckApiLoginException if the login failed
-1817 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-1818 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long)
-1819 */
-1820public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status) throws RundeckApiException,
-1821 RundeckApiLoginException, IllegalArgumentException {
-1822return getJobExecutions(jobId, status, null, null);
-1823 }
-1824
-1825/**
-1826 * Get the executions of the given job
-1827 *
-1828 * @param jobId identifier of the job - mandatory
-1829 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all)
-1830 * @param max number of results to return - optional (null for all)
-1831 * @param offset the 0-indexed offset for the first result to return - optional
-1832 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
-1833 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-1834 * @throws RundeckApiLoginException if the login failed
-1835 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is
-1836 * invalid
-1837 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long)
-1838 */
-1839public List<RundeckExecution> getJobExecutions(String jobId, String status, Long max, Long offset)
-1840throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1841return getJobExecutions(jobId,
-1842 StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status)),
-1843 max,
-1844 offset);
+1526 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1527 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1528 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1529 * @throws IOException if we failed to read the file
+1530 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1531 * @see #triggerAdhocScript(String, String, Properties, Properties)
+1532 */
+1533publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
+1534 Properties nodeFilters, long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException,
+1535 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+1536return runAdhocScript(project, scriptFilename, options, nodeFilters, null, null, poolingInterval, poolingUnit);
+1537 }
+1538
+1539/**
+1540 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1541 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1542 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1543 *
+1544 * @param project name of the project - mandatory
+1545 * @param scriptFilename filename of the script to be executed - mandatory
+1546 * @param options of the script - optional. See {@link OptionsBuilder}.
+1547 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
+1548 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1549 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1550 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1551 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1552 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1553 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1554 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1555 * @throws IOException if we failed to read the file
+1556 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1557 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
+1558 */
+1559publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
+1560 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException,
+1561 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+1562return runAdhocScript(project,
+1563 scriptFilename,
+1564 options,
+1565 nodeFilters,
+1566 nodeThreadcount,
+1567 nodeKeepgoing,
+1568 DEFAULT_POOLING_INTERVAL,
+1569 DEFAULT_POOLING_UNIT);
+1570 }
+1571
+1572/**
+1573 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1574 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1575 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters
+1576 * parameter.
+1577 *
+1578 * @param project name of the project - mandatory
+1579 * @param scriptFilename filename of the script to be executed - mandatory
+1580 * @param options of the script - optional. See {@link OptionsBuilder}.
+1581 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
+1582 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1583 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1584 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1585 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1586 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1587 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1588 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1589 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1590 * @throws IllegalArgumentException if the project or scriptFilename is blank (null, empty or whitespace)
+1591 * @throws IOException if we failed to read the file
+1592 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1593 * @see #triggerAdhocScript(String, String, Properties, Properties, Integer, Boolean)
+1594 */
+1595publicRundeckExecution runAdhocScript(String project, String scriptFilename, Properties options,
+1596 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval,
+1597 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+1598 IllegalArgumentException, IOException {
+1599 AssertUtil.notBlank(scriptFilename, "scriptFilename is mandatory to run an ad-hoc script !");
+1600 FileInputStream stream = null;
+1601try {
+1602 stream = FileUtils.openInputStream(new File(scriptFilename));
+1603return runAdhocScript(project,
+1604 stream,
+1605 options,
+1606 nodeFilters,
+1607 nodeThreadcount,
+1608 nodeKeepgoing,
+1609 poolingInterval,
+1610 poolingUnit);
+1611 } finally {
+1612 IOUtils.closeQuietly(stream);
+1613 }
+1614 }
+1615
+1616/**
+1617 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1618 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1619 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server.
+1620 *
+1621 * @param project name of the project - mandatory
+1622 * @param script inputStream for reading the script to be executed - mandatory
+1623 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1624 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1625 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1626 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1627 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1628 * @throws IOException if we failed to read the file
+1629 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1630 * @see #triggerAdhocScript(String, InputStream)
+1631 */
+1632publicRundeckExecution runAdhocScript(String project, InputStream script) throws RundeckApiException,
+1633 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+1634return runAdhocScript(project, script, null);
+1635 }
+1636
+1637/**
+1638 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1639 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1640 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the
+1641 * RunDeck server.
+1642 *
+1643 * @param project name of the project - mandatory
+1644 * @param script inputStream for reading the script to be executed - mandatory
+1645 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1646 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1647 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1648 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1649 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1650 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1651 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1652 * @throws IOException if we failed to read the file
+1653 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1654 * @see #triggerAdhocScript(String, InputStream)
+1655 */
+1656publicRundeckExecution runAdhocScript(String project, InputStream script, long poolingInterval,
+1657 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+1658 IllegalArgumentException, IOException {
+1659return runAdhocScript(project, script, null, poolingInterval, poolingUnit);
+1660 }
+1661
+1662/**
+1663 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1664 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1665 * running. The script will not be dispatched to nodes, but be executed on the RunDeck server.
+1666 *
+1667 * @param project name of the project - mandatory
+1668 * @param script inputStream for reading the script to be executed - mandatory
+1669 * @param options of the script - optional. See {@link OptionsBuilder}.
+1670 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1671 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1672 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1673 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1674 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1675 * @throws IOException if we failed to read the file
+1676 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1677 * @see #triggerAdhocScript(String, InputStream, Properties)
+1678 */
+1679publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options)
+1680throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException,
+1681 IOException {
+1682return runAdhocScript(project, script, options, null);
+1683 }
+1684
+1685/**
+1686 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1687 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1688 * finished (or aborted) or is still running. The script will not be dispatched to nodes, but be executed on the
+1689 * RunDeck server.
+1690 *
+1691 * @param project name of the project - mandatory
+1692 * @param script inputStream for reading the script to be executed - mandatory
+1693 * @param options of the script - optional. See {@link OptionsBuilder}.
+1694 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1695 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1696 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1697 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1698 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1699 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1700 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1701 * @throws IOException if we failed to read the file
+1702 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1703 * @see #triggerAdhocScript(String, InputStream, Properties)
+1704 */
+1705publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
+1706long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException,
+1707 RundeckApiTokenException, IllegalArgumentException, IOException {
+1708return runAdhocScript(project, script, options, null, poolingInterval, poolingUnit);
+1709 }
+1710
+1711/**
+1712 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1713 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1714 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1715 *
+1716 * @param project name of the project - mandatory
+1717 * @param script inputStream for reading the script to be executed - mandatory
+1718 * @param options of the script - optional. See {@link OptionsBuilder}.
+1719 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
+1720 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1721 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1722 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1723 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1724 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1725 * @throws IOException if we failed to read the file
+1726 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1727 * @see #triggerAdhocScript(String, InputStream, Properties, Properties)
+1728 */
+1729publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
+1730 Properties nodeFilters) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+1731 IllegalArgumentException, IOException {
+1732return runAdhocScript(project, script, options, nodeFilters, null, null);
+1733 }
+1734
+1735/**
+1736 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1737 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1738 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters
+1739 * parameter.
+1740 *
+1741 * @param project name of the project - mandatory
+1742 * @param script inputStream for reading the script to be executed - mandatory
+1743 * @param options of the script - optional. See {@link OptionsBuilder}.
+1744 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
+1745 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1746 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1747 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1748 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1749 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1750 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1751 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1752 * @throws IOException if we failed to read the file
+1753 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1754 * @see #triggerAdhocScript(String, InputStream, Properties, Properties)
+1755 */
+1756publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
+1757 Properties nodeFilters, long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException,
+1758 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+1759return runAdhocScript(project, script, options, nodeFilters, null, null, poolingInterval, poolingUnit);
+1760 }
+1761
+1762/**
+1763 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1764 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still
+1765 * running. The script will be dispatched to nodes, accordingly to the nodeFilters parameter.
+1766 *
+1767 * @param project name of the project - mandatory
+1768 * @param script inputStream for reading the script to be executed - mandatory
+1769 * @param options of the script - optional. See {@link OptionsBuilder}.
+1770 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
+1771 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1772 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1773 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1774 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1775 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1776 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1777 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1778 * @throws IOException if we failed to read the file
+1779 * @see #runAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1780 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
+1781 */
+1782publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
+1783 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing) throws RundeckApiException,
+1784 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException {
+1785return runAdhocScript(project,
+1786 script,
+1787 options,
+1788 nodeFilters,
+1789 nodeThreadcount,
+1790 nodeKeepgoing,
+1791 DEFAULT_POOLING_INTERVAL,
+1792 DEFAULT_POOLING_UNIT);
+1793 }
+1794
+1795/**
+1796 * Run an ad-hoc script, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck
+1797 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is
+1798 * finished (or aborted) or is still running. The script will be dispatched to nodes, accordingly to the nodeFilters
+1799 * parameter.
+1800 *
+1801 * @param project name of the project - mandatory
+1802 * @param script inputStream for reading the script to be executed - mandatory
+1803 * @param options of the script - optional. See {@link OptionsBuilder}.
+1804 * @param nodeFilters for selecting nodes on which the script will be executed. See {@link NodeFiltersBuilder}
+1805 * @param nodeThreadcount thread count to use (for parallelizing when running on multiple nodes) - optional
+1806 * @param nodeKeepgoing if true, continue executing on other nodes even if some fail - optional
+1807 * @param poolingInterval for checking the status of the execution. Must be > 0.
+1808 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds.
+1809 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null
+1810 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1811 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1812 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1813 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) or the script is null
+1814 * @throws IOException if we failed to read the file
+1815 * @see #runAdhocScript(String, String, Properties, Properties, Integer, Boolean, long, TimeUnit)
+1816 * @see #triggerAdhocScript(String, InputStream, Properties, Properties, Integer, Boolean)
+1817 */
+1818publicRundeckExecution runAdhocScript(String project, InputStream script, Properties options,
+1819 Properties nodeFilters, Integer nodeThreadcount, Boolean nodeKeepgoing, long poolingInterval,
+1820 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException,
+1821 IllegalArgumentException {
+1822if (poolingInterval <= 0) {
+1823 poolingInterval = DEFAULT_POOLING_INTERVAL;
+1824 poolingUnit = DEFAULT_POOLING_UNIT;
+1825 }
+1826if (poolingUnit == null) {
+1827 poolingUnit = DEFAULT_POOLING_UNIT;
+1828 }
+1829
+1830RundeckExecution execution = triggerAdhocScript(project,
+1831 script,
+1832 options,
+1833 nodeFilters,
+1834 nodeThreadcount,
+1835 nodeKeepgoing);
+1836while (ExecutionStatus.RUNNING.equals(execution.getStatus())) {
+1837try {
+1838 Thread.sleep(poolingUnit.toMillis(poolingInterval));
+1839 } catch (InterruptedException e) {
+1840break;
+1841 }
+1842 execution = getExecution(execution.getId());
+1843 }
+1844return execution;
1845 }
1846
-1847/**
-1848 * Get the executions of the given job
-1849 *
-1850 * @param jobId identifier of the job - mandatory
-1851 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all)
-1852 * @param max number of results to return - optional (null for all)
-1853 * @param offset the 0-indexed offset for the first result to return - optional
+1847/*
+1848 * Executions
+1849 */
+1850
+1851/**
+1852 * Get all running executions (for all projects)
+1853 * 1854 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
-1855 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
-1856 * @throws RundeckApiLoginException if the login failed
-1857 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
-1858 */
-1859public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status, Long max, Long offset)
-1860throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1861 AssertUtil.notBlank(jobId, "jobId is mandatory to get the executions of a job !");
-1862returnnewApiCall(this).get(newApiPathBuilder("/job/", jobId, "/executions").param("status", status)
-1863 .param("max", max)
-1864 .param("offset", offset),
-1865new ListParser<RundeckExecution>(newExecutionParser(),
-1866"result/executions/execution"));
+1855 * @throws RundeckApiException in case of error when calling the API
+1856 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1857 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1858 * @see #getRunningExecutions(String)
+1859 */
+1860public List<RundeckExecution> getRunningExecutions() throws RundeckApiException, RundeckApiLoginException,
+1861RundeckApiTokenException {
+1862 List<RundeckExecution> executions = new ArrayList<RundeckExecution>();
+1863for (RundeckProject project : getProjects()) {
+1864 executions.addAll(getRunningExecutions(project.getName()));
+1865 }
+1866return executions;
1867 }
18681869/**
-1870 * Get a single execution, identified by the given ID
+1870 * Get the running executions for the given project1871 *
-1872 * @param executionId identifier of the execution - mandatory
-1873 * @return a {@link RundeckExecution} instance - won't be null
-1874 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID)
-1875 * @throws RundeckApiLoginException if the login failed
-1876 * @throws IllegalArgumentException if the executionId is null
-1877 */
-1878publicRundeckExecution getExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException,
-1879 IllegalArgumentException {
-1880 AssertUtil.notNull(executionId, "executionId is mandatory to get the details of an execution !");
-1881returnnewApiCall(this).get(newApiPathBuilder("/execution/", executionId.toString()),
-1882newExecutionParser("result/executions/execution"));
-1883 }
-1884
-1885/**
-1886 * Abort an execution (identified by the given ID). The execution should be running...
-1887 *
-1888 * @param executionId identifier of the execution - mandatory
-1889 * @return a {@link RundeckAbort} instance - won't be null
-1890 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID)
-1891 * @throws RundeckApiLoginException if the login failed
-1892 * @throws IllegalArgumentException if the executionId is null
-1893 */
-1894publicRundeckAbort abortExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException,
-1895 IllegalArgumentException {
-1896 AssertUtil.notNull(executionId, "executionId is mandatory to abort an execution !");
-1897returnnewApiCall(this).get(newApiPathBuilder("/execution/", executionId.toString(), "/abort"),
-1898newAbortParser("result/abort"));
-1899 }
-1900
-1901/*
-1902 * History
-1903 */
-1904
-1905/**
-1906 * Get the (events) history for the given project
-1907 *
-1908 * @param project name of the project - mandatory
-1909 * @return a {@link RundeckHistory} instance - won't be null
-1910 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1911 * @throws RundeckApiLoginException if the login failed
-1912 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-1913 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
-1914 */
-1915publicRundeckHistory getHistory(String project) throws RundeckApiException, RundeckApiLoginException,
-1916 IllegalArgumentException {
-1917return getHistory(project, null, null, null, null, null, null, null, null);
-1918 }
-1919
-1920/**
-1921 * Get the (events) history for the given project
-1922 *
-1923 * @param project name of the project - mandatory
-1924 * @param max number of results to return - optional (default to 20)
-1925 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
-1926 * @return a {@link RundeckHistory} instance - won't be null
-1927 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1928 * @throws RundeckApiLoginException if the login failed
-1929 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-1930 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
-1931 */
-1932publicRundeckHistory getHistory(String project, Long max, Long offset) throws RundeckApiException,
-1933 RundeckApiLoginException, IllegalArgumentException {
-1934return getHistory(project, null, null, null, null, null, null, max, offset);
-1935 }
-1936
-1937/**
-1938 * Get the (events) history for the given project
-1939 *
-1940 * @param project name of the project - mandatory
-1941 * @param jobId include only events matching the given job ID - optional
-1942 * @param reportId include only events matching the given report ID - optional
-1943 * @param user include only events created by the given user - optional
-1944 * @return a {@link RundeckHistory} instance - won't be null
-1945 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1946 * @throws RundeckApiLoginException if the login failed
-1947 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-1948 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
-1949 */
-1950publicRundeckHistory getHistory(String project, String jobId, String reportId, String user)
-1951throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1952return getHistory(project, jobId, reportId, user, null, null, null, null, null);
-1953 }
-1954
-1955/**
-1956 * Get the (events) history for the given project
-1957 *
-1958 * @param project name of the project - mandatory
-1959 * @param jobId include only events matching the given job ID - optional
-1960 * @param reportId include only events matching the given report ID - optional
-1961 * @param user include only events created by the given user - optional
-1962 * @param max number of results to return - optional (default to 20)
-1963 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
-1964 * @return a {@link RundeckHistory} instance - won't be null
-1965 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1966 * @throws RundeckApiLoginException if the login failed
-1967 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-1968 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
-1969 */
-1970publicRundeckHistory getHistory(String project, String jobId, String reportId, String user, Long max, Long offset)
-1971throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-1972return getHistory(project, jobId, reportId, user, null, null, null, max, offset);
-1973 }
-1974
-1975/**
-1976 * Get the (events) history for the given project
-1977 *
-1978 * @param project name of the project - mandatory
-1979 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y
-1980 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2
-1981 * weeks), "5d" (= last 5 days), etc. Optional.
-1982 * @return a {@link RundeckHistory} instance - won't be null
-1983 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-1984 * @throws RundeckApiLoginException if the login failed
-1985 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-1986 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
-1987 */
-1988publicRundeckHistory getHistory(String project, String recent) throws RundeckApiException,
-1989 RundeckApiLoginException, IllegalArgumentException {
-1990return getHistory(project, null, null, null, recent, null, null, null, null);
-1991 }
-1992
-1993/**
-1994 * Get the (events) history for the given project
-1995 *
-1996 * @param project name of the project - mandatory
-1997 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y
-1998 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2
-1999 * weeks), "5d" (= last 5 days), etc. Optional.
-2000 * @param max number of results to return - optional (default to 20)
-2001 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
-2002 * @return a {@link RundeckHistory} instance - won't be null
-2003 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-2004 * @throws RundeckApiLoginException if the login failed
-2005 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-2006 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
-2007 */
-2008publicRundeckHistory getHistory(String project, String recent, Long max, Long offset) throws RundeckApiException,
-2009 RundeckApiLoginException, IllegalArgumentException {
-2010return getHistory(project, null, null, null, recent, null, null, max, offset);
-2011 }
-2012
-2013/**
-2014 * Get the (events) history for the given project
-2015 *
-2016 * @param project name of the project - mandatory
-2017 * @param begin date for the earlier events to retrieve - optional
-2018 * @param end date for the latest events to retrieve - optional
-2019 * @return a {@link RundeckHistory} instance - won't be null
-2020 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-2021 * @throws RundeckApiLoginException if the login failed
-2022 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-2023 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
-2024 */
-2025publicRundeckHistory getHistory(String project, Date begin, Date end) throws RundeckApiException,
-2026 RundeckApiLoginException, IllegalArgumentException {
-2027return getHistory(project, null, null, null, null, begin, end, null, null);
-2028 }
-2029
-2030/**
-2031 * Get the (events) history for the given project
-2032 *
-2033 * @param project name of the project - mandatory
-2034 * @param begin date for the earlier events to retrieve - optional
-2035 * @param end date for the latest events to retrieve - optional
-2036 * @param max number of results to return - optional (default to 20)
-2037 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
-2038 * @return a {@link RundeckHistory} instance - won't be null
-2039 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-2040 * @throws RundeckApiLoginException if the login failed
-2041 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-2042 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
-2043 */
-2044publicRundeckHistory getHistory(String project, Date begin, Date end, Long max, Long offset)
-2045throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException {
-2046return getHistory(project, null, null, null, null, begin, end, max, offset);
-2047 }
-2048
-2049/**
-2050 * Get the (events) history for the given project
-2051 *
-2052 * @param project name of the project - mandatory
-2053 * @param jobId include only events matching the given job ID - optional
-2054 * @param reportId include only events matching the given report ID - optional
-2055 * @param user include only events created by the given user - optional
-2056 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y
-2057 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2
-2058 * weeks), "5d" (= last 5 days), etc. Optional.
-2059 * @param begin date for the earlier events to retrieve - optional
-2060 * @param end date for the latest events to retrieve - optional
-2061 * @param max number of results to return - optional (default to 20)
-2062 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
-2063 * @return a {@link RundeckHistory} instance - won't be null
-2064 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-2065 * @throws RundeckApiLoginException if the login failed
-2066 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-2067 */
-2068publicRundeckHistory getHistory(String project, String jobId, String reportId, String user, String recent,
-2069 Date begin, Date end, Long max, Long offset) throws RundeckApiException, RundeckApiLoginException,
-2070 IllegalArgumentException {
-2071 AssertUtil.notBlank(project, "project is mandatory to get the history !");
-2072returnnewApiCall(this).get(newApiPathBuilder("/history").param("project", project)
-2073 .param("jobIdFilter", jobId)
-2074 .param("reportIdFilter", reportId)
-2075 .param("userFilter", user)
-2076 .param("recentFilter", recent)
-2077 .param("begin", begin)
-2078 .param("end", end)
-2079 .param("max", max)
-2080 .param("offset", offset),
-2081newHistoryParser("result/events"));
-2082 }
-2083
-2084/*
-2085 * Nodes
-2086 */
-2087
-2088/**
-2089 * List all nodes (for all projects)
-2090 *
-2091 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null
-2092 * @throws RundeckApiException in case of error when calling the API
-2093 * @throws RundeckApiLoginException if the login failed
-2094 */
-2095public List<RundeckNode> getNodes() throws RundeckApiException, RundeckApiLoginException {
-2096 List<RundeckNode> nodes = new ArrayList<RundeckNode>();
-2097for (RundeckProject project : getProjects()) {
-2098 nodes.addAll(getNodes(project.getName()));
-2099 }
-2100return nodes;
-2101 }
-2102
-2103/**
-2104 * List all nodes that belongs to the given project
-2105 *
-2106 * @param project name of the project - mandatory
-2107 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null
-2108 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-2109 * @throws RundeckApiLoginException if the login failed
-2110 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-2111 * @see #getNodes(String, Properties)
-2112 */
-2113public List<RundeckNode> getNodes(String project) throws RundeckApiException, RundeckApiLoginException,
-2114 IllegalArgumentException {
-2115return getNodes(project, null);
-2116 }
-2117
-2118/**
-2119 * List nodes that belongs to the given project
-2120 *
-2121 * @param project name of the project - mandatory
-2122 * @param nodeFilters for filtering the nodes - optional. See {@link NodeFiltersBuilder}
-2123 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null
-2124 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
-2125 * @throws RundeckApiLoginException if the login failed
-2126 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
-2127 */
-2128public List<RundeckNode> getNodes(String project, Properties nodeFilters) throws RundeckApiException,
-2129 RundeckApiLoginException, IllegalArgumentException {
-2130 AssertUtil.notBlank(project, "project is mandatory to get all nodes !");
-2131returnnewApiCall(this).get(newApiPathBuilder("/resources").param("project", project)
-2132 .nodeFilters(nodeFilters),
-2133new ListParser<RundeckNode>(newNodeParser(), "project/node"));
-2134 }
-2135
-2136/**
-2137 * Get the definition of a single node
-2138 *
-2139 * @param name of the node - mandatory
-2140 * @param project name of the project - mandatory
-2141 * @return a {@link RundeckNode} instance - won't be null
-2142 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name)
-2143 * @throws RundeckApiLoginException if the login failed
-2144 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace)
-2145 */
-2146publicRundeckNode getNode(String name, String project) throws RundeckApiException, RundeckApiLoginException,
-2147 IllegalArgumentException {
-2148 AssertUtil.notBlank(name, "the name of the node is mandatory to get a node !");
-2149 AssertUtil.notBlank(project, "project is mandatory to get a node !");
-2150returnnewApiCall(this).get(newApiPathBuilder("/resource/", name).param("project", project),
-2151newNodeParser("project/node"));
-2152 }
-2153
-2154/*
-2155 * System Info
-2156 */
-2157
-2158/**
-2159 * Get system informations about the RunDeck server
-2160 *
-2161 * @return a {@link RundeckSystemInfo} instance - won't be null
-2162 * @throws RundeckApiException in case of error when calling the API
-2163 * @throws RundeckApiException if the login failed
-2164 */
-2165publicRundeckSystemInfo getSystemInfo() throws RundeckApiException, RundeckApiLoginException {
-2166returnnewApiCall(this).get(newApiPathBuilder("/system/info"), newSystemInfoParser("result/system"));
-2167 }
-2168
-2169/**
-2170 * @return the URL of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc)
-2171 */
-2172public String getUrl() {
-2173return url;
+1872 * @param project name of the project - mandatory
+1873 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
+1874 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+1875 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1876 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1877 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+1878 * @see #getRunningExecutions()
+1879 */
+1880public List<RundeckExecution> getRunningExecutions(String project) throws RundeckApiException,
+1881 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1882 AssertUtil.notBlank(project, "project is mandatory get all running executions !");
+1883returnnewApiCall(this).get(newApiPathBuilder("/executions/running").param("project", project),
+1884new ListParser<RundeckExecution>(newExecutionParser(),
+1885"result/executions/execution"));
+1886 }
+1887
+1888/**
+1889 * Get the executions of the given job
+1890 *
+1891 * @param jobId identifier of the job - mandatory
+1892 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
+1893 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+1894 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1895 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1896 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+1897 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long)
+1898 */
+1899public List<RundeckExecution> getJobExecutions(String jobId) throws RundeckApiException, RundeckApiLoginException,
+1900 RundeckApiTokenException, IllegalArgumentException {
+1901return getJobExecutions(jobId, (ExecutionStatus) null);
+1902 }
+1903
+1904/**
+1905 * Get the executions of the given job
+1906 *
+1907 * @param jobId identifier of the job - mandatory
+1908 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all)
+1909 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
+1910 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+1911 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1912 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1913 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is
+1914 * invalid
+1915 * @see #getJobExecutions(String, String, Long, Long)
+1916 */
+1917public List<RundeckExecution> getJobExecutions(String jobId, String status) throws RundeckApiException,
+1918 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1919return getJobExecutions(jobId,
+1920 StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status)));
+1921 }
+1922
+1923/**
+1924 * Get the executions of the given job
+1925 *
+1926 * @param jobId identifier of the job - mandatory
+1927 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all)
+1928 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
+1929 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+1930 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1931 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1932 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+1933 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long)
+1934 */
+1935public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status) throws RundeckApiException,
+1936 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1937return getJobExecutions(jobId, status, null, null);
+1938 }
+1939
+1940/**
+1941 * Get the executions of the given job
+1942 *
+1943 * @param jobId identifier of the job - mandatory
+1944 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all)
+1945 * @param max number of results to return - optional (null for all)
+1946 * @param offset the 0-indexed offset for the first result to return - optional
+1947 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
+1948 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+1949 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1950 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1951 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is
+1952 * invalid
+1953 * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long)
+1954 */
+1955public List<RundeckExecution> getJobExecutions(String jobId, String status, Long max, Long offset)
+1956throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1957return getJobExecutions(jobId,
+1958 StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status)),
+1959 max,
+1960 offset);
+1961 }
+1962
+1963/**
+1964 * Get the executions of the given job
+1965 *
+1966 * @param jobId identifier of the job - mandatory
+1967 * @param status of the executions, see {@link ExecutionStatus} - optional (null for all)
+1968 * @param max number of results to return - optional (null for all)
+1969 * @param offset the 0-indexed offset for the first result to return - optional
+1970 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null
+1971 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID)
+1972 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1973 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1974 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace)
+1975 */
+1976public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status, Long max, Long offset)
+1977throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+1978 AssertUtil.notBlank(jobId, "jobId is mandatory to get the executions of a job !");
+1979returnnewApiCall(this).get(newApiPathBuilder("/job/", jobId, "/executions").param("status", status)
+1980 .param("max", max)
+1981 .param("offset", offset),
+1982new ListParser<RundeckExecution>(newExecutionParser(),
+1983"result/executions/execution"));
+1984 }
+1985
+1986/**
+1987 * Get a single execution, identified by the given ID
+1988 *
+1989 * @param executionId identifier of the execution - mandatory
+1990 * @return a {@link RundeckExecution} instance - won't be null
+1991 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID)
+1992 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+1993 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+1994 * @throws IllegalArgumentException if the executionId is null
+1995 */
+1996publicRundeckExecution getExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException,
+1997 RundeckApiTokenException, IllegalArgumentException {
+1998 AssertUtil.notNull(executionId, "executionId is mandatory to get the details of an execution !");
+1999returnnewApiCall(this).get(newApiPathBuilder("/execution/", executionId.toString()),
+2000newExecutionParser("result/executions/execution"));
+2001 }
+2002
+2003/**
+2004 * Abort an execution (identified by the given ID). The execution should be running...
+2005 *
+2006 * @param executionId identifier of the execution - mandatory
+2007 * @return a {@link RundeckAbort} instance - won't be null
+2008 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID)
+2009 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2010 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2011 * @throws IllegalArgumentException if the executionId is null
+2012 */
+2013publicRundeckAbort abortExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException,
+2014 RundeckApiTokenException, IllegalArgumentException {
+2015 AssertUtil.notNull(executionId, "executionId is mandatory to abort an execution !");
+2016returnnewApiCall(this).get(newApiPathBuilder("/execution/", executionId.toString(), "/abort"),
+2017newAbortParser("result/abort"));
+2018 }
+2019
+2020/*
+2021 * History
+2022 */
+2023
+2024/**
+2025 * Get the (events) history for the given project
+2026 *
+2027 * @param project name of the project - mandatory
+2028 * @return a {@link RundeckHistory} instance - won't be null
+2029 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2030 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2031 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2032 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2033 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
+2034 */
+2035publicRundeckHistory getHistory(String project) throws RundeckApiException, RundeckApiLoginException,
+2036 RundeckApiTokenException, IllegalArgumentException {
+2037return getHistory(project, null, null, null, null, null, null, null, null);
+2038 }
+2039
+2040/**
+2041 * Get the (events) history for the given project
+2042 *
+2043 * @param project name of the project - mandatory
+2044 * @param max number of results to return - optional (default to 20)
+2045 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
+2046 * @return a {@link RundeckHistory} instance - won't be null
+2047 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2048 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2049 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2050 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2051 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
+2052 */
+2053publicRundeckHistory getHistory(String project, Long max, Long offset) throws RundeckApiException,
+2054 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+2055return getHistory(project, null, null, null, null, null, null, max, offset);
+2056 }
+2057
+2058/**
+2059 * Get the (events) history for the given project
+2060 *
+2061 * @param project name of the project - mandatory
+2062 * @param jobId include only events matching the given job ID - optional
+2063 * @param reportId include only events matching the given report ID - optional
+2064 * @param user include only events created by the given user - optional
+2065 * @return a {@link RundeckHistory} instance - won't be null
+2066 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2067 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2068 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2069 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2070 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
+2071 */
+2072publicRundeckHistory getHistory(String project, String jobId, String reportId, String user)
+2073throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+2074return getHistory(project, jobId, reportId, user, null, null, null, null, null);
+2075 }
+2076
+2077/**
+2078 * Get the (events) history for the given project
+2079 *
+2080 * @param project name of the project - mandatory
+2081 * @param jobId include only events matching the given job ID - optional
+2082 * @param reportId include only events matching the given report ID - optional
+2083 * @param user include only events created by the given user - optional
+2084 * @param max number of results to return - optional (default to 20)
+2085 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
+2086 * @return a {@link RundeckHistory} instance - won't be null
+2087 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2088 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2089 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2090 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2091 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
+2092 */
+2093publicRundeckHistory getHistory(String project, String jobId, String reportId, String user, Long max, Long offset)
+2094throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+2095return getHistory(project, jobId, reportId, user, null, null, null, max, offset);
+2096 }
+2097
+2098/**
+2099 * Get the (events) history for the given project
+2100 *
+2101 * @param project name of the project - mandatory
+2102 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y
+2103 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2
+2104 * weeks), "5d" (= last 5 days), etc. Optional.
+2105 * @return a {@link RundeckHistory} instance - won't be null
+2106 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2107 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2108 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2109 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2110 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
+2111 */
+2112publicRundeckHistory getHistory(String project, String recent) throws RundeckApiException,
+2113 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+2114return getHistory(project, null, null, null, recent, null, null, null, null);
+2115 }
+2116
+2117/**
+2118 * Get the (events) history for the given project
+2119 *
+2120 * @param project name of the project - mandatory
+2121 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y
+2122 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2
+2123 * weeks), "5d" (= last 5 days), etc. Optional.
+2124 * @param max number of results to return - optional (default to 20)
+2125 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
+2126 * @return a {@link RundeckHistory} instance - won't be null
+2127 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2128 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2129 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2130 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2131 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
+2132 */
+2133publicRundeckHistory getHistory(String project, String recent, Long max, Long offset) throws RundeckApiException,
+2134 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+2135return getHistory(project, null, null, null, recent, null, null, max, offset);
+2136 }
+2137
+2138/**
+2139 * Get the (events) history for the given project
+2140 *
+2141 * @param project name of the project - mandatory
+2142 * @param begin date for the earlier events to retrieve - optional
+2143 * @param end date for the latest events to retrieve - optional
+2144 * @return a {@link RundeckHistory} instance - won't be null
+2145 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2146 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2147 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2148 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2149 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
+2150 */
+2151publicRundeckHistory getHistory(String project, Date begin, Date end) throws RundeckApiException,
+2152 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+2153return getHistory(project, null, null, null, null, begin, end, null, null);
+2154 }
+2155
+2156/**
+2157 * Get the (events) history for the given project
+2158 *
+2159 * @param project name of the project - mandatory
+2160 * @param begin date for the earlier events to retrieve - optional
+2161 * @param end date for the latest events to retrieve - optional
+2162 * @param max number of results to return - optional (default to 20)
+2163 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
+2164 * @return a {@link RundeckHistory} instance - won't be null
+2165 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2166 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2167 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2168 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2169 * @see #getHistory(String, String, String, String, String, Date, Date, Long, Long)
+2170 */
+2171publicRundeckHistory getHistory(String project, Date begin, Date end, Long max, Long offset)
+2172throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+2173return getHistory(project, null, null, null, null, begin, end, max, offset);
2174 }
21752176/**
-2177 * @return the login used for authentication on the RunDeck instance
-2178 */
-2179public String getLogin() {
-2180return login;
-2181 }
-2182
-2183/**
-2184 * @return the password used for authentication on the RunDeck instance
-2185 */
-2186public String getPassword() {
-2187return password;
-2188 }
-2189
-2190 @Override
-2191public String toString() {
-2192return"RundeckClient " + API_VERSION + " [" + url + "] (credentials=" + login + "|" + password + ")";
-2193 }
-2194
-2195 @Override
-2196publicint hashCode() {
-2197finalint prime = 31;
-2198int result = 1;
-2199 result = prime * result + ((login == null) ? 0 : login.hashCode());
-2200 result = prime * result + ((password == null) ? 0 : password.hashCode());
-2201 result = prime * result + ((url == null) ? 0 : url.hashCode());
-2202return result;
-2203 }
-2204
-2205 @Override
-2206publicboolean equals(Object obj) {
-2207if (this == obj)
-2208returntrue;
-2209if (obj == null)
-2210return false;
-2211if (getClass() != obj.getClass())
-2212return false;
-2213RundeckClient other = (RundeckClient) obj;
-2214if (login == null) {
-2215if (other.login != null)
-2216return false;
-2217 } elseif (!login.equals(other.login))
-2218return false;
-2219if (password == null) {
-2220if (other.password != null)
-2221return false;
-2222 } elseif (!password.equals(other.password))
-2223return false;
-2224if (url == null) {
-2225if (other.url != null)
-2226return false;
-2227 } elseif (!url.equals(other.url))
-2228return false;
-2229returntrue;
+2177 * Get the (events) history for the given project
+2178 *
+2179 * @param project name of the project - mandatory
+2180 * @param jobId include only events matching the given job ID - optional
+2181 * @param reportId include only events matching the given report ID - optional
+2182 * @param user include only events created by the given user - optional
+2183 * @param recent include only events matching the given period of time. Format : "XY", where X is an integer, and Y
+2184 * is one of : "h" (hour), "d" (day), "w" (week), "m" (month), "y" (year). Example : "2w" (= last 2
+2185 * weeks), "5d" (= last 5 days), etc. Optional.
+2186 * @param begin date for the earlier events to retrieve - optional
+2187 * @param end date for the latest events to retrieve - optional
+2188 * @param max number of results to return - optional (default to 20)
+2189 * @param offset the 0-indexed offset for the first result to return - optional (default to O)
+2190 * @return a {@link RundeckHistory} instance - won't be null
+2191 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2192 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2193 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2194 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2195 */
+2196publicRundeckHistory getHistory(String project, String jobId, String reportId, String user, String recent,
+2197 Date begin, Date end, Long max, Long offset) throws RundeckApiException, RundeckApiLoginException,
+2198 RundeckApiTokenException, IllegalArgumentException {
+2199 AssertUtil.notBlank(project, "project is mandatory to get the history !");
+2200returnnewApiCall(this).get(newApiPathBuilder("/history").param("project", project)
+2201 .param("jobIdFilter", jobId)
+2202 .param("reportIdFilter", reportId)
+2203 .param("userFilter", user)
+2204 .param("recentFilter", recent)
+2205 .param("begin", begin)
+2206 .param("end", end)
+2207 .param("max", max)
+2208 .param("offset", offset),
+2209newHistoryParser("result/events"));
+2210 }
+2211
+2212/*
+2213 * Nodes
+2214 */
+2215
+2216/**
+2217 * List all nodes (for all projects)
+2218 *
+2219 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null
+2220 * @throws RundeckApiException in case of error when calling the API
+2221 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2222 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2223 */
+2224public List<RundeckNode> getNodes() throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException {
+2225 List<RundeckNode> nodes = new ArrayList<RundeckNode>();
+2226for (RundeckProject project : getProjects()) {
+2227 nodes.addAll(getNodes(project.getName()));
+2228 }
+2229return nodes;
2230 }
2231
-2232 }
+2232/**
+2233 * List all nodes that belongs to the given project
+2234 *
+2235 * @param project name of the project - mandatory
+2236 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null
+2237 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2238 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2239 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2240 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2241 * @see #getNodes(String, Properties)
+2242 */
+2243public List<RundeckNode> getNodes(String project) throws RundeckApiException, RundeckApiLoginException,
+2244 RundeckApiTokenException, IllegalArgumentException {
+2245return getNodes(project, null);
+2246 }
+2247
+2248/**
+2249 * List nodes that belongs to the given project
+2250 *
+2251 * @param project name of the project - mandatory
+2252 * @param nodeFilters for filtering the nodes - optional. See {@link NodeFiltersBuilder}
+2253 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null
+2254 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name)
+2255 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2256 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2257 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace)
+2258 */
+2259public List<RundeckNode> getNodes(String project, Properties nodeFilters) throws RundeckApiException,
+2260 RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException {
+2261 AssertUtil.notBlank(project, "project is mandatory to get all nodes !");
+2262returnnewApiCall(this).get(newApiPathBuilder("/resources").param("project", project)
+2263 .nodeFilters(nodeFilters),
+2264new ListParser<RundeckNode>(newNodeParser(), "project/node"));
+2265 }
+2266
+2267/**
+2268 * Get the definition of a single node
+2269 *
+2270 * @param name of the node - mandatory
+2271 * @param project name of the project - mandatory
+2272 * @return a {@link RundeckNode} instance - won't be null
+2273 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name)
+2274 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2275 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2276 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace)
+2277 */
+2278publicRundeckNode getNode(String name, String project) throws RundeckApiException, RundeckApiLoginException,
+2279 RundeckApiTokenException, IllegalArgumentException {
+2280 AssertUtil.notBlank(name, "the name of the node is mandatory to get a node !");
+2281 AssertUtil.notBlank(project, "project is mandatory to get a node !");
+2282returnnewApiCall(this).get(newApiPathBuilder("/resource/", name).param("project", project),
+2283newNodeParser("project/node"));
+2284 }
+2285
+2286/*
+2287 * System Info
+2288 */
+2289
+2290/**
+2291 * Get system informations about the RunDeck server
+2292 *
+2293 * @return a {@link RundeckSystemInfo} instance - won't be null
+2294 * @throws RundeckApiException in case of error when calling the API
+2295 * @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
+2296 * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
+2297 */
+2298publicRundeckSystemInfo getSystemInfo() throws RundeckApiException, RundeckApiLoginException,
+2299RundeckApiTokenException {
+2300returnnewApiCall(this).get(newApiPathBuilder("/system/info"), newSystemInfoParser("result/system"));
+2301 }
+2302
+2303/**
+2304 * @return the URL of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc)
+2305 */
+2306public String getUrl() {
+2307return url;
+2308 }
+2309
+2310/**
+2311 * @return the auth-token used for authentication on the RunDeck instance (null if using login-based auth)
+2312 */
+2313public String getToken() {
+2314return token;
+2315 }
+2316
+2317/**
+2318 * @return the login used for authentication on the RunDeck instance (null if using token-based auth)
+2319 */
+2320public String getLogin() {
+2321return login;
+2322 }
+2323
+2324/**
+2325 * @return the password used for authentication on the RunDeck instance (null if using token-based auth)
+2326 */
+2327public String getPassword() {
+2328return password;
+2329 }
+2330
+2331 @Override
+2332public String toString() {
+2333 StringBuilder str = new StringBuilder();
+2334 str.append("RundeckClient ").append(API_VERSION);
+2335 str.append(" [").append(url).append("] ");
+2336if (token != null) {
+2337 str.append("(token=").append(token).append(")");
+2338 } else {
+2339 str.append("(credentials=").append(login).append("|").append(password).append(")");
+2340 }
+2341return str.toString();
+2342 }
+2343
+2344 @Override
+2345publicint hashCode() {
+2346finalint prime = 31;
+2347int result = 1;
+2348 result = prime * result + ((login == null) ? 0 : login.hashCode());
+2349 result = prime * result + ((password == null) ? 0 : password.hashCode());
+2350 result = prime * result + ((token == null) ? 0 : token.hashCode());
+2351 result = prime * result + ((url == null) ? 0 : url.hashCode());
+2352return result;
+2353 }
+2354
+2355 @Override
+2356publicboolean equals(Object obj) {
+2357if (this == obj)
+2358returntrue;
+2359if (obj == null)
+2360return false;
+2361if (getClass() != obj.getClass())
+2362return false;
+2363RundeckClient other = (RundeckClient) obj;
+2364if (login == null) {
+2365if (other.login != null)
+2366return false;
+2367 } elseif (!login.equals(other.login))
+2368return false;
+2369if (password == null) {
+2370if (other.password != null)
+2371return false;
+2372 } elseif (!password.equals(other.password))
+2373return false;
+2374if (token == null) {
+2375if (other.token != null)
+2376return false;
+2377 } elseif (!token.equals(other.token))
+2378return false;
+2379if (url == null) {
+2380if (other.url != null)
+2381return false;
+2382 } elseif (!url.equals(other.url))
+2383return false;
+2384returntrue;
+2385 }
+2386
+2387 }
diff --git a/xref/org/rundeck/api/domain/package-frame.html b/xref/org/rundeck/api/domain/package-frame.html
index 0f94162..f969bea 100644
--- a/xref/org/rundeck/api/domain/package-frame.html
+++ b/xref/org/rundeck/api/domain/package-frame.html
@@ -3,7 +3,7 @@
- RunDeck API - Java Client 1.2 Reference Package org.rundeck.api.domain
+ RunDeck API - Java Client 2.0-SNAPSHOT Reference Package org.rundeck.api.domain
diff --git a/xref/org/rundeck/api/domain/package-summary.html b/xref/org/rundeck/api/domain/package-summary.html
index f048f52..b72597f 100644
--- a/xref/org/rundeck/api/domain/package-summary.html
+++ b/xref/org/rundeck/api/domain/package-summary.html
@@ -3,7 +3,7 @@
- RunDeck API - Java Client 1.2 Reference Package org.rundeck.api.domain
+ RunDeck API - Java Client 2.0-SNAPSHOT Reference Package org.rundeck.api.domain
diff --git a/xref/org/rundeck/api/package-frame.html b/xref/org/rundeck/api/package-frame.html
index 41279b5..3db2354 100644
--- a/xref/org/rundeck/api/package-frame.html
+++ b/xref/org/rundeck/api/package-frame.html
@@ -3,7 +3,7 @@
- RunDeck API - Java Client 1.2 Reference Package org.rundeck.api
+ RunDeck API - Java Client 2.0-SNAPSHOT Reference Package org.rundeck.api
@@ -29,12 +29,18 @@