From ed782f19c5c51e2b76775acafb4e92a0bc68f3c9 Mon Sep 17 00:00:00 2001 From: Vincent Behar Date: Thu, 7 Jul 2011 23:09:49 +0200 Subject: [PATCH] Wagon: Deploying site to repository --- apidocs/allclasses-frame.html | 6 +- apidocs/allclasses-noframe.html | 6 +- apidocs/constant-values.html | 4 +- apidocs/deprecated-list.html | 4 +- apidocs/help-doc.html | 4 +- apidocs/index-all.html | 48 +- apidocs/index.html | 2 +- .../org/rundeck/api/NodeFiltersBuilder.html | 4 +- apidocs/org/rundeck/api/OptionsBuilder.html | 4 +- ...ApiException.RundeckApiLoginException.html | 4 +- .../org/rundeck/api/RundeckApiException.html | 4 +- apidocs/org/rundeck/api/RundeckClient.html | 190 +- .../api/class-use/NodeFiltersBuilder.html | 4 +- .../rundeck/api/class-use/OptionsBuilder.html | 4 +- ...ApiException.RundeckApiLoginException.html | 54 +- .../api/class-use/RundeckApiException.html | 62 +- .../rundeck/api/class-use/RundeckClient.html | 4 +- .../api/domain/RundeckAbort.AbortStatus.html | 4 +- .../org/rundeck/api/domain/RundeckAbort.html | 4 +- .../RundeckExecution.ExecutionStatus.html | 4 +- .../rundeck/api/domain/RundeckExecution.html | 52 +- .../org/rundeck/api/domain/RundeckJob.html | 4 +- .../org/rundeck/api/domain/RundeckNode.html | 4 +- .../rundeck/api/domain/RundeckProject.html | 4 +- .../class-use/RundeckAbort.AbortStatus.html | 4 +- .../api/domain/class-use/RundeckAbort.html | 4 +- .../RundeckExecution.ExecutionStatus.html | 4 +- .../domain/class-use/RundeckExecution.html | 4 +- .../api/domain/class-use/RundeckJob.html | 4 +- .../api/domain/class-use/RundeckNode.html | 4 +- .../api/domain/class-use/RundeckProject.html | 4 +- .../org/rundeck/api/domain/package-frame.html | 4 +- .../rundeck/api/domain/package-summary.html | 4 +- .../org/rundeck/api/domain/package-tree.html | 4 +- .../org/rundeck/api/domain/package-use.html | 4 +- apidocs/org/rundeck/api/package-frame.html | 4 +- apidocs/org/rundeck/api/package-summary.html | 4 +- apidocs/org/rundeck/api/package-tree.html | 4 +- apidocs/org/rundeck/api/package-use.html | 4 +- .../org/rundeck/api/parser/AbortParser.html | 4 +- .../rundeck/api/parser/ExecutionParser.html | 4 +- apidocs/org/rundeck/api/parser/JobParser.html | 4 +- .../org/rundeck/api/parser/ListParser.html | 4 +- .../org/rundeck/api/parser/NodeParser.html | 4 +- .../org/rundeck/api/parser/ParserHelper.html | 31 +- .../org/rundeck/api/parser/ProjectParser.html | 8 +- .../org/rundeck/api/parser/StringParser.html | 287 +++ .../org/rundeck/api/parser/XmlNodeParser.html | 10 +- .../api/parser/class-use/AbortParser.html | 4 +- .../api/parser/class-use/ExecutionParser.html | 4 +- .../api/parser/class-use/JobParser.html | 4 +- .../api/parser/class-use/ListParser.html | 4 +- .../api/parser/class-use/NodeParser.html | 4 +- .../api/parser/class-use/ParserHelper.html | 4 +- .../api/parser/class-use/ProjectParser.html | 4 +- .../api/parser/class-use/StringParser.html | 145 ++ .../api/parser/class-use/XmlNodeParser.html | 12 +- .../org/rundeck/api/parser/package-frame.html | 8 +- .../rundeck/api/parser/package-summary.html | 8 +- .../org/rundeck/api/parser/package-tree.html | 5 +- .../org/rundeck/api/parser/package-use.html | 4 +- apidocs/org/rundeck/api/util/AssertUtil.html | 4 +- .../org/rundeck/api/util/ParametersUtil.html | 4 +- .../api/util/class-use/AssertUtil.html | 4 +- .../api/util/class-use/ParametersUtil.html | 4 +- .../org/rundeck/api/util/package-frame.html | 4 +- .../org/rundeck/api/util/package-summary.html | 4 +- .../org/rundeck/api/util/package-tree.html | 4 +- apidocs/org/rundeck/api/util/package-use.html | 4 +- apidocs/overview-frame.html | 4 +- apidocs/overview-summary.html | 4 +- apidocs/overview-tree.html | 5 +- apidocs/serialized-form.html | 4 +- changes-report.html | 6 +- cpd.html | 6 +- dependencies.html | 20 +- dependency-updates-report.html | 8 +- distribution-management.html | 6 +- download.html | 8 +- faq.html | 8 +- findbugs.html | 8 +- groovy.html | 12 +- index.html | 8 +- issue-tracking.html | 6 +- jruby.html | 14 +- jython.html | 12 +- license.html | 6 +- mail-lists.html | 6 +- plugin-updates-report.html | 6 +- pmd.html | 6 +- pmd.xml | 2 +- project-info.html | 6 +- project-reports.html | 6 +- project-summary.html | 6 +- property-updates-report.html | 6 +- scripting.html | 8 +- source-repository.html | 6 +- taglist.html | 6 +- team-list.html | 6 +- testapidocs/allclasses-frame.html | 6 +- testapidocs/allclasses-noframe.html | 6 +- testapidocs/constant-values.html | 4 +- testapidocs/deprecated-list.html | 4 +- testapidocs/help-doc.html | 4 +- testapidocs/index-all.html | 19 +- testapidocs/index.html | 2 +- .../rundeck/api/parser/AbortParserTest.html | 4 +- .../api/parser/ExecutionParserTest.html | 4 +- .../org/rundeck/api/parser/JobParserTest.html | 4 +- .../rundeck/api/parser/ListParserTest.html | 4 +- .../rundeck/api/parser/NodeParserTest.html | 4 +- .../rundeck/api/parser/ParserHelperTest.html | 4 +- .../rundeck/api/parser/ProjectParserTest.html | 8 +- .../rundeck/api/parser/StringParserTest.html | 264 +++ .../api/parser/class-use/AbortParserTest.html | 4 +- .../parser/class-use/ExecutionParserTest.html | 4 +- .../api/parser/class-use/JobParserTest.html | 4 +- .../api/parser/class-use/ListParserTest.html | 4 +- .../api/parser/class-use/NodeParserTest.html | 4 +- .../parser/class-use/ParserHelperTest.html | 4 +- .../parser/class-use/ProjectParserTest.html | 4 +- .../parser/class-use/StringParserTest.html | 145 ++ .../org/rundeck/api/parser/package-frame.html | 8 +- .../rundeck/api/parser/package-summary.html | 8 +- .../org/rundeck/api/parser/package-tree.html | 6 +- .../org/rundeck/api/parser/package-use.html | 4 +- .../rundeck/api/util/ParametersUtilTest.html | 4 +- .../util/class-use/ParametersUtilTest.html | 4 +- .../org/rundeck/api/util/package-frame.html | 4 +- .../org/rundeck/api/util/package-summary.html | 4 +- .../org/rundeck/api/util/package-tree.html | 4 +- .../org/rundeck/api/util/package-use.html | 4 +- testapidocs/overview-frame.html | 4 +- testapidocs/overview-summary.html | 4 +- testapidocs/overview-tree.html | 6 +- xref-test/allclasses-frame.html | 3 + .../rundeck/api/parser/StringParserTest.html | 54 + .../org/rundeck/api/parser/package-frame.html | 3 + .../rundeck/api/parser/package-summary.html | 5 + xref/allclasses-frame.html | 3 + xref/org/rundeck/api/ApiCall.html | 528 +++--- xref/org/rundeck/api/RundeckClient.html | 1638 +++++++++-------- .../rundeck/api/domain/RundeckExecution.html | 451 ++--- xref/org/rundeck/api/parser/ParserHelper.html | 115 +- xref/org/rundeck/api/parser/StringParser.html | 63 + .../org/rundeck/api/parser/package-frame.html | 3 + .../rundeck/api/parser/package-summary.html | 5 + 147 files changed, 3180 insertions(+), 1626 deletions(-) create mode 100644 apidocs/org/rundeck/api/parser/StringParser.html create mode 100644 apidocs/org/rundeck/api/parser/class-use/StringParser.html create mode 100644 testapidocs/org/rundeck/api/parser/StringParserTest.html create mode 100644 testapidocs/org/rundeck/api/parser/class-use/StringParserTest.html create mode 100644 xref-test/org/rundeck/api/parser/StringParserTest.html create mode 100644 xref/org/rundeck/api/parser/StringParser.html diff --git a/apidocs/allclasses-frame.html b/apidocs/allclasses-frame.html index be545d9..130d96d 100644 --- a/apidocs/allclasses-frame.html +++ b/apidocs/allclasses-frame.html @@ -2,13 +2,13 @@ - + All Classes (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -64,6 +64,8 @@ All Classes (RunDeck API - Java Client 1.0-SNAPSHOT API)
RundeckProject
+StringParser +
XmlNodeParser
diff --git a/apidocs/allclasses-noframe.html b/apidocs/allclasses-noframe.html index 8896e93..cc28270 100644 --- a/apidocs/allclasses-noframe.html +++ b/apidocs/allclasses-noframe.html @@ -2,13 +2,13 @@ - + All Classes (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -64,6 +64,8 @@ All Classes (RunDeck API - Java Client 1.0-SNAPSHOT API)
RundeckProject
+StringParser +
XmlNodeParser
diff --git a/apidocs/constant-values.html b/apidocs/constant-values.html index e896b28..e100987 100644 --- a/apidocs/constant-values.html +++ b/apidocs/constant-values.html @@ -2,13 +2,13 @@ - + Constant Field Values (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/deprecated-list.html b/apidocs/deprecated-list.html index 3e7fc31..f5bdc7c 100644 --- a/apidocs/deprecated-list.html +++ b/apidocs/deprecated-list.html @@ -2,13 +2,13 @@ - + Deprecated List (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/help-doc.html b/apidocs/help-doc.html index d0ef445..a076f1f 100644 --- a/apidocs/help-doc.html +++ b/apidocs/help-doc.html @@ -2,13 +2,13 @@ - + API Help (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/index-all.html b/apidocs/index-all.html index 044d16a..fe6d55d 100644 --- a/apidocs/index-all.html +++ b/apidocs/index-all.html @@ -2,13 +2,13 @@ - + Index (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -79,7 +79,7 @@ function windowTitle() -A E F G H J L N O P R S T U V X
+A D E F G H J L N O P R S T U V X

A

@@ -106,6 +106,14 @@ Constructor for class org.rundeck.api.util.

+D

+
+
deleteJob(String) - +Method in class org.rundeck.api.RundeckClient +
Delete a single job, identified by the given ID +
+

E

@@ -160,6 +168,20 @@ Constructor for class org.rundeck.api.parser.ExecutionParser(String) - Constructor for class org.rundeck.api.parser.ExecutionParser
  +
exportJobs(String) - +Method in class org.rundeck.api.RundeckClient +
Export the definitions of all jobs that belongs to the given project +
exportJobs(String, String, String, String...) - +Method in class org.rundeck.api.RundeckClient +
Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, + groupPath and jobIds) +
exportJobsToFile(String, String) - +Method in class org.rundeck.api.RundeckClient +
Export the definitions of all jobs that belongs to the given project, as an XML file +
exportJobsToFile(String, String, String, String, String...) - +Method in class org.rundeck.api.RundeckClient +
Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, + groupPath and jobIds), as an XML file

@@ -194,6 +216,9 @@ Method in class org.rundeck.api.domain.getDescription() - Method in class org.rundeck.api.domain.RundeckProject
  +
getDuration() - +Method in class org.rundeck.api.domain.RundeckExecution +
 
getDurationInMillis() - Method in class org.rundeck.api.domain.RundeckExecution
  @@ -308,6 +333,9 @@ Method in class org.rundeck.api.getRunningExecutions(String) - Method in class org.rundeck.api.RundeckClient
Get the running executions for the given project +
getShortDuration() - +Method in class org.rundeck.api.domain.RundeckExecution +
 
getStartedAt() - Method in class org.rundeck.api.domain.RundeckExecution
  @@ -380,9 +408,6 @@ Constructor for class org.rundeck.api.parser.ListParser<T> - Class in org.rundeck.api.parser
Parser for a List of elements
ListParser(XmlNodeParser<T>, String) - Constructor for class org.rundeck.api.parser.ListParser
  -
loadDocument(HttpResponse) - -Static method in class org.rundeck.api.parser.ParserHelper -
Load an XML Document from the given RunDeck HttpResponse.
loadDocument(InputStream) - Static method in class org.rundeck.api.parser.ParserHelper
Load an XML Document from the given InputStream @@ -458,6 +483,9 @@ Method in class org.rundeck.api.parser.parseXmlNode(Node) - Method in class org.rundeck.api.parser.ProjectParser
  +
parseXmlNode(Node) - +Method in class org.rundeck.api.parser.StringParser +
 
parseXmlNode(Node) - Method in interface org.rundeck.api.parser.XmlNodeParser
Parse the given XML Node @@ -627,6 +655,12 @@ Method in class org.rundeck.api.domain.setUsername(String) - Method in class org.rundeck.api.domain.RundeckNode
  +
StringParser - Class in org.rundeck.api.parser
Parser for a single String
StringParser() - +Constructor for class org.rundeck.api.parser.StringParser +
  +
StringParser(String) - +Constructor for class org.rundeck.api.parser.StringParser +
 


@@ -717,7 +751,7 @@ the order they are declared.
XmlNodeParser<T> - Interface in org.rundeck.api.parser
Interface to be implemented for parsers that handle XML Nodes

-A E F G H J L N O P R S T U V X +A D E F G H J L N O P R S T U V X diff --git a/apidocs/index.html b/apidocs/index.html index 9cffa03..db95028 100644 --- a/apidocs/index.html +++ b/apidocs/index.html @@ -2,7 +2,7 @@ - + RunDeck API - Java Client 1.0-SNAPSHOT API diff --git a/apidocs/org/rundeck/api/NodeFiltersBuilder.html b/apidocs/org/rundeck/api/NodeFiltersBuilder.html index af01d48..b85fb21 100644 --- a/apidocs/org/rundeck/api/NodeFiltersBuilder.html +++ b/apidocs/org/rundeck/api/NodeFiltersBuilder.html @@ -2,13 +2,13 @@ <!--NewPage--> <HTML> <HEAD> -<!-- Generated by javadoc (build 1.6.0_24) on Wed Jul 06 22:59:35 CEST 2011 --> +<!-- Generated by javadoc (build 1.6.0_24) on Thu Jul 07 23:06:51 CEST 2011 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> NodeFiltersBuilder (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/OptionsBuilder.html b/apidocs/org/rundeck/api/OptionsBuilder.html index 220eeb1..d678791 100644 --- a/apidocs/org/rundeck/api/OptionsBuilder.html +++ b/apidocs/org/rundeck/api/OptionsBuilder.html @@ -2,13 +2,13 @@ - + OptionsBuilder (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/RundeckApiException.RundeckApiLoginException.html b/apidocs/org/rundeck/api/RundeckApiException.RundeckApiLoginException.html index 763a13d..257dc64 100644 --- a/apidocs/org/rundeck/api/RundeckApiException.RundeckApiLoginException.html +++ b/apidocs/org/rundeck/api/RundeckApiException.RundeckApiLoginException.html @@ -2,13 +2,13 @@ - + RundeckApiException.RundeckApiLoginException (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/RundeckApiException.html b/apidocs/org/rundeck/api/RundeckApiException.html index 0b5cba1..8ac02d8 100644 --- a/apidocs/org/rundeck/api/RundeckApiException.html +++ b/apidocs/org/rundeck/api/RundeckApiException.html @@ -2,13 +2,13 @@ - + RundeckApiException (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/RundeckClient.html b/apidocs/org/rundeck/api/RundeckClient.html index e13ef85..eb45cb0 100644 --- a/apidocs/org/rundeck/api/RundeckClient.html +++ b/apidocs/org/rundeck/api/RundeckClient.html @@ -2,13 +2,13 @@ - + RundeckClient (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -191,6 +191,14 @@ Main entry point to talk to a RunDeck instance.
+ String +deleteJob(String jobId) + +
+          Delete a single job, identified by the given ID + + +  boolean equals(Object obj) @@ -199,6 +207,48 @@ Main entry point to talk to a RunDeck instance.
+ InputStream +exportJobs(String project) + +
+          Export the definitions of all jobs that belongs to the given project + + + + InputStream +exportJobs(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 +exportJobsToFile(String filename, + String project) + +
+          Export the definitions of all jobs that belongs to the given project, as an XML file + + + + void +exportJobsToFile(String filename, + 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), as an XML file + + +  RundeckJob findJob(String project, String groupPath, @@ -776,6 +826,118 @@ public

+exportJobsToFile

+
+public void exportJobsToFile(String filename,
+                             String project)
+                      throws RundeckApiException,
+                             RundeckApiException.RundeckApiLoginException,
+                             IllegalArgumentException,
+                             IOException
+
+
Export the definitions of all jobs that belongs to the given project, as an XML file +

+

+
+
+
+
Parameters:
filename - path of the file where the content should be saved
project - name of the project - mandatory +
Throws: +
RundeckApiException - in case of error when calling the API (non-existent project with this name) +
RundeckApiException.RundeckApiLoginException - if the login failed +
IllegalArgumentException - if the project is blank (null, empty or whitespace) +
IOException - if we failed to write to the file
See Also:
exportJobsToFile(String, String, String, String, String...), +exportJobs(String)
+
+
+
+ +

+exportJobsToFile

+
+public void exportJobsToFile(String filename,
+                             String project,
+                             String jobFilter,
+                             String groupPath,
+                             String... jobIds)
+                      throws RundeckApiException,
+                             RundeckApiException.RundeckApiLoginException,
+                             IllegalArgumentException,
+                             IOException
+
+
Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, + groupPath and jobIds), as an XML file +

+

+
+
+
+
Parameters:
filename - path of the file where the content should be saved
project - name of the project - mandatory
jobFilter - a filter for the job Name - optional
groupPath - a group or partial group path to include all jobs within that group path - optional
jobIds - a list of Job IDs to include - optional +
Throws: +
RundeckApiException - in case of error when calling the API (non-existent project with this name) +
RundeckApiException.RundeckApiLoginException - if the login failed +
IllegalArgumentException - if the project is blank (null, empty or whitespace) +
IOException - if we failed to write to the file
See Also:
exportJobsToFile(String, String), +exportJobs(String, String, String, String...)
+
+
+
+ +

+exportJobs

+
+public InputStream exportJobs(String project)
+                       throws RundeckApiException,
+                              RundeckApiException.RundeckApiLoginException,
+                              IllegalArgumentException
+
+
Export the definitions of all jobs that belongs to the given project +

+

+
+
+
+
Parameters:
project - name of the project - mandatory +
Returns:
an 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) +
RundeckApiException.RundeckApiLoginException - if the login failed +
IllegalArgumentException - if the project is blank (null, empty or whitespace)
See Also:
exportJobs(String, String, String, String...), +exportJobsToFile(String, String)
+
+
+
+ +

+exportJobs

+
+public InputStream exportJobs(String project,
+                              String jobFilter,
+                              String groupPath,
+                              String... jobIds)
+                       throws RundeckApiException,
+                              RundeckApiException.RundeckApiLoginException,
+                              IllegalArgumentException
+
+
Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, + groupPath and jobIds) +

+

+
+
+
+
Parameters:
project - name of the project - mandatory
jobFilter - a filter for the job Name - optional
groupPath - a group or partial group path to include all jobs within that group path - optional
jobIds - a list of Job IDs to include - optional +
Returns:
an 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) +
RundeckApiException.RundeckApiLoginException - if the login failed +
IllegalArgumentException - if the project is blank (null, empty or whitespace)
See Also:
exportJobs(String), +exportJobsToFile(String, String, String, String, String...)
+
+
+
+

findJob

@@ -827,6 +989,30 @@ public 

+deleteJob

+
+public String deleteJob(String jobId)
+                 throws RundeckApiException,
+                        RundeckApiException.RundeckApiLoginException,
+                        IllegalArgumentException
+
+
Delete a single job, identified by the given ID +

+

+
+
+
+
Parameters:
jobId - identifier of the job - mandatory +
Returns:
the success message (note that in case of error, you'll get an exception) +
Throws: +
RundeckApiException - in case of error when calling the API (non-existent job with this ID) +
RundeckApiException.RundeckApiLoginException - if the login failed +
IllegalArgumentException - if the jobId is blank (null, empty or whitespace)
+
+
+
+

triggerJob

diff --git a/apidocs/org/rundeck/api/class-use/NodeFiltersBuilder.html b/apidocs/org/rundeck/api/class-use/NodeFiltersBuilder.html
index 37066d6..05e0ba6 100644
--- a/apidocs/org/rundeck/api/class-use/NodeFiltersBuilder.html
+++ b/apidocs/org/rundeck/api/class-use/NodeFiltersBuilder.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.NodeFiltersBuilder (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/class-use/OptionsBuilder.html b/apidocs/org/rundeck/api/class-use/OptionsBuilder.html
index 0381394..25d0c3b 100644
--- a/apidocs/org/rundeck/api/class-use/OptionsBuilder.html
+++ b/apidocs/org/rundeck/api/class-use/OptionsBuilder.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.OptionsBuilder (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/class-use/RundeckApiException.RundeckApiLoginException.html b/apidocs/org/rundeck/api/class-use/RundeckApiException.RundeckApiLoginException.html
index 788b8af..d1e15f4 100644
--- a/apidocs/org/rundeck/api/class-use/RundeckApiException.RundeckApiLoginException.html
+++ b/apidocs/org/rundeck/api/class-use/RundeckApiException.RundeckApiLoginException.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.RundeckApiException.RundeckApiLoginException (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
@@ -121,6 +121,56 @@ Uses of 
 
+ String
+RundeckClient.deleteJob(String jobId)
+
+
+          Delete a single job, identified by the given ID + + + + InputStream +RundeckClient.exportJobs(String project) + +
+          Export the definitions of all jobs that belongs to the given project + + + + InputStream +RundeckClient.exportJobs(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 project) + +
+          Export the definitions of all jobs that belongs to the given project, as an XML file + + + + void +RundeckClient.exportJobsToFile(String filename, + 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), as an XML file + + +  RundeckJob RundeckClient.findJob(String project, String groupPath, diff --git a/apidocs/org/rundeck/api/class-use/RundeckApiException.html b/apidocs/org/rundeck/api/class-use/RundeckApiException.html index 9553ac1..efb0ce6 100644 --- a/apidocs/org/rundeck/api/class-use/RundeckApiException.html +++ b/apidocs/org/rundeck/api/class-use/RundeckApiException.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.RundeckApiException (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -141,6 +141,56 @@ Uses of + String +RundeckClient.deleteJob(String jobId) + +
+          Delete a single job, identified by the given ID + + + + InputStream +RundeckClient.exportJobs(String project) + +
+          Export the definitions of all jobs that belongs to the given project + + + + InputStream +RundeckClient.exportJobs(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 project) + +
+          Export the definitions of all jobs that belongs to the given project, as an XML file + + + + void +RundeckClient.exportJobsToFile(String filename, + 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), as an XML file + + +  RundeckJob RundeckClient.findJob(String project, String groupPath, @@ -455,14 +505,6 @@ Uses of static org.dom4j.Document -ParserHelper.loadDocument(org.apache.http.HttpResponse httpResponse) - -
-          Load an XML Document from the given RunDeck HttpResponse. - - - -static org.dom4j.Document ParserHelper.loadDocument(InputStream inputStream)
diff --git a/apidocs/org/rundeck/api/class-use/RundeckClient.html b/apidocs/org/rundeck/api/class-use/RundeckClient.html index 111bf37..da0da06 100644 --- a/apidocs/org/rundeck/api/class-use/RundeckClient.html +++ b/apidocs/org/rundeck/api/class-use/RundeckClient.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.RundeckClient (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/domain/RundeckAbort.AbortStatus.html b/apidocs/org/rundeck/api/domain/RundeckAbort.AbortStatus.html index 5d433ce..5219038 100644 --- a/apidocs/org/rundeck/api/domain/RundeckAbort.AbortStatus.html +++ b/apidocs/org/rundeck/api/domain/RundeckAbort.AbortStatus.html @@ -2,13 +2,13 @@ - + RundeckAbort.AbortStatus (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/domain/RundeckAbort.html b/apidocs/org/rundeck/api/domain/RundeckAbort.html index 3044ba4..fe5ee88 100644 --- a/apidocs/org/rundeck/api/domain/RundeckAbort.html +++ b/apidocs/org/rundeck/api/domain/RundeckAbort.html @@ -2,13 +2,13 @@ - + RundeckAbort (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html b/apidocs/org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html index 6c519e1..fbb50a5 100644 --- a/apidocs/org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html +++ b/apidocs/org/rundeck/api/domain/RundeckExecution.ExecutionStatus.html @@ -2,13 +2,13 @@ - + RundeckExecution.ExecutionStatus (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/domain/RundeckExecution.html b/apidocs/org/rundeck/api/domain/RundeckExecution.html index 7b0e42e..68bed64 100644 --- a/apidocs/org/rundeck/api/domain/RundeckExecution.html +++ b/apidocs/org/rundeck/api/domain/RundeckExecution.html @@ -2,13 +2,13 @@ - + RundeckExecution (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -180,6 +180,14 @@ Represents a RunDeck execution, usually triggered by an API call. An execution c  String getDescription() +
+            + + + + String +getDuration() +
            @@ -220,6 +228,14 @@ Represents a RunDeck execution, usually triggered by an API call. An execution c  RundeckJob getJob() +
+            + + + + String +getShortDuration() +
            @@ -414,6 +430,38 @@ public

+getDuration

+
+public String getDuration()
+
+
+
+
+
+ +
Returns:
the duration of the execution, as a human-readable string : "3 minutes 34 seconds" (or null if the + duration is still running, or has been aborted)
+
+
+
+ +

+getShortDuration

+
+public String getShortDuration()
+
+
+
+
+
+ +
Returns:
the duration of the execution, as a "short" human-readable string : "0:03:34.187" (or null if the + duration is still running, or has been aborted)
+
+
+
+

getId

diff --git a/apidocs/org/rundeck/api/domain/RundeckJob.html b/apidocs/org/rundeck/api/domain/RundeckJob.html
index eaa2bfa..4a32503 100644
--- a/apidocs/org/rundeck/api/domain/RundeckJob.html
+++ b/apidocs/org/rundeck/api/domain/RundeckJob.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 RundeckJob (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/RundeckNode.html b/apidocs/org/rundeck/api/domain/RundeckNode.html
index 10dca61..7ce462d 100644
--- a/apidocs/org/rundeck/api/domain/RundeckNode.html
+++ b/apidocs/org/rundeck/api/domain/RundeckNode.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 RundeckNode (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/RundeckProject.html b/apidocs/org/rundeck/api/domain/RundeckProject.html
index cbabba0..8f88d2d 100644
--- a/apidocs/org/rundeck/api/domain/RundeckProject.html
+++ b/apidocs/org/rundeck/api/domain/RundeckProject.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 RundeckProject (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/class-use/RundeckAbort.AbortStatus.html b/apidocs/org/rundeck/api/domain/class-use/RundeckAbort.AbortStatus.html
index c99bb80..698bd10 100644
--- a/apidocs/org/rundeck/api/domain/class-use/RundeckAbort.AbortStatus.html
+++ b/apidocs/org/rundeck/api/domain/class-use/RundeckAbort.AbortStatus.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.domain.RundeckAbort.AbortStatus (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/class-use/RundeckAbort.html b/apidocs/org/rundeck/api/domain/class-use/RundeckAbort.html
index 833a70b..515923e 100644
--- a/apidocs/org/rundeck/api/domain/class-use/RundeckAbort.html
+++ b/apidocs/org/rundeck/api/domain/class-use/RundeckAbort.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.domain.RundeckAbort (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/class-use/RundeckExecution.ExecutionStatus.html b/apidocs/org/rundeck/api/domain/class-use/RundeckExecution.ExecutionStatus.html
index c43adb0..95abe39 100644
--- a/apidocs/org/rundeck/api/domain/class-use/RundeckExecution.ExecutionStatus.html
+++ b/apidocs/org/rundeck/api/domain/class-use/RundeckExecution.ExecutionStatus.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.domain.RundeckExecution.ExecutionStatus (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/class-use/RundeckExecution.html b/apidocs/org/rundeck/api/domain/class-use/RundeckExecution.html
index 80b158a..3f0bfee 100644
--- a/apidocs/org/rundeck/api/domain/class-use/RundeckExecution.html
+++ b/apidocs/org/rundeck/api/domain/class-use/RundeckExecution.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.domain.RundeckExecution (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/class-use/RundeckJob.html b/apidocs/org/rundeck/api/domain/class-use/RundeckJob.html
index 01a333d..3da8b4e 100644
--- a/apidocs/org/rundeck/api/domain/class-use/RundeckJob.html
+++ b/apidocs/org/rundeck/api/domain/class-use/RundeckJob.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.domain.RundeckJob (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/class-use/RundeckNode.html b/apidocs/org/rundeck/api/domain/class-use/RundeckNode.html
index 68c2e5a..ef404c0 100644
--- a/apidocs/org/rundeck/api/domain/class-use/RundeckNode.html
+++ b/apidocs/org/rundeck/api/domain/class-use/RundeckNode.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.domain.RundeckNode (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/class-use/RundeckProject.html b/apidocs/org/rundeck/api/domain/class-use/RundeckProject.html
index 64d1a49..83531c7 100644
--- a/apidocs/org/rundeck/api/domain/class-use/RundeckProject.html
+++ b/apidocs/org/rundeck/api/domain/class-use/RundeckProject.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Class org.rundeck.api.domain.RundeckProject (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/package-frame.html b/apidocs/org/rundeck/api/domain/package-frame.html
index 0e55fe7..2a25c86 100644
--- a/apidocs/org/rundeck/api/domain/package-frame.html
+++ b/apidocs/org/rundeck/api/domain/package-frame.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 org.rundeck.api.domain (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/package-summary.html b/apidocs/org/rundeck/api/domain/package-summary.html
index e4de9b6..bfa388d 100644
--- a/apidocs/org/rundeck/api/domain/package-summary.html
+++ b/apidocs/org/rundeck/api/domain/package-summary.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 org.rundeck.api.domain (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/package-tree.html b/apidocs/org/rundeck/api/domain/package-tree.html
index 4d18a39..bc18adb 100644
--- a/apidocs/org/rundeck/api/domain/package-tree.html
+++ b/apidocs/org/rundeck/api/domain/package-tree.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 org.rundeck.api.domain Class Hierarchy (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/domain/package-use.html b/apidocs/org/rundeck/api/domain/package-use.html
index 93f6f54..0ccd5ea 100644
--- a/apidocs/org/rundeck/api/domain/package-use.html
+++ b/apidocs/org/rundeck/api/domain/package-use.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Package org.rundeck.api.domain (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/package-frame.html b/apidocs/org/rundeck/api/package-frame.html
index 5d0c911..28876c9 100644
--- a/apidocs/org/rundeck/api/package-frame.html
+++ b/apidocs/org/rundeck/api/package-frame.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 org.rundeck.api (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/package-summary.html b/apidocs/org/rundeck/api/package-summary.html
index 6a2026f..c823af5 100644
--- a/apidocs/org/rundeck/api/package-summary.html
+++ b/apidocs/org/rundeck/api/package-summary.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 org.rundeck.api (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/package-tree.html b/apidocs/org/rundeck/api/package-tree.html
index 1cecce8..fd3aab9 100644
--- a/apidocs/org/rundeck/api/package-tree.html
+++ b/apidocs/org/rundeck/api/package-tree.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 org.rundeck.api Class Hierarchy (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/package-use.html b/apidocs/org/rundeck/api/package-use.html
index fed5074..3cec5be 100644
--- a/apidocs/org/rundeck/api/package-use.html
+++ b/apidocs/org/rundeck/api/package-use.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 Uses of Package org.rundeck.api (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/parser/AbortParser.html b/apidocs/org/rundeck/api/parser/AbortParser.html
index 65bbdfe..cbba4ce 100644
--- a/apidocs/org/rundeck/api/parser/AbortParser.html
+++ b/apidocs/org/rundeck/api/parser/AbortParser.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 AbortParser (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/parser/ExecutionParser.html b/apidocs/org/rundeck/api/parser/ExecutionParser.html
index 7feb6fe..467e0e9 100644
--- a/apidocs/org/rundeck/api/parser/ExecutionParser.html
+++ b/apidocs/org/rundeck/api/parser/ExecutionParser.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 ExecutionParser (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/parser/JobParser.html b/apidocs/org/rundeck/api/parser/JobParser.html
index cc6c1c0..8a01b39 100644
--- a/apidocs/org/rundeck/api/parser/JobParser.html
+++ b/apidocs/org/rundeck/api/parser/JobParser.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 JobParser (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/parser/ListParser.html b/apidocs/org/rundeck/api/parser/ListParser.html
index 345c063..a4b45a2 100644
--- a/apidocs/org/rundeck/api/parser/ListParser.html
+++ b/apidocs/org/rundeck/api/parser/ListParser.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 ListParser (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/parser/NodeParser.html b/apidocs/org/rundeck/api/parser/NodeParser.html
index c848944..962411b 100644
--- a/apidocs/org/rundeck/api/parser/NodeParser.html
+++ b/apidocs/org/rundeck/api/parser/NodeParser.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 NodeParser (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
diff --git a/apidocs/org/rundeck/api/parser/ParserHelper.html b/apidocs/org/rundeck/api/parser/ParserHelper.html
index 5e81422..a5b8471 100644
--- a/apidocs/org/rundeck/api/parser/ParserHelper.html
+++ b/apidocs/org/rundeck/api/parser/ParserHelper.html
@@ -2,13 +2,13 @@
 
 
 
-
+
 
 
 ParserHelper (RunDeck API - Java Client 1.0-SNAPSHOT API)
 
 
-
+
 
 
 
@@ -141,14 +141,6 @@ Helper for parsing RunDeck responses
 
 
 static org.dom4j.Document
-loadDocument(org.apache.http.HttpResponse httpResponse)
-
-
-          Load an XML Document from the given RunDeck HttpResponse. - - - -static org.dom4j.Document loadDocument(InputStream inputStream)
@@ -194,23 +186,6 @@ public ParserHelper()
-

-loadDocument

-
-public static org.dom4j.Document loadDocument(org.apache.http.HttpResponse httpResponse)
-                                       throws RundeckApiException
-
-
Load an XML Document from the given RunDeck HttpResponse. -

-

-
Parameters:
httpResponse - from an API call to RunDeck -
Returns:
an XML Document -
Throws: -
RundeckApiException - if we failed to read the response, or if the response is an error
See Also:
loadDocument(InputStream)
-
-
-
-

loadDocument

@@ -223,7 +198,7 @@ public static org.dom4j.Document loadDocument(RundeckApiException - if we failed to read the response, or if the response is an error
See Also:
loadDocument(HttpResponse) +
RundeckApiException - if we failed to read the response, or if the response is an error
diff --git a/apidocs/org/rundeck/api/parser/ProjectParser.html b/apidocs/org/rundeck/api/parser/ProjectParser.html index 8d211c8..d52e4e1 100644 --- a/apidocs/org/rundeck/api/parser/ProjectParser.html +++ b/apidocs/org/rundeck/api/parser/ProjectParser.html @@ -2,13 +2,13 @@ - + ProjectParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -57,7 +57,7 @@ function windowTitle()  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   @@ -253,7 +253,7 @@ public  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   diff --git a/apidocs/org/rundeck/api/parser/StringParser.html b/apidocs/org/rundeck/api/parser/StringParser.html new file mode 100644 index 0000000..8105892 --- /dev/null +++ b/apidocs/org/rundeck/api/parser/StringParser.html @@ -0,0 +1,287 @@ + + + + + + + +StringParser (RunDeck API - Java Client 1.0-SNAPSHOT API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.rundeck.api.parser +
+Class StringParser

+
+java.lang.Object
+  extended by org.rundeck.api.parser.StringParser
+
+
+
All Implemented Interfaces:
XmlNodeParser<String>
+
+
+
+
public class StringParser
extends Object
implements XmlNodeParser<String>
+
+ +

+Parser for a single String +

+ +

+

+
Author:
+
Vincent Behar
+
+
+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
StringParser() + +
+           
StringParser(String xpath) + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ StringparseXmlNode(org.dom4j.Node node) + +
+          Parse the given XML Node
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+StringParser

+
+public StringParser()
+
+
+
+ +

+StringParser

+
+public StringParser(String xpath)
+
+
+
Parameters:
xpath - of the string element if it is not the root node
+
+ + + + + + + + +
+Method Detail
+ +

+parseXmlNode

+
+public String parseXmlNode(org.dom4j.Node node)
+
+
Description copied from interface: XmlNodeParser
+
Parse the given XML Node +

+

+
Specified by:
parseXmlNode in interface XmlNodeParser<String>
+
+
+ +
Returns:
any object holding the converted value
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2011. All Rights Reserved. + + diff --git a/apidocs/org/rundeck/api/parser/XmlNodeParser.html b/apidocs/org/rundeck/api/parser/XmlNodeParser.html index a96549f..4ce9220 100644 --- a/apidocs/org/rundeck/api/parser/XmlNodeParser.html +++ b/apidocs/org/rundeck/api/parser/XmlNodeParser.html @@ -2,13 +2,13 @@ - + XmlNodeParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -56,7 +56,7 @@ function windowTitle() PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   @@ -93,7 +93,7 @@ org.rundeck.api.parser
Interface XmlNodeParser<T>

-
All Known Implementing Classes:
AbortParser, ExecutionParser, JobParser, ListParser, NodeParser, ProjectParser
+
All Known Implementing Classes:
AbortParser, ExecutionParser, JobParser, ListParser, NodeParser, ProjectParser, StringParser

@@ -186,7 +186,7 @@ parseXmlNode PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   diff --git a/apidocs/org/rundeck/api/parser/class-use/AbortParser.html b/apidocs/org/rundeck/api/parser/class-use/AbortParser.html index bc3a474..c0716b8 100644 --- a/apidocs/org/rundeck/api/parser/class-use/AbortParser.html +++ b/apidocs/org/rundeck/api/parser/class-use/AbortParser.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.AbortParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/parser/class-use/ExecutionParser.html b/apidocs/org/rundeck/api/parser/class-use/ExecutionParser.html index 99a156b..5dc6625 100644 --- a/apidocs/org/rundeck/api/parser/class-use/ExecutionParser.html +++ b/apidocs/org/rundeck/api/parser/class-use/ExecutionParser.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.ExecutionParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/parser/class-use/JobParser.html b/apidocs/org/rundeck/api/parser/class-use/JobParser.html index 89a2afc..84ddbb2 100644 --- a/apidocs/org/rundeck/api/parser/class-use/JobParser.html +++ b/apidocs/org/rundeck/api/parser/class-use/JobParser.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.JobParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/parser/class-use/ListParser.html b/apidocs/org/rundeck/api/parser/class-use/ListParser.html index 7b3e732..873556a 100644 --- a/apidocs/org/rundeck/api/parser/class-use/ListParser.html +++ b/apidocs/org/rundeck/api/parser/class-use/ListParser.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.ListParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/parser/class-use/NodeParser.html b/apidocs/org/rundeck/api/parser/class-use/NodeParser.html index ecd26f6..79d8f88 100644 --- a/apidocs/org/rundeck/api/parser/class-use/NodeParser.html +++ b/apidocs/org/rundeck/api/parser/class-use/NodeParser.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.NodeParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/parser/class-use/ParserHelper.html b/apidocs/org/rundeck/api/parser/class-use/ParserHelper.html index 704bd63..621e930 100644 --- a/apidocs/org/rundeck/api/parser/class-use/ParserHelper.html +++ b/apidocs/org/rundeck/api/parser/class-use/ParserHelper.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.ParserHelper (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/parser/class-use/ProjectParser.html b/apidocs/org/rundeck/api/parser/class-use/ProjectParser.html index 7099675..c52c304 100644 --- a/apidocs/org/rundeck/api/parser/class-use/ProjectParser.html +++ b/apidocs/org/rundeck/api/parser/class-use/ProjectParser.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.ProjectParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/parser/class-use/StringParser.html b/apidocs/org/rundeck/api/parser/class-use/StringParser.html new file mode 100644 index 0000000..c22d1b3 --- /dev/null +++ b/apidocs/org/rundeck/api/parser/class-use/StringParser.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.rundeck.api.parser.StringParser (RunDeck API - Java Client 1.0-SNAPSHOT API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.rundeck.api.parser.StringParser

+
+No usage of org.rundeck.api.parser.StringParser +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2011. All Rights Reserved. + + diff --git a/apidocs/org/rundeck/api/parser/class-use/XmlNodeParser.html b/apidocs/org/rundeck/api/parser/class-use/XmlNodeParser.html index 6888da2..edc8e93 100644 --- a/apidocs/org/rundeck/api/parser/class-use/XmlNodeParser.html +++ b/apidocs/org/rundeck/api/parser/class-use/XmlNodeParser.html @@ -2,13 +2,13 @@ - + Uses of Interface org.rundeck.api.parser.XmlNodeParser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -159,6 +159,14 @@ Uses of           Parser for a single RundeckProject + + + class +StringParser + +
+          Parser for a single String +  

diff --git a/apidocs/org/rundeck/api/parser/package-frame.html b/apidocs/org/rundeck/api/parser/package-frame.html index 904eac3..deeb9fb 100644 --- a/apidocs/org/rundeck/api/parser/package-frame.html +++ b/apidocs/org/rundeck/api/parser/package-frame.html @@ -2,13 +2,13 @@ - + org.rundeck.api.parser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -47,7 +47,9 @@ Classes 
ParserHelper
-ProjectParser
+ProjectParser +
+StringParser diff --git a/apidocs/org/rundeck/api/parser/package-summary.html b/apidocs/org/rundeck/api/parser/package-summary.html index a50bea9..6c5a23a 100644 --- a/apidocs/org/rundeck/api/parser/package-summary.html +++ b/apidocs/org/rundeck/api/parser/package-summary.html @@ -2,13 +2,13 @@ - + org.rundeck.api.parser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -137,6 +137,10 @@ Internal parsers for parsing the RunDeck responses. ProjectParser Parser for a single RundeckProject + +StringParser +Parser for a single String +   diff --git a/apidocs/org/rundeck/api/parser/package-tree.html b/apidocs/org/rundeck/api/parser/package-tree.html index ee1c7ac..ee65ce0 100644 --- a/apidocs/org/rundeck/api/parser/package-tree.html +++ b/apidocs/org/rundeck/api/parser/package-tree.html @@ -2,13 +2,13 @@ - + org.rundeck.api.parser Class Hierarchy (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -99,6 +99,7 @@ Class Hierarchy

  • org.rundeck.api.parser.ListParser<T> (implements org.rundeck.api.parser.XmlNodeParser<T>)
  • org.rundeck.api.parser.NodeParser (implements org.rundeck.api.parser.XmlNodeParser<T>)
  • org.rundeck.api.parser.ParserHelper
  • org.rundeck.api.parser.ProjectParser (implements org.rundeck.api.parser.XmlNodeParser<T>) +
  • org.rundeck.api.parser.StringParser (implements org.rundeck.api.parser.XmlNodeParser<T>)

    diff --git a/apidocs/org/rundeck/api/parser/package-use.html b/apidocs/org/rundeck/api/parser/package-use.html index 115a03d..6204df7 100644 --- a/apidocs/org/rundeck/api/parser/package-use.html +++ b/apidocs/org/rundeck/api/parser/package-use.html @@ -2,13 +2,13 @@ - + Uses of Package org.rundeck.api.parser (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/util/AssertUtil.html b/apidocs/org/rundeck/api/util/AssertUtil.html index d614008..7e07874 100644 --- a/apidocs/org/rundeck/api/util/AssertUtil.html +++ b/apidocs/org/rundeck/api/util/AssertUtil.html @@ -2,13 +2,13 @@ - + AssertUtil (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/util/ParametersUtil.html b/apidocs/org/rundeck/api/util/ParametersUtil.html index 0a00cb3..dbb1791 100644 --- a/apidocs/org/rundeck/api/util/ParametersUtil.html +++ b/apidocs/org/rundeck/api/util/ParametersUtil.html @@ -2,13 +2,13 @@ - + ParametersUtil (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/util/class-use/AssertUtil.html b/apidocs/org/rundeck/api/util/class-use/AssertUtil.html index fc7d493..b7910d2 100644 --- a/apidocs/org/rundeck/api/util/class-use/AssertUtil.html +++ b/apidocs/org/rundeck/api/util/class-use/AssertUtil.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.util.AssertUtil (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/util/class-use/ParametersUtil.html b/apidocs/org/rundeck/api/util/class-use/ParametersUtil.html index 9f8f60c..dcb038e 100644 --- a/apidocs/org/rundeck/api/util/class-use/ParametersUtil.html +++ b/apidocs/org/rundeck/api/util/class-use/ParametersUtil.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.util.ParametersUtil (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/util/package-frame.html b/apidocs/org/rundeck/api/util/package-frame.html index 496872a..e98e3f2 100644 --- a/apidocs/org/rundeck/api/util/package-frame.html +++ b/apidocs/org/rundeck/api/util/package-frame.html @@ -2,13 +2,13 @@ - + org.rundeck.api.util (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/util/package-summary.html b/apidocs/org/rundeck/api/util/package-summary.html index fc4c9e4..7f838ca 100644 --- a/apidocs/org/rundeck/api/util/package-summary.html +++ b/apidocs/org/rundeck/api/util/package-summary.html @@ -2,13 +2,13 @@ - + org.rundeck.api.util (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/util/package-tree.html b/apidocs/org/rundeck/api/util/package-tree.html index ee7c433..8a09dc5 100644 --- a/apidocs/org/rundeck/api/util/package-tree.html +++ b/apidocs/org/rundeck/api/util/package-tree.html @@ -2,13 +2,13 @@ - + org.rundeck.api.util Class Hierarchy (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/org/rundeck/api/util/package-use.html b/apidocs/org/rundeck/api/util/package-use.html index 5392db0..c537d2d 100644 --- a/apidocs/org/rundeck/api/util/package-use.html +++ b/apidocs/org/rundeck/api/util/package-use.html @@ -2,13 +2,13 @@ - + Uses of Package org.rundeck.api.util (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/overview-frame.html b/apidocs/overview-frame.html index 3ce79aa..d88f9f0 100644 --- a/apidocs/overview-frame.html +++ b/apidocs/overview-frame.html @@ -2,13 +2,13 @@ - + Overview List (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/overview-summary.html b/apidocs/overview-summary.html index d3b4a32..b7f25e9 100644 --- a/apidocs/overview-summary.html +++ b/apidocs/overview-summary.html @@ -2,13 +2,13 @@ - + Overview (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/apidocs/overview-tree.html b/apidocs/overview-tree.html index ce98d13..0548a51 100644 --- a/apidocs/overview-tree.html +++ b/apidocs/overview-tree.html @@ -2,13 +2,13 @@ - + Class Hierarchy (RunDeck API - Java Client 1.0-SNAPSHOT API) - + @@ -104,6 +104,7 @@ Class Hierarchy
  • org.rundeck.api.domain.RundeckJob (implements java.io.Serializable)
  • org.rundeck.api.domain.RundeckNode (implements java.io.Serializable)
  • org.rundeck.api.domain.RundeckProject (implements java.io.Serializable) +
  • org.rundeck.api.parser.StringParser (implements org.rundeck.api.parser.XmlNodeParser<T>)
  • java.lang.Throwable (implements java.io.Serializable)
    • java.lang.Exception
        diff --git a/apidocs/serialized-form.html b/apidocs/serialized-form.html index 1a804ce..9a1af70 100644 --- a/apidocs/serialized-form.html +++ b/apidocs/serialized-form.html @@ -2,13 +2,13 @@ - + Serialized Form (RunDeck API - Java Client 1.0-SNAPSHOT API) - + diff --git a/changes-report.html b/changes-report.html index 13c7a1f..7fd879c 100644 --- a/changes-report.html +++ b/changes-report.html @@ -1,5 +1,5 @@ - + @@ -11,7 +11,7 @@ - + @@ -50,7 +50,7 @@
        - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
        diff --git a/cpd.html b/cpd.html index e4d8cc4..98d8fbd 100644 --- a/cpd.html +++ b/cpd.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
        - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
        diff --git a/dependencies.html b/dependencies.html index 8c8988d..ccb9760 100644 --- a/dependencies.html +++ b/dependencies.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
        - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
        @@ -137,7 +137,7 @@
        -

        Project Dependencies

        compile

        The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

        GroupIdArtifactIdVersionTypeLicense
        commons-langcommons-lang2.6jarThe Apache Software License, Version 2.0
        dom4jdom4j1.6.1jar-
        jaxenjaxen1.1.1jar-
        org.apache.httpcomponentshttpclient4.1.1jarLICENSE.txt

        test

        The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

        GroupIdArtifactIdVersionTypeLicense
        junitjunit4.8.2jarCommon Public License Version 1.0

        Project Transitive Dependencies

        The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

        compile

        The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

        GroupIdArtifactIdVersionTypeLicense
        com.ibm.icuicu4j2.6.1jar-
        commons-codeccommons-codec1.4jarThe Apache Software License, Version 2.0
        commons-loggingcommons-logging1.1.1jarThe Apache Software License, Version 2.0
        jdomjdom1.0jar-
        org.apache.httpcomponentshttpcore4.1jarLICENSE.txt
        xalanxalan2.6.0jar-
        xercesxercesImpl2.6.2jar-
        xercesxmlParserAPIs2.6.2jar-
        xml-apisxml-apis1.0.b2jarThe Apache Software License, Version 2.0
        xomxom1.0jarLGPL

        Project Dependency Graph

        -

        Dependency Tree

        • org.rundeck:rundeck-api-java-client:jar:1.0-SNAPSHOT Information
          • org.apache.httpcomponents:httpclient:jar:4.1.1 (compile) Information
            • org.apache.httpcomponents:httpcore:jar:4.1 (compile) Information
            • commons-logging:commons-logging:jar:1.1.1 (compile) Information
            • commons-codec:commons-codec:jar:1.4 (compile) Information
          • com.ibm.icu:icu4j:jar:2.6.1 (compile) Information
      • junit:junit:jar:4.8.2 (test) Information

    Licenses

    LGPL: xom

    Unknown: Unnamed - com.ibm.icu:icu4j:jar:2.6.1, Unnamed - jdom:jdom:jar:1.0, Unnamed - xalan:xalan:jar:2.6.0, Unnamed - xerces:xercesImpl:jar:2.6.2, Unnamed - xerces:xmlParserAPIs:jar:2.6.2, dom4j, jaxen

    Apache License: HttpClient, HttpCore

    Common Public License Version 1.0: JUnit

    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

    Dependency File Details

    FilenameSizeEntriesClassesPackagesJDK RevDebugSealed
    icu4j-2.6.1.jar2.34 MB75564861.2debug-
    commons-codec-1.4.jar56.80 kB473051.4debug-
    commons-io-2.0.1.jar155.77 kB12210461.5debug-
    commons-lang-2.6.jar277.56 kB155133101.3debug-
    commons-logging-1.1.1.jar59.26 kB422821.1debug-
    dom4j-1.6.1.jar306.54 kB208190141.3debug-
    jaxen-1.1.1.jar221.60 kB236214171.2debug-
    jdom-1.0.jar149.66 kB877581.1debug-
    junit-4.8.2.jar231.78 kB267230301.5debug-
    httpclient-4.1.1.jar342.90 kB308272221.5debug-
    httpcore-4.1.jar176.80 kB185163101.3debug-
    xalan-2.6.0.jar3.00 MB1,6251,548501.1debug-
    xercesImpl-2.6.2.jar986.99 kB845784371.1release-
    xmlParserAPIs-2.6.2.jar121.80 kB238207171.1release-
    xml-apis-1.0.b2.jar106.76 kB217184171.2release-
    xom-1.0.jar106.32 kB1089661.2releasesealed
    TotalSizeEntriesClassesPackagesJDK RevDebugSealed
    168.56 MB5,4454,9062571.5121
    compile: 15compile: 8.34 MBcompile: 5,178compile: 4,676compile: 227-compile: 11compile: 1
    test: 1test: 231.78 kBtest: 267test: 230test: 30-test: 1-

    Dependency Repository Locations

    Repo IDURLReleaseSnapshot
    apache.snapshotshttp://people.apache.org/repo/m2-snapshot-repository-Yes-
    sonatype-nexus-snapshotshttps://oss.sonatype.org/content/repositories/snapshots-Yes-
    centralhttp://repo1.maven.org/maven2Yes--

    Repository locations for each of the Dependencies.

    Artifactapache.snapshotssonatype-nexus-snapshotscentral
    com.ibm.icu:icu4j:jar:2.6.1--Found at http://repo1.maven.org/maven2
    commons-codec:commons-codec:jar:1.4--Found at http://repo1.maven.org/maven2
    commons-io:commons-io:jar:2.0.1--Found at http://repo1.maven.org/maven2
    commons-lang:commons-lang:jar:2.6--Found at http://repo1.maven.org/maven2
    commons-logging:commons-logging:jar:1.1.1--Found at http://repo1.maven.org/maven2
    dom4j:dom4j:jar:1.6.1--Found at http://repo1.maven.org/maven2
    jaxen:jaxen:jar:1.1.1--Found at http://repo1.maven.org/maven2
    jdom:jdom:jar:1.0--Found at http://repo1.maven.org/maven2
    junit:junit:jar:4.8.2--Found at http://repo1.maven.org/maven2
    org.apache.httpcomponents:httpclient:jar:4.1.1--Found at http://repo1.maven.org/maven2
    org.apache.httpcomponents:httpcore:jar:4.1--Found at http://repo1.maven.org/maven2
    xalan:xalan:jar:2.6.0--Found at http://repo1.maven.org/maven2
    xerces:xercesImpl:jar:2.6.2--Found at http://repo1.maven.org/maven2
    xerces:xmlParserAPIs:jar:2.6.2--Found at http://repo1.maven.org/maven2
    xml-apis:xml-apis:jar:1.0.b2--Found at http://repo1.maven.org/maven2
    xom:xom:jar:1.0--Found at http://repo1.maven.org/maven2
    Totalapache.snapshotssonatype-nexus-snapshotscentral
    16 (compile: 15, test: 1)0016
    diff --git a/dependency-updates-report.html b/dependency-updates-report.html index 23d70df..9033c98 100644 --- a/dependency-updates-report.html +++ b/dependency-updates-report.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -146,7 +146,7 @@
    -

    Overview

    This report summarizes newer versions that may be available for your project's various dependencies.

    # of dependencies using the latest version available5
    # of dependencies where the next version available is smaller than an incremental version update0
    # of dependencies where the next version available is an incremental version update0
    # of dependencies where the next version available is a minor version update0
    # of dependencies where the next version available is a major version update0

    Dependency Management

    This project does not declare any dependencies in a dependencyManagement section.

    Dependencies

    StatusGroup IdArtifact IdCurrent VersionScopeClassifierTypeNext VersionNext IncrementalNext MinorNext Major
    commons-langcommons-lang2.6compilejar
    dom4jdom4j1.6.1compilejar
    jaxenjaxen1.1.1compilejar
    junitjunit4.8.2testjar
    org.apache.httpcomponentshttpclient4.1.1compilejar
    StatusGroup IdArtifact IdCurrent VersionScopeClassifierTypeNext VersionNext IncrementalNext MinorNext Major

    Dependency Updates

    commons-lang:commons-lang

    Status No newer versions available.
    Group Idcommons-lang
    Artifact Idcommons-lang
    Current Version2.6
    Scopecompile
    Classifier
    Typejar

    dom4j:dom4j

    Status No newer versions available.
    Group Iddom4j
    Artifact Iddom4j
    Current Version1.6.1
    Scopecompile
    Classifier
    Typejar

    jaxen:jaxen

    Status No newer versions available.
    Group Idjaxen
    Artifact Idjaxen
    Current Version1.1.1
    Scopecompile
    Classifier
    Typejar

    junit:junit

    Status No newer versions available.
    Group Idjunit
    Artifact Idjunit
    Current Version4.8.2
    Scopetest
    Classifier
    Typejar

    org.apache.httpcomponents:httpclient

    Status No newer versions available.
    Group Idorg.apache.httpcomponents
    Artifact Idhttpclient
    Current Version4.1.1
    Scopecompile
    Classifier
    Typejar
    +

    Overview

    This report summarizes newer versions that may be available for your project's various dependencies.

    # of dependencies using the latest version available6
    # of dependencies where the next version available is smaller than an incremental version update0
    # of dependencies where the next version available is an incremental version update0
    # of dependencies where the next version available is a minor version update0
    # of dependencies where the next version available is a major version update0

    Dependency Management

    This project does not declare any dependencies in a dependencyManagement section.

    Dependencies

    StatusGroup IdArtifact IdCurrent VersionScopeClassifierTypeNext VersionNext IncrementalNext MinorNext Major
    commons-iocommons-io2.0.1compilejar
    commons-langcommons-lang2.6compilejar
    dom4jdom4j1.6.1compilejar
    jaxenjaxen1.1.1compilejar
    junitjunit4.8.2testjar
    org.apache.httpcomponentshttpclient4.1.1compilejar
    StatusGroup IdArtifact IdCurrent VersionScopeClassifierTypeNext VersionNext IncrementalNext MinorNext Major

    Dependency Updates

    commons-io:commons-io

    Status No newer versions available.
    Group Idcommons-io
    Artifact Idcommons-io
    Current Version2.0.1
    Scopecompile
    Classifier
    Typejar

    commons-lang:commons-lang

    Status No newer versions available.
    Group Idcommons-lang
    Artifact Idcommons-lang
    Current Version2.6
    Scopecompile
    Classifier
    Typejar

    dom4j:dom4j

    Status No newer versions available.
    Group Iddom4j
    Artifact Iddom4j
    Current Version1.6.1
    Scopecompile
    Classifier
    Typejar

    jaxen:jaxen

    Status No newer versions available.
    Group Idjaxen
    Artifact Idjaxen
    Current Version1.1.1
    Scopecompile
    Classifier
    Typejar

    junit:junit

    Status No newer versions available.
    Group Idjunit
    Artifact Idjunit
    Current Version4.8.2
    Scopetest
    Classifier
    Typejar

    org.apache.httpcomponents:httpclient

    Status No newer versions available.
    Group Idorg.apache.httpcomponents
    Artifact Idhttpclient
    Current Version4.1.1
    Scopecompile
    Classifier
    Typejar
    diff --git a/distribution-management.html b/distribution-management.html index 061d731..7ae524d 100644 --- a/distribution-management.html +++ b/distribution-management.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/download.html b/download.html index 18773d2..fe375b3 100644 --- a/download.html +++ b/download.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -108,7 +108,7 @@
    -

    Download the librairie

    Maven Central Repository

    We plan on hosting the librairie on the Maven Central Repository, with the groupId org.rundeck and the artifactId rundeck-api-java-client.

    You can see all versions and download the files with this query : g:"org.rundeck" AND a:"rundeck-api-java-client".

    For the moment, the librairie is not on the repository, so you will need to download it manually...

    Manual download

    If you want to use this librairie from a scripting language, it is often easier to download a single jar file with all dependencies included.

    You can download such files on GitHub : https://github.com/vbehar/rundeck-api-java-client/downloads

    +

    Download the library

    Maven Central Repository

    We plan on hosting the library on the Maven Central Repository, with the groupId org.rundeck and the artifactId rundeck-api-java-client.

    You can see all versions and download the files with this query : g:"org.rundeck" AND a:"rundeck-api-java-client".

    For the moment, the library is not on the repository, so you will need to download it manually...

    Manual download

    If you want to use this library from a scripting language, it is often easier to download a single jar file with all dependencies included.

    You can download such files on GitHub : https://github.com/vbehar/rundeck-api-java-client/downloads

    diff --git a/faq.html b/faq.html index 9679651..2cf16a5 100644 --- a/faq.html +++ b/faq.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -125,7 +125,7 @@
  • General

    Which version should I use ?
    -

    The versions of the librairie are aligned with the versions of the API :

    +

    The versions of the library are aligned with the versions of the API :

    • Versions 1.x are for RunDeck API version 1 (RunDeck 1.2+)
    • Versions 2.x are for RunDeck API version 2 (RunDeck 1.3+)
    • diff --git a/findbugs.html b/findbugs.html index 96305e8..9028ff6 100644 --- a/findbugs.html +++ b/findbugs.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -146,7 +146,7 @@
    -

    FindBugs Bug Detector Report

    The following document contains the results of FindBugs Report

    FindBugs Version is 1.3.9

    Threshold is medium

    Effort is min

    Summary

    ClassesBugsErrorsMissing Classes
    25000

    Files

    ClassBugs
    +

    FindBugs Bug Detector Report

    The following document contains the results of FindBugs Report

    FindBugs Version is 1.3.9

    Threshold is medium

    Effort is min

    Summary

    ClassesBugsErrorsMissing Classes
    26000

    Files

    ClassBugs
    diff --git a/groovy.html b/groovy.html index 9eaefaf..b16a3b9 100644 --- a/groovy.html +++ b/groovy.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -145,7 +145,7 @@ execution = rundeck.triggerJob("job-id", new Properties(opt: "val // last one : you can run a job and wait until its execution is finished : execution = rundeck.runJob("job-id") -println "Execution finished ! Status : ${execution.status}, duration (in seconds) : ${execution.durationInSeconds}" +println "Execution finished ! Status : ${execution.status}, duration : ${execution.duration}"

    Running an ad-hoc command

    import org.rundeck.api.RundeckClient
     rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
     
    @@ -154,6 +154,10 @@ execution = rundeck.triggerAdhocCommand("my-project", "uptime&quo
     
     // run the "uptime" command on all unix nodes
     execution = rundeck.runAdhocCommand("my-project", "uptime", new Properties(os-family: "unix"))
    +

    Exporting jobs

    import org.rundeck.api.RundeckClient
    +rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
    +
    +rundeck.exportJobsToFile("/tmp/jobs.xml", "my-project")
     

    And more...

    See the API documentation of the RundeckClient class for more interactions with your RunDeck instance...

    diff --git a/index.html b/index.html index 027d3ce..26a1310 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -137,7 +137,7 @@
    -

    Java client for the RunDeck REST API

    What is it ?

    A Java librairie that maps the RunDeck HTTP REST API. RunDeck is an open-source tool for automating tasks on multiple nodes, with a CLI, a web-based interface and an HTTP REST API. You can read more about its API on the RunDeck User Manual.

    This librairie has been extracted from the Jenkins RunDeck plugin, so for the moment it is still incomplete (not all the RunDeck API is mapped). My goal is to have a complete mapping of the RunDeck API, and to publish the librairie on the Maven Central Repository, so that it can easily be used by Java (Maven) and Groovy (Grape) developers.

    What can I do with it ?

    • Use it to write scripts (in Groovy, JRuby or Jython), for example if you want to automate the execution of RunDeck jobs based on external events.
    • Use it in a Java application. A good example would be the Jenkins RunDeck plugin, that needs to trigger RunDeck jobs from within the Jenkins continuous-integration server.

    Where can I get more information ?

    +

    Java client for the RunDeck REST API

    What is it ?

    A Java library that maps the RunDeck HTTP REST API. RunDeck is an open-source tool for automating tasks on multiple nodes, with a CLI, a web-based interface and an HTTP REST API. You can read more about its API on the RunDeck User Manual.

    This library has been extracted from the Jenkins RunDeck plugin, so for the moment it is still incomplete (not all the RunDeck API is mapped). My goal is to have a complete mapping of the RunDeck API, and to publish the library on the Maven Central Repository, so that it can easily be used by Java (Maven) and Groovy (Grape) developers.

    What can I do with it ?

    • Use it to write scripts (in Groovy, JRuby or Jython), for example if you want to automate the execution of RunDeck jobs based on external events.
    • Use it in a Java application. A good example would be the Jenkins RunDeck plugin, that needs to trigger RunDeck jobs from within the Jenkins continuous-integration server.

    Where can I get more information ?

    diff --git a/issue-tracking.html b/issue-tracking.html index 57ae714..8ac19c7 100644 --- a/issue-tracking.html +++ b/issue-tracking.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/jruby.html b/jruby.html index e4b9837..4ce15fd 100644 --- a/jruby.html +++ b/jruby.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -118,7 +118,7 @@ puts "All RunDeck projects : #{rundeck.projects}" puts "All RunDeck nodes : #{rundeck.nodes}" puts "All RunDeck jobs : #{rundeck.jobs}" puts "All RunDeck running executions : #{rundeck.runningExecutions}" -

    You can also add the librairie to the classpath : save the following script in a file named "rundeck.rb", and execute it with "jruby -rjava -J-cp /path/to/rundeck-api-java-client-VERSION-jar-with-dependencies.jar rundeck.rb".

    import org.rundeck.api.RundeckClient
    +

    You can also add the library to the classpath : save the following script in a file named "rundeck.rb", and execute it with "jruby -rjava -J-cp /path/to/rundeck-api-java-client-VERSION-jar-with-dependencies.jar rundeck.rb".

    import org.rundeck.api.RundeckClient
     
     rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
     
    @@ -148,7 +148,7 @@ execution = rundeck.triggerJob("job-id", OptionsBuilder.new().addOptio
     
     // last one : you can run a job and wait until its execution is finished :
     execution = rundeck.runJob("job-id")
    -puts "Execution finished ! Status : #{execution.status}, duration (in seconds) : #{execution.durationInSeconds}"
    +puts "Execution finished ! Status : #{execution.status}, duration : #{execution.duration}"
     

    Running an ad-hoc command

    import org.rundeck.api.RundeckClient
     import org.rundeck.api.NodeFiltersBuilder
     
    @@ -159,6 +159,10 @@ execution = rundeck.triggerAdhocCommand("my-project", "uptime&quo
     
     // run the "uptime" command on all unix nodes
     execution = rundeck.runAdhocCommand("my-project", "uptime", NodeFiltersBuilder.new().osFamily("unix").toProperties())
    +

    Exporting jobs

    import org.rundeck.api.RundeckClient
    +rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
    +
    +rundeck.exportJobsToFile("/tmp/jobs.xml", "my-project")
     

    And more...

    See the API documentation of the RundeckClient class for more interactions with your RunDeck instance...

    diff --git a/jython.html b/jython.html index e6a5777..b64cb90 100644 --- a/jython.html +++ b/jython.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -138,7 +138,7 @@ execution = rundeck.triggerJob("job-id", OptionsBuilder().addOption(&q // last one : you can run a job and wait until its execution is finished : execution = rundeck.runJob("job-id") -print("Execution finished ! Status : %s, duration (in seconds) : %s" % (execution.status, execution.durationInSeconds)) +print("Execution finished ! Status : %s, duration : %s" % (execution.status, execution.duration))

    Running an ad-hoc command

    from org.rundeck.api import RundeckClient
     from org.rundeck.api import NodeFiltersBuilder
     
    @@ -149,6 +149,10 @@ execution = rundeck.triggerAdhocCommand("my-project", "uptime&quo
     
     // run the "uptime" command on all unix nodes
     execution = rundeck.runAdhocCommand("my-project", "uptime", NodeFiltersBuilder().osFamily("unix").toProperties())
    +

    Exporting jobs

    from org.rundeck.api import RundeckClient
    +rundeck = RundeckClient("http://localhost:4440", "admin", "admin")
    +
    +rundeck.exportJobsToFile("/tmp/jobs.xml", "my-project")
     

    And more...

    See the API documentation of the RundeckClient class for more interactions with your RunDeck instance...

    diff --git a/license.html b/license.html index 5b5d07f..049610a 100644 --- a/license.html +++ b/license.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/mail-lists.html b/mail-lists.html index f80408d..9417a6f 100644 --- a/mail-lists.html +++ b/mail-lists.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/plugin-updates-report.html b/plugin-updates-report.html index f20c5a4..dcdf34e 100644 --- a/plugin-updates-report.html +++ b/plugin-updates-report.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/pmd.html b/pmd.html index d091ce8..73fb009 100644 --- a/pmd.html +++ b/pmd.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/pmd.xml b/pmd.xml index e3defcf..f4059c6 100644 --- a/pmd.xml +++ b/pmd.xml @@ -1,5 +1,5 @@ - + Avoid empty catch blocks diff --git a/project-info.html b/project-info.html index 0695d44..8224f4a 100644 --- a/project-info.html +++ b/project-info.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/project-reports.html b/project-reports.html index ee5acfd..b1fae55 100644 --- a/project-reports.html +++ b/project-reports.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/project-summary.html b/project-summary.html index f4b7558..db3ceb6 100644 --- a/project-summary.html +++ b/project-summary.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/property-updates-report.html b/property-updates-report.html index f9c2596..b43f122 100644 --- a/property-updates-report.html +++ b/property-updates-report.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/scripting.html b/scripting.html index d7b2882..421f540 100644 --- a/scripting.html +++ b/scripting.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    @@ -108,7 +108,7 @@
    -

    Scripting with the RunDeck client

    You can use this librairie with your prefered scripting language... as long as it runs on the JVM !

    You can find some examples with :

    +

    Scripting with the RunDeck client

    You can use this library with your prefered scripting language... as long as it runs on the JVM !

    You can find some examples with :

    diff --git a/source-repository.html b/source-repository.html index 16eed29..e988ace 100644 --- a/source-repository.html +++ b/source-repository.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/taglist.html b/taglist.html index b708185..1e0ac3e 100644 --- a/taglist.html +++ b/taglist.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/team-list.html b/team-list.html index dc0a1b5..2703657 100644 --- a/team-list.html +++ b/team-list.html @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ @import url("./css/site.css"); - + @@ -49,7 +49,7 @@
    - Last Published: 2011-07-06 + Last Published: 2011-07-07  | Version: 1.0-SNAPSHOT
    diff --git a/testapidocs/allclasses-frame.html b/testapidocs/allclasses-frame.html index b1c0e35..69ba36c 100644 --- a/testapidocs/allclasses-frame.html +++ b/testapidocs/allclasses-frame.html @@ -2,13 +2,13 @@ - + All Classes (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + @@ -38,6 +38,8 @@ All Classes (RunDeck API - Java Client 1.0-SNAPSHOT Test API)
    ProjectParserTest
    +StringParserTest +
    diff --git a/testapidocs/allclasses-noframe.html b/testapidocs/allclasses-noframe.html index ac72e16..e1a35d9 100644 --- a/testapidocs/allclasses-noframe.html +++ b/testapidocs/allclasses-noframe.html @@ -2,13 +2,13 @@ - + All Classes (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + @@ -38,6 +38,8 @@ All Classes (RunDeck API - Java Client 1.0-SNAPSHOT Test API)
    ProjectParserTest
    +StringParserTest +
    diff --git a/testapidocs/constant-values.html b/testapidocs/constant-values.html index 06277ab..cb215e9 100644 --- a/testapidocs/constant-values.html +++ b/testapidocs/constant-values.html @@ -2,13 +2,13 @@ - + Constant Field Values (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/deprecated-list.html b/testapidocs/deprecated-list.html index bcbf8f0..b0736c7 100644 --- a/testapidocs/deprecated-list.html +++ b/testapidocs/deprecated-list.html @@ -2,13 +2,13 @@ - + Deprecated List (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/help-doc.html b/testapidocs/help-doc.html index 47df5d4..bfb2053 100644 --- a/testapidocs/help-doc.html +++ b/testapidocs/help-doc.html @@ -2,13 +2,13 @@ - + API Help (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/index-all.html b/testapidocs/index-all.html index 31bc7b2..2f202e7 100644 --- a/testapidocs/index-all.html +++ b/testapidocs/index-all.html @@ -2,13 +2,13 @@ - + Index (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + @@ -79,7 +79,7 @@ function windowTitle() -A E G J L N O P
    +A E G J L N O P S

    A

    @@ -163,6 +163,9 @@ Method in class org.rundeck.api.parser.parseJob() - Method in class org.rundeck.api.parser.JobParserTest
      +
    parseJob() - +Method in class org.rundeck.api.parser.StringParserTest +
     
    parseJobs() - Method in class org.rundeck.api.parser.ListParserTest
      @@ -198,7 +201,15 @@ Constructor for class org.rundeck.api.parser.A E G J L N O P +

    +S

    +
    +
    StringParserTest - Class in org.rundeck.api.parser
    Test the StringParser
    StringParserTest() - +Constructor for class org.rundeck.api.parser.StringParserTest +
      +
    +
    +A E G J L N O P S diff --git a/testapidocs/index.html b/testapidocs/index.html index 9a0c9a6..997097c 100644 --- a/testapidocs/index.html +++ b/testapidocs/index.html @@ -2,7 +2,7 @@ - + RunDeck API - Java Client 1.0-SNAPSHOT Test API diff --git a/testapidocs/org/rundeck/api/parser/AbortParserTest.html b/testapidocs/org/rundeck/api/parser/AbortParserTest.html index b3212de..4b3995c 100644 --- a/testapidocs/org/rundeck/api/parser/AbortParserTest.html +++ b/testapidocs/org/rundeck/api/parser/AbortParserTest.html @@ -2,13 +2,13 @@ <!--NewPage--> <HTML> <HEAD> -<!-- Generated by javadoc (build 1.6.0_24) on Wed Jul 06 22:59:37 CEST 2011 --> +<!-- Generated by javadoc (build 1.6.0_24) on Thu Jul 07 23:06:53 CEST 2011 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> AbortParserTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/org/rundeck/api/parser/ExecutionParserTest.html b/testapidocs/org/rundeck/api/parser/ExecutionParserTest.html index bb01163..5751bd1 100644 --- a/testapidocs/org/rundeck/api/parser/ExecutionParserTest.html +++ b/testapidocs/org/rundeck/api/parser/ExecutionParserTest.html @@ -2,13 +2,13 @@ - + ExecutionParserTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/org/rundeck/api/parser/JobParserTest.html b/testapidocs/org/rundeck/api/parser/JobParserTest.html index d99824e..7b8db2c 100644 --- a/testapidocs/org/rundeck/api/parser/JobParserTest.html +++ b/testapidocs/org/rundeck/api/parser/JobParserTest.html @@ -2,13 +2,13 @@ - + JobParserTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/org/rundeck/api/parser/ListParserTest.html b/testapidocs/org/rundeck/api/parser/ListParserTest.html index a8fa96f..b27718a 100644 --- a/testapidocs/org/rundeck/api/parser/ListParserTest.html +++ b/testapidocs/org/rundeck/api/parser/ListParserTest.html @@ -2,13 +2,13 @@ - + ListParserTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/org/rundeck/api/parser/NodeParserTest.html b/testapidocs/org/rundeck/api/parser/NodeParserTest.html index f6bcc50..9df7810 100644 --- a/testapidocs/org/rundeck/api/parser/NodeParserTest.html +++ b/testapidocs/org/rundeck/api/parser/NodeParserTest.html @@ -2,13 +2,13 @@ - + NodeParserTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/org/rundeck/api/parser/ParserHelperTest.html b/testapidocs/org/rundeck/api/parser/ParserHelperTest.html index 3c82530..b70400a 100644 --- a/testapidocs/org/rundeck/api/parser/ParserHelperTest.html +++ b/testapidocs/org/rundeck/api/parser/ParserHelperTest.html @@ -2,13 +2,13 @@ - + ParserHelperTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/org/rundeck/api/parser/ProjectParserTest.html b/testapidocs/org/rundeck/api/parser/ProjectParserTest.html index fccf859..30ccd2c 100644 --- a/testapidocs/org/rundeck/api/parser/ProjectParserTest.html +++ b/testapidocs/org/rundeck/api/parser/ProjectParserTest.html @@ -2,13 +2,13 @@ - + ProjectParserTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + @@ -57,7 +57,7 @@ function windowTitle()  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   @@ -230,7 +230,7 @@ public void parseProject()  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   diff --git a/testapidocs/org/rundeck/api/parser/StringParserTest.html b/testapidocs/org/rundeck/api/parser/StringParserTest.html new file mode 100644 index 0000000..250dc40 --- /dev/null +++ b/testapidocs/org/rundeck/api/parser/StringParserTest.html @@ -0,0 +1,264 @@ + + + + + + + +StringParserTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.rundeck.api.parser +
    +Class StringParserTest

    +
    +java.lang.Object
    +  extended by org.rundeck.api.parser.StringParserTest
    +
    +
    +
    +
    public class StringParserTest
    extends Object
    + + +

    +Test the StringParser +

    + +

    +

    +
    Author:
    +
    Vincent Behar
    +
    +
    + +

    + + + + + + + + + + + +
    +Constructor Summary
    StringParserTest() + +
    +           
    +  + + + + + + + + + + + +
    +Method Summary
    + voidparseJob() + +
    +           
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +StringParserTest

    +
    +public StringParserTest()
    +
    +
    + + + + + + + + +
    +Method Detail
    + +

    +parseJob

    +
    +public void parseJob()
    +              throws Exception
    +
    +
    + +
    Throws: +
    Exception
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    +Copyright © 2011. All Rights Reserved. + + diff --git a/testapidocs/org/rundeck/api/parser/class-use/AbortParserTest.html b/testapidocs/org/rundeck/api/parser/class-use/AbortParserTest.html index 31d9018..d28f231 100644 --- a/testapidocs/org/rundeck/api/parser/class-use/AbortParserTest.html +++ b/testapidocs/org/rundeck/api/parser/class-use/AbortParserTest.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.AbortParserTest (RunDeck API - Java Client 1.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 1d67413..ccb3d38 100644 --- a/testapidocs/org/rundeck/api/parser/class-use/ExecutionParserTest.html +++ b/testapidocs/org/rundeck/api/parser/class-use/ExecutionParserTest.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.ExecutionParserTest (RunDeck API - Java Client 1.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 9b93d66..274e709 100644 --- a/testapidocs/org/rundeck/api/parser/class-use/JobParserTest.html +++ b/testapidocs/org/rundeck/api/parser/class-use/JobParserTest.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.JobParserTest (RunDeck API - Java Client 1.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 b24bde3..076dedb 100644 --- a/testapidocs/org/rundeck/api/parser/class-use/ListParserTest.html +++ b/testapidocs/org/rundeck/api/parser/class-use/ListParserTest.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.ListParserTest (RunDeck API - Java Client 1.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 7288111..ec0f866 100644 --- a/testapidocs/org/rundeck/api/parser/class-use/NodeParserTest.html +++ b/testapidocs/org/rundeck/api/parser/class-use/NodeParserTest.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.NodeParserTest (RunDeck API - Java Client 1.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 9cb72b9..2797711 100644 --- a/testapidocs/org/rundeck/api/parser/class-use/ParserHelperTest.html +++ b/testapidocs/org/rundeck/api/parser/class-use/ParserHelperTest.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.ParserHelperTest (RunDeck API - Java Client 1.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 ba047a3..37fb353 100644 --- a/testapidocs/org/rundeck/api/parser/class-use/ProjectParserTest.html +++ b/testapidocs/org/rundeck/api/parser/class-use/ProjectParserTest.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.parser.ProjectParserTest (RunDeck API - Java Client 1.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 new file mode 100644 index 0000000..2c7fff5 --- /dev/null +++ b/testapidocs/org/rundeck/api/parser/class-use/StringParserTest.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.rundeck.api.parser.StringParserTest (RunDeck API - Java Client 1.0-SNAPSHOT Test API) + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.rundeck.api.parser.StringParserTest

    +
    +No usage of org.rundeck.api.parser.StringParserTest +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +Copyright © 2011. All Rights Reserved. + + diff --git a/testapidocs/org/rundeck/api/parser/package-frame.html b/testapidocs/org/rundeck/api/parser/package-frame.html index 66c97dc..feaace8 100644 --- a/testapidocs/org/rundeck/api/parser/package-frame.html +++ b/testapidocs/org/rundeck/api/parser/package-frame.html @@ -2,13 +2,13 @@ - + org.rundeck.api.parser (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + @@ -36,7 +36,9 @@ Classes
     
    ParserHelperTest
    -ProjectParserTest +ProjectParserTest +
    +StringParserTest diff --git a/testapidocs/org/rundeck/api/parser/package-summary.html b/testapidocs/org/rundeck/api/parser/package-summary.html index 5eae546..2ef2f9c 100644 --- a/testapidocs/org/rundeck/api/parser/package-summary.html +++ b/testapidocs/org/rundeck/api/parser/package-summary.html @@ -2,13 +2,13 @@ - + org.rundeck.api.parser (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + @@ -117,6 +117,10 @@ Package org.rundeck.api.parser ProjectParserTest Test the ProjectParser + +StringParserTest +Test the StringParser +   diff --git a/testapidocs/org/rundeck/api/parser/package-tree.html b/testapidocs/org/rundeck/api/parser/package-tree.html index 814297a..28d0216 100644 --- a/testapidocs/org/rundeck/api/parser/package-tree.html +++ b/testapidocs/org/rundeck/api/parser/package-tree.html @@ -2,13 +2,13 @@ - + org.rundeck.api.parser Class Hierarchy (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + @@ -93,7 +93,7 @@ Class Hierarchy


    diff --git a/testapidocs/org/rundeck/api/parser/package-use.html b/testapidocs/org/rundeck/api/parser/package-use.html index c0ea49b..72933e1 100644 --- a/testapidocs/org/rundeck/api/parser/package-use.html +++ b/testapidocs/org/rundeck/api/parser/package-use.html @@ -2,13 +2,13 @@ - + Uses of Package org.rundeck.api.parser (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/org/rundeck/api/util/ParametersUtilTest.html b/testapidocs/org/rundeck/api/util/ParametersUtilTest.html index 305037f..a973ebc 100644 --- a/testapidocs/org/rundeck/api/util/ParametersUtilTest.html +++ b/testapidocs/org/rundeck/api/util/ParametersUtilTest.html @@ -2,13 +2,13 @@ - + ParametersUtilTest (RunDeck API - Java Client 1.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 3f59e8f..a9a3f05 100644 --- a/testapidocs/org/rundeck/api/util/class-use/ParametersUtilTest.html +++ b/testapidocs/org/rundeck/api/util/class-use/ParametersUtilTest.html @@ -2,13 +2,13 @@ - + Uses of Class org.rundeck.api.util.ParametersUtilTest (RunDeck API - Java Client 1.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 3765d99..46a2893 100644 --- a/testapidocs/org/rundeck/api/util/package-frame.html +++ b/testapidocs/org/rundeck/api/util/package-frame.html @@ -2,13 +2,13 @@ - + org.rundeck.api.util (RunDeck API - Java Client 1.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 1188b8e..8fb2b2c 100644 --- a/testapidocs/org/rundeck/api/util/package-summary.html +++ b/testapidocs/org/rundeck/api/util/package-summary.html @@ -2,13 +2,13 @@ - + org.rundeck.api.util (RunDeck API - Java Client 1.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 3ddd2da..ec47fb6 100644 --- a/testapidocs/org/rundeck/api/util/package-tree.html +++ b/testapidocs/org/rundeck/api/util/package-tree.html @@ -2,13 +2,13 @@ - + org.rundeck.api.util Class Hierarchy (RunDeck API - Java Client 1.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 dd40165..df54c80 100644 --- a/testapidocs/org/rundeck/api/util/package-use.html +++ b/testapidocs/org/rundeck/api/util/package-use.html @@ -2,13 +2,13 @@ - + Uses of Package org.rundeck.api.util (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/overview-frame.html b/testapidocs/overview-frame.html index 5979b80..97e9162 100644 --- a/testapidocs/overview-frame.html +++ b/testapidocs/overview-frame.html @@ -2,13 +2,13 @@ - + Overview List (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/overview-summary.html b/testapidocs/overview-summary.html index 8af06ba..7021ea8 100644 --- a/testapidocs/overview-summary.html +++ b/testapidocs/overview-summary.html @@ -2,13 +2,13 @@ - + Overview (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + diff --git a/testapidocs/overview-tree.html b/testapidocs/overview-tree.html index 7206675..3a0d208 100644 --- a/testapidocs/overview-tree.html +++ b/testapidocs/overview-tree.html @@ -2,13 +2,13 @@ - + Class Hierarchy (RunDeck API - Java Client 1.0-SNAPSHOT Test API) - + @@ -92,7 +92,7 @@ Class Hierarchy
    diff --git a/xref-test/allclasses-frame.html b/xref-test/allclasses-frame.html index 994d946..c0111b9 100644 --- a/xref-test/allclasses-frame.html +++ b/xref-test/allclasses-frame.html @@ -34,6 +34,9 @@
  • ProjectParserTest +
  • +
  • + StringParserTest
  • diff --git a/xref-test/org/rundeck/api/parser/StringParserTest.html b/xref-test/org/rundeck/api/parser/StringParserTest.html new file mode 100644 index 0000000..56492f8 --- /dev/null +++ b/xref-test/org/rundeck/api/parser/StringParserTest.html @@ -0,0 +1,54 @@ + + + + +StringParserTest xref + + + +
    +
    +1   /*
    +2    * Copyright 2011 Vincent Behar
    +3    *
    +4    * Licensed under the Apache License, Version 2.0 (the "License");
    +5    * you may not use this file except in compliance with the License.
    +6    * You may obtain a copy of the License at
    +7    *
    +8    *     http://www.apache.org/licenses/LICENSE-2.0
    +9    *
    +10   * Unless required by applicable law or agreed to in writing, software
    +11   * distributed under the License is distributed on an "AS IS" BASIS,
    +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +13   * See the License for the specific language governing permissions and
    +14   * limitations under the License.
    +15   */
    +16  package org.rundeck.api.parser;
    +17  
    +18  import java.io.InputStream;
    +19  import org.dom4j.Document;
    +20  import org.junit.Assert;
    +21  import org.junit.Test;
    +22  
    +23  /**
    +24   * Test the {@link StringParser}
    +25   * 
    +26   * @author Vincent Behar
    +27   */
    +28  public class StringParserTest {
    +29  
    +30      @Test
    +31      public void parseJob() throws Exception {
    +32          InputStream input = getClass().getResourceAsStream("message.xml");
    +33          Document document = ParserHelper.loadDocument(input);
    +34  
    +35          String message = new StringParser("result/success/message").parseXmlNode(document);
    +36  
    +37          Assert.assertEquals("Job was successfully deleted: [1] /job-name", message);
    +38      }
    +39  
    +40  }
    +
    +
    + + diff --git a/xref-test/org/rundeck/api/parser/package-frame.html b/xref-test/org/rundeck/api/parser/package-frame.html index 1c5749c..d0d1a0d 100644 --- a/xref-test/org/rundeck/api/parser/package-frame.html +++ b/xref-test/org/rundeck/api/parser/package-frame.html @@ -35,6 +35,9 @@
  • ProjectParserTest +
  • +
  • + StringParserTest
  • diff --git a/xref-test/org/rundeck/api/parser/package-summary.html b/xref-test/org/rundeck/api/parser/package-summary.html index a51372b..209b8d0 100644 --- a/xref-test/org/rundeck/api/parser/package-summary.html +++ b/xref-test/org/rundeck/api/parser/package-summary.html @@ -69,6 +69,11 @@ ProjectParserTest + + + + StringParserTest + diff --git a/xref/allclasses-frame.html b/xref/allclasses-frame.html index be926ca..623460c 100644 --- a/xref/allclasses-frame.html +++ b/xref/allclasses-frame.html @@ -79,6 +79,9 @@
  • RundeckProject +
  • +
  • + StringParser
  • XmlNodeParser diff --git a/xref/org/rundeck/api/ApiCall.html b/xref/org/rundeck/api/ApiCall.html index 7c1f6f5..e8196b2 100644 --- a/xref/org/rundeck/api/ApiCall.html +++ b/xref/org/rundeck/api/ApiCall.html @@ -25,228 +25,314 @@ 15 */ 16 package org.rundeck.api; 17 -18 import java.io.IOException; -19 import java.security.KeyManagementException; -20 import java.security.KeyStoreException; -21 import java.security.NoSuchAlgorithmException; -22 import java.security.UnrecoverableKeyException; -23 import java.security.cert.CertificateException; -24 import java.security.cert.X509Certificate; -25 import java.util.ArrayList; -26 import java.util.List; -27 import org.apache.commons.lang.StringUtils; -28 import org.apache.http.HttpResponse; -29 import org.apache.http.NameValuePair; -30 import org.apache.http.ParseException; -31 import org.apache.http.client.HttpClient; -32 import org.apache.http.client.entity.UrlEncodedFormEntity; -33 import org.apache.http.client.methods.HttpGet; -34 import org.apache.http.client.methods.HttpPost; -35 import org.apache.http.conn.scheme.Scheme; -36 import org.apache.http.conn.ssl.SSLSocketFactory; -37 import org.apache.http.conn.ssl.TrustStrategy; -38 import org.apache.http.impl.client.DefaultHttpClient; -39 import org.apache.http.message.BasicNameValuePair; -40 import org.apache.http.protocol.HTTP; -41 import org.apache.http.util.EntityUtils; -42 import org.dom4j.Document; -43 import org.rundeck.api.RundeckApiException.RundeckApiLoginException; -44 import org.rundeck.api.parser.XmlNodeParser; -45 import org.rundeck.api.parser.ParserHelper; -46 import org.rundeck.api.util.AssertUtil; -47 -48 /** -49 * Class responsible for making the HTTP API calls -50 * -51 * @author Vincent Behar -52 */ -53 class ApiCall { -54 -55 private final RundeckClient client; -56 -57 /** -58 * Build a new instance, linked to the given RunDeck client -59 * -60 * @param client holding the RunDeck url and the credentials -61 * @throws IllegalArgumentException if client is null -62 */ -63 public ApiCall(RundeckClient client) throws IllegalArgumentException { -64 super(); -65 this.client = client; -66 AssertUtil.notNull(client, "The RunDeck Client must not be null !"); -67 } -68 -69 /** -70 * Try to "ping" the RunDeck instance to see if it is alive -71 * -72 * @throws RundeckApiException if the ping fails -73 */ -74 public void ping() throws RundeckApiException { -75 HttpClient httpClient = instantiateHttpClient(); -76 try { -77 HttpResponse response = httpClient.execute(new HttpGet(client.getUrl())); -78 if (response.getStatusLine().getStatusCode() / 100 != 2) { -79 throw new RundeckApiException("Invalid HTTP response '" + response.getStatusLine() + "' when pinging " -80 + client.getUrl()); -81 } -82 } catch (IOException e) { -83 throw new RundeckApiException("Failed to ping RunDeck instance at " + client.getUrl(), e); -84 } finally { -85 httpClient.getConnectionManager().shutdown(); -86 } -87 } -88 -89 /** -90 * Test the credentials (login/password) on the RunDeck instance -91 * -92 * @throws RundeckApiLoginException if the login fails -93 */ -94 public void testCredentials() throws RundeckApiLoginException { -95 HttpClient httpClient = instantiateHttpClient(); -96 try { -97 login(httpClient); -98 } finally { -99 httpClient.getConnectionManager().shutdown(); -100 } -101 } -102 -103 /** -104 * Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the -105 * API call. At the end, the given parser will be used to convert the response to a more useful result object. -106 * -107 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder} -108 * @param parser used to parse the response -109 * @return the result of the call, as formatted by the parser -110 * @throws RundeckApiException in case of error when calling the API -111 * @throws RundeckApiLoginException if the login fails -112 */ -113 public <T> T get(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException, RundeckApiLoginException { -114 String apiUrl = client.getUrl() + RundeckClient.API_ENDPOINT + apiPath; -115 -116 HttpClient httpClient = instantiateHttpClient(); -117 try { -118 login(httpClient); -119 -120 // execute the HTTP request -121 HttpResponse response = null; -122 try { -123 response = httpClient.execute(new HttpGet(apiUrl)); -124 } catch (IOException e) { -125 throw new RundeckApiException("Failed to execute an HTTP GET on url : " + apiUrl, e); -126 } -127 if (response.getStatusLine().getStatusCode() / 100 != 2) { -128 throw new RundeckApiException("Invalid HTTP response '" + response.getStatusLine() + "' for " + apiUrl); -129 } -130 if (response.getEntity() == null) { -131 throw new RundeckApiException("Empty RunDeck response ! HTTP status line is : " -132 + response.getStatusLine()); -133 } -134 -135 // read and parse the response -136 Document xmlDocument = ParserHelper.loadDocument(response); -137 T result = parser.parseXmlNode(xmlDocument); -138 -139 // release the connection -140 try { -141 EntityUtils.consume(response.getEntity()); -142 } catch (IOException e) { -143 throw new RundeckApiException("Failed to consume entity (release connection)", e); -144 } -145 return result; -146 } finally { -147 httpClient.getConnectionManager().shutdown(); -148 } -149 } -150 -151 /** -152 * Do the actual work of login, using the given {@link HttpClient} instance. You'll need to re-use this instance -153 * when making API calls (such as running a job). -154 * -155 * @param httpClient pre-instantiated -156 * @throws RundeckApiLoginException if the login failed -157 */ -158 private void login(HttpClient httpClient) throws RundeckApiLoginException { -159 String location = client.getUrl() + "/j_security_check"; -160 -161 while (true) { -162 HttpPost postLogin = new HttpPost(location); -163 List<NameValuePair> params = new ArrayList<NameValuePair>(); -164 params.add(new BasicNameValuePair("j_username", client.getLogin())); -165 params.add(new BasicNameValuePair("j_password", client.getPassword())); -166 params.add(new BasicNameValuePair("action", "login")); -167 -168 HttpResponse response = null; -169 try { -170 postLogin.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); -171 response = httpClient.execute(postLogin); -172 } catch (IOException e) { -173 throw new RundeckApiLoginException("Failed to post login form on " + location, e); -174 } +18 import java.io.ByteArrayInputStream; +19 import java.io.IOException; +20 import java.io.InputStream; +21 import java.security.KeyManagementException; +22 import java.security.KeyStoreException; +23 import java.security.NoSuchAlgorithmException; +24 import java.security.UnrecoverableKeyException; +25 import java.security.cert.CertificateException; +26 import java.security.cert.X509Certificate; +27 import java.util.ArrayList; +28 import java.util.List; +29 import org.apache.commons.lang.StringUtils; +30 import org.apache.http.HttpResponse; +31 import org.apache.http.NameValuePair; +32 import org.apache.http.ParseException; +33 import org.apache.http.client.HttpClient; +34 import org.apache.http.client.entity.UrlEncodedFormEntity; +35 import org.apache.http.client.methods.HttpDelete; +36 import org.apache.http.client.methods.HttpGet; +37 import org.apache.http.client.methods.HttpPost; +38 import org.apache.http.client.methods.HttpRequestBase; +39 import org.apache.http.conn.scheme.Scheme; +40 import org.apache.http.conn.ssl.SSLSocketFactory; +41 import org.apache.http.conn.ssl.TrustStrategy; +42 import org.apache.http.impl.client.DefaultHttpClient; +43 import org.apache.http.message.BasicNameValuePair; +44 import org.apache.http.protocol.HTTP; +45 import org.apache.http.util.EntityUtils; +46 import org.dom4j.Document; +47 import org.rundeck.api.RundeckApiException.RundeckApiLoginException; +48 import org.rundeck.api.parser.ParserHelper; +49 import org.rundeck.api.parser.XmlNodeParser; +50 import org.rundeck.api.util.AssertUtil; +51 +52 /** +53 * Class responsible for making the HTTP API calls +54 * +55 * @author Vincent Behar +56 */ +57 class ApiCall { +58 +59 private final RundeckClient client; +60 +61 /** +62 * Build a new instance, linked to the given RunDeck client +63 * +64 * @param client holding the RunDeck url and the credentials +65 * @throws IllegalArgumentException if client is null +66 */ +67 public ApiCall(RundeckClient client) throws IllegalArgumentException { +68 super(); +69 this.client = client; +70 AssertUtil.notNull(client, "The RunDeck Client must not be null !"); +71 } +72 +73 /** +74 * Try to "ping" the RunDeck instance to see if it is alive +75 * +76 * @throws RundeckApiException if the ping fails +77 */ +78 public void ping() throws RundeckApiException { +79 HttpClient httpClient = instantiateHttpClient(); +80 try { +81 HttpResponse response = httpClient.execute(new HttpGet(client.getUrl())); +82 if (response.getStatusLine().getStatusCode() / 100 != 2) { +83 throw new RundeckApiException("Invalid HTTP response '" + response.getStatusLine() + "' when pinging " +84 + client.getUrl()); +85 } +86 } catch (IOException e) { +87 throw new RundeckApiException("Failed to ping RunDeck instance at " + client.getUrl(), e); +88 } finally { +89 httpClient.getConnectionManager().shutdown(); +90 } +91 } +92 +93 /** +94 * Test the credentials (login/password) on the RunDeck instance +95 * +96 * @throws RundeckApiLoginException if the login fails +97 */ +98 public void testCredentials() throws RundeckApiLoginException { +99 HttpClient httpClient = instantiateHttpClient(); +100 try { +101 login(httpClient); +102 } finally { +103 httpClient.getConnectionManager().shutdown(); +104 } +105 } +106 +107 /** +108 * Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the +109 * API call. At the end, the given parser will be used to convert the response to a more useful result object. +110 * +111 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder} +112 * @param parser used to parse the response +113 * @return the result of the call, as formatted by the parser +114 * @throws RundeckApiException in case of error when calling the API +115 * @throws RundeckApiLoginException if the login fails +116 */ +117 public <T> T get(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException, +118 RundeckApiLoginException { +119 return execute(new HttpGet(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath), parser); +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. +125 * +126 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder} +127 * @return a new {@link InputStream} instance, not linked with network resources +128 * @throws RundeckApiException in case of error when calling the API +129 * @throws RundeckApiLoginException if the login fails +130 */ +131 public InputStream get(ApiPathBuilder apiPath) throws RundeckApiException, RundeckApiLoginException { +132 ByteArrayInputStream response = execute(new HttpGet(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath)); +133 +134 // try to load the document, to throw an exception in case of error +135 ParserHelper.loadDocument(response); +136 response.reset(); +137 +138 return response; +139 } +140 +141 /** +142 * Execute an HTTP DELETE request to the RunDeck instance, on the given path. We will login first, and then execute +143 * the API call. At the end, the given parser will be used to convert the response to a more useful result object. +144 * +145 * @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder} +146 * @param parser used to parse the response +147 * @return the result of the call, as formatted by the parser +148 * @throws RundeckApiException in case of error when calling the API +149 * @throws RundeckApiLoginException if the login fails +150 */ +151 public <T> T delete(ApiPathBuilder apiPath, XmlNodeParser<T> parser) throws RundeckApiException, +152 RundeckApiLoginException { +153 return execute(new HttpDelete(client.getUrl() + RundeckClient.API_ENDPOINT + apiPath), parser); +154 } +155 +156 /** +157 * Execute an HTTP request to the RunDeck instance. We will login first, and then execute the API call. At the end, +158 * the given parser will be used to convert the response to a more useful result object. +159 * +160 * @param request to execute. see {@link HttpGet}, {@link HttpDelete}, and so on... +161 * @param parser used to parse the response +162 * @return the result of the call, as formatted by the parser +163 * @throws RundeckApiException in case of error when calling the API +164 * @throws RundeckApiLoginException if the login fails +165 */ +166 private <T> T execute(HttpRequestBase request, XmlNodeParser<T> parser) throws RundeckApiException, +167 RundeckApiLoginException { +168 // execute the request +169 InputStream response = execute(request); +170 +171 // read and parse the response +172 Document xmlDocument = ParserHelper.loadDocument(response); +173 return parser.parseXmlNode(xmlDocument); +174 } 175 -176 if (response.getStatusLine().getStatusCode() / 100 == 3) { -177 // HTTP client refuses to handle redirects (code 3xx) for POST, so we have to do it manually... -178 location = response.getFirstHeader("Location").getValue(); -179 try { -180 EntityUtils.consume(response.getEntity()); -181 } catch (IOException e) { -182 throw new RundeckApiLoginException("Failed to consume entity (release connection)", e); -183 } -184 continue; -185 } -186 if (response.getStatusLine().getStatusCode() / 100 != 2) { -187 throw new RundeckApiLoginException("Invalid HTTP response '" + response.getStatusLine() + "' for " -188 + location); -189 } -190 try { -191 String content = EntityUtils.toString(response.getEntity(), HTTP.UTF_8); -192 if (StringUtils.contains(content, "j_security_check")) { -193 throw new RundeckApiLoginException("Login failed for user " + client.getLogin()); -194 } -195 try { -196 EntityUtils.consume(response.getEntity()); -197 } catch (IOException e) { -198 throw new RundeckApiLoginException("Failed to consume entity (release connection)", e); -199 } -200 } catch (IOException io) { -201 throw new RundeckApiLoginException("Failed to read RunDeck result", io); -202 } catch (ParseException p) { -203 throw new RundeckApiLoginException("Failed to parse RunDeck response", p); -204 } -205 break; -206 } -207 } -208 -209 /** -210 * Instantiate a new {@link HttpClient} instance, configured to accept all SSL certificates -211 * -212 * @return an {@link HttpClient} instance - won't be null -213 */ -214 private HttpClient instantiateHttpClient() { -215 SSLSocketFactory socketFactory = null; -216 try { -217 socketFactory = new SSLSocketFactory(new TrustStrategy() { -218 -219 @Override -220 public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { -221 return true; -222 } -223 }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); -224 } catch (KeyManagementException e) { -225 throw new RuntimeException(e); -226 } catch (UnrecoverableKeyException e) { -227 throw new RuntimeException(e); -228 } catch (NoSuchAlgorithmException e) { -229 throw new RuntimeException(e); -230 } catch (KeyStoreException e) { -231 throw new RuntimeException(e); -232 } -233 -234 HttpClient httpClient = new DefaultHttpClient(); -235 httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("https", 443, socketFactory)); -236 return httpClient; -237 } -238 -239 } +176 /** +177 * Execute an HTTP request to the RunDeck instance. We will login first, and then execute the API call. +178 * +179 * @param request to execute. see {@link HttpGet}, {@link HttpDelete}, and so on... +180 * @return a new {@link InputStream} instance, not linked with network resources +181 * @throws RundeckApiException in case of error when calling the API +182 * @throws RundeckApiLoginException if the login fails +183 */ +184 private ByteArrayInputStream execute(HttpRequestBase request) throws RundeckApiException, RundeckApiLoginException { +185 HttpClient httpClient = instantiateHttpClient(); +186 try { +187 login(httpClient); +188 +189 // execute the HTTP request +190 HttpResponse response = null; +191 try { +192 response = httpClient.execute(request); +193 } catch (IOException e) { +194 throw new RundeckApiException("Failed to execute an HTTP " + request.getMethod() + " on url : " +195 + request.getURI(), e); +196 } +197 +198 // HTTP client refuses to handle redirects (code 3xx) for DELETE, so we have to do it manually... +199 // See http://rundeck.lighthouseapp.com/projects/59277/tickets/248 +200 if (response.getStatusLine().getStatusCode() / 100 == 3 +201 && HttpDelete.METHOD_NAME.equals(request.getMethod())) { +202 String newLocation = response.getFirstHeader("Location").getValue(); +203 try { +204 EntityUtils.consume(response.getEntity()); +205 } catch (IOException e) { +206 throw new RundeckApiException("Failed to consume entity (release connection)", e); +207 } +208 request = new HttpDelete(newLocation); +209 try { +210 response = httpClient.execute(request); +211 } catch (IOException e) { +212 throw new RundeckApiException("Failed to execute an HTTP " + request.getMethod() + " on url : " +213 + request.getURI(), e); +214 } +215 } +216 +217 // check the response code (should be 2xx, even in case of error : error message is in the XML result) +218 if (response.getStatusLine().getStatusCode() / 100 != 2) { +219 throw new RundeckApiException("Invalid HTTP response '" + response.getStatusLine() + "' for " +220 + request.getURI()); +221 } +222 if (response.getEntity() == null) { +223 throw new RundeckApiException("Empty RunDeck response ! HTTP status line is : " +224 + response.getStatusLine()); +225 } +226 +227 // return a new inputStream, so that we can close all network resources +228 try { +229 return new ByteArrayInputStream(EntityUtils.toByteArray(response.getEntity())); +230 } catch (IOException e) { +231 throw new RundeckApiException("Failed to consume entity and convert the inputStream", e); +232 } +233 } finally { +234 httpClient.getConnectionManager().shutdown(); +235 } +236 } +237 +238 /** +239 * Do the actual work of login, using the given {@link HttpClient} instance. You'll need to re-use this instance +240 * when making API calls (such as running a job). +241 * +242 * @param httpClient pre-instantiated +243 * @throws RundeckApiLoginException if the login failed +244 */ +245 private void login(HttpClient httpClient) throws RundeckApiLoginException { +246 String location = client.getUrl() + "/j_security_check"; +247 +248 while (true) { +249 HttpPost postLogin = new HttpPost(location); +250 List<NameValuePair> params = new ArrayList<NameValuePair>(); +251 params.add(new BasicNameValuePair("j_username", client.getLogin())); +252 params.add(new BasicNameValuePair("j_password", client.getPassword())); +253 params.add(new BasicNameValuePair("action", "login")); +254 +255 HttpResponse response = null; +256 try { +257 postLogin.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); +258 response = httpClient.execute(postLogin); +259 } catch (IOException e) { +260 throw new RundeckApiLoginException("Failed to post login form on " + location, e); +261 } +262 +263 if (response.getStatusLine().getStatusCode() / 100 == 3) { +264 // HTTP client refuses to handle redirects (code 3xx) for POST, so we have to do it manually... +265 location = response.getFirstHeader("Location").getValue(); +266 try { +267 EntityUtils.consume(response.getEntity()); +268 } catch (IOException e) { +269 throw new RundeckApiLoginException("Failed to consume entity (release connection)", e); +270 } +271 continue; +272 } +273 if (response.getStatusLine().getStatusCode() / 100 != 2) { +274 throw new RundeckApiLoginException("Invalid HTTP response '" + response.getStatusLine() + "' for " +275 + location); +276 } +277 try { +278 String content = EntityUtils.toString(response.getEntity(), HTTP.UTF_8); +279 if (StringUtils.contains(content, "j_security_check")) { +280 throw new RundeckApiLoginException("Login failed for user " + client.getLogin()); +281 } +282 try { +283 EntityUtils.consume(response.getEntity()); +284 } catch (IOException e) { +285 throw new RundeckApiLoginException("Failed to consume entity (release connection)", e); +286 } +287 } catch (IOException io) { +288 throw new RundeckApiLoginException("Failed to read RunDeck result", io); +289 } catch (ParseException p) { +290 throw new RundeckApiLoginException("Failed to parse RunDeck response", p); +291 } +292 break; +293 } +294 } +295 +296 /** +297 * Instantiate a new {@link HttpClient} instance, configured to accept all SSL certificates +298 * +299 * @return an {@link HttpClient} instance - won't be null +300 */ +301 private HttpClient instantiateHttpClient() { +302 SSLSocketFactory socketFactory = null; +303 try { +304 socketFactory = new SSLSocketFactory(new TrustStrategy() { +305 +306 @Override +307 public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { +308 return true; +309 } +310 }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); +311 } catch (KeyManagementException e) { +312 throw new RuntimeException(e); +313 } catch (UnrecoverableKeyException e) { +314 throw new RuntimeException(e); +315 } catch (NoSuchAlgorithmException e) { +316 throw new RuntimeException(e); +317 } catch (KeyStoreException e) { +318 throw new RuntimeException(e); +319 } +320 +321 HttpClient httpClient = new DefaultHttpClient(); +322 httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("https", 443, socketFactory)); +323 return httpClient; +324 } +325 }
    diff --git a/xref/org/rundeck/api/RundeckClient.html b/xref/org/rundeck/api/RundeckClient.html index f2a0d27..2656cc2 100644 --- a/xref/org/rundeck/api/RundeckClient.html +++ b/xref/org/rundeck/api/RundeckClient.html @@ -25,792 +25,892 @@ 15 */ 16 package org.rundeck.api; 17 -18 import java.io.Serializable; -19 import java.util.ArrayList; -20 import java.util.List; -21 import java.util.Properties; -22 import java.util.concurrent.TimeUnit; -23 import org.apache.commons.lang.StringUtils; -24 import org.rundeck.api.RundeckApiException.RundeckApiLoginException; -25 import org.rundeck.api.domain.RundeckAbort; -26 import org.rundeck.api.domain.RundeckExecution; -27 import org.rundeck.api.domain.RundeckExecution.ExecutionStatus; -28 import org.rundeck.api.domain.RundeckJob; -29 import org.rundeck.api.domain.RundeckNode; -30 import org.rundeck.api.domain.RundeckProject; -31 import org.rundeck.api.parser.AbortParser; -32 import org.rundeck.api.parser.ExecutionParser; -33 import org.rundeck.api.parser.JobParser; -34 import org.rundeck.api.parser.ListParser; -35 import org.rundeck.api.parser.NodeParser; -36 import org.rundeck.api.parser.ProjectParser; -37 import org.rundeck.api.util.AssertUtil; -38 import org.rundeck.api.util.ParametersUtil; -39 -40 /** -41 * Main entry point to talk to a RunDeck instance.<br> -42 * Usage : <br> -43 * <code> -44 * <pre> -45 * RundeckClient rundeck = new RundeckClient("http://localhost:4440", "admin", "admin"); -46 * List&lt;RundeckJob&gt; jobs = rundeck.getJobs(); -47 * -48 * RundeckJob job = rundeck.findJob("my-project", "main-group/sub-group", "job-name"); -49 * RundeckExecution execution = rundeck.triggerJob(job.getId(), -50 * new OptionsBuilder().addOption("version", "1.2.0").toProperties()); -51 * -52 * List&lt;RundeckExecution&gt; runningExecutions = rundeck.getRunningExecutions("my-project"); -53 * </pre> -54 * </code> -55 * -56 * @author Vincent Behar -57 */ -58 public class RundeckClient implements Serializable { -59 -60 private static final long serialVersionUID = 1L; -61 -62 public static final transient int API_VERSION = 1; -63 -64 public static final transient String API_ENDPOINT = "/api/" + API_VERSION; +18 import java.io.File; +19 import java.io.IOException; +20 import java.io.InputStream; +21 import java.io.Serializable; +22 import java.util.ArrayList; +23 import java.util.List; +24 import java.util.Properties; +25 import java.util.concurrent.TimeUnit; +26 import org.apache.commons.io.FileUtils; +27 import org.apache.commons.io.IOUtils; +28 import org.apache.commons.lang.StringUtils; +29 import org.rundeck.api.RundeckApiException.RundeckApiLoginException; +30 import org.rundeck.api.domain.RundeckAbort; +31 import org.rundeck.api.domain.RundeckExecution; +32 import org.rundeck.api.domain.RundeckJob; +33 import org.rundeck.api.domain.RundeckNode; +34 import org.rundeck.api.domain.RundeckProject; +35 import org.rundeck.api.domain.RundeckExecution.ExecutionStatus; +36 import org.rundeck.api.parser.AbortParser; +37 import org.rundeck.api.parser.ExecutionParser; +38 import org.rundeck.api.parser.JobParser; +39 import org.rundeck.api.parser.ListParser; +40 import org.rundeck.api.parser.NodeParser; +41 import org.rundeck.api.parser.ProjectParser; +42 import org.rundeck.api.parser.StringParser; +43 import org.rundeck.api.util.AssertUtil; +44 import org.rundeck.api.util.ParametersUtil; +45 +46 /** +47 * Main entry point to talk to a RunDeck instance.<br> +48 * Usage : <br> +49 * <code> +50 * <pre> +51 * RundeckClient rundeck = new RundeckClient("http://localhost:4440", "admin", "admin"); +52 * List&lt;RundeckJob&gt; jobs = rundeck.getJobs(); +53 * +54 * RundeckJob job = rundeck.findJob("my-project", "main-group/sub-group", "job-name"); +55 * RundeckExecution execution = rundeck.triggerJob(job.getId(), +56 * new OptionsBuilder().addOption("version", "1.2.0").toProperties()); +57 * +58 * List&lt;RundeckExecution&gt; runningExecutions = rundeck.getRunningExecutions("my-project"); +59 * </pre> +60 * </code> +61 * +62 * @author Vincent Behar +63 */ +64 public class RundeckClient implements Serializable { 65 -66 private final String url; +66 private static final long serialVersionUID = 1L; 67 -68 private final String login; +68 public static final transient int API_VERSION = 1; 69 -70 private final String password; +70 public static final transient String API_ENDPOINT = "/api/" + API_VERSION; 71 -72 /** -73 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url -74 * -75 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc) -76 * @param login -77 * @param password -78 * @throws IllegalArgumentException if the url, login or password is blank (null, empty or whitespace) -79 */ -80 public RundeckClient(String url, String login, String password) throws IllegalArgumentException { -81 super(); -82 this.url = url; -83 this.login = login; -84 this.password = password; -85 AssertUtil.notBlank(url, "The RunDeck URL is mandatory !"); -86 AssertUtil.notBlank(login, "The RunDeck login is mandatory !"); -87 AssertUtil.notBlank(password, "The RunDeck password is mandatory !"); -88 } -89 -90 /** -91 * Try to "ping" the RunDeck instance to see if it is alive -92 * -93 * @throws RundeckApiException if the ping fails -94 */ -95 public void ping() throws RundeckApiException { -96 new ApiCall(this).ping(); -97 } -98 -99 /** -100 * Test your credentials (login/password) on the RunDeck instance -101 * -102 * @throws RundeckApiLoginException if the login fails -103 */ -104 public void testCredentials() throws RundeckApiLoginException { -105 new ApiCall(this).testCredentials(); -106 } -107 -108 /* -109 * Projects -110 */ -111 -112 /** -113 * List all projects -114 * -115 * @return a {@link List} of {@link RundeckProject} : might be empty, but won't be null -116 * @throws RundeckApiException in case of error when calling the API -117 * @throws RundeckApiLoginException if the login failed -118 */ -119 public List<RundeckProject> getProjects() throws RundeckApiException, RundeckApiLoginException { -120 return new ApiCall(this).get(new ApiPathBuilder("/projects"), -121 new ListParser<RundeckProject>(new ProjectParser(), "result/projects/project")); -122 } -123 -124 /** -125 * Get the definition of a single project, identified by the given name -126 * -127 * @param projectName name of the project - mandatory -128 * @return a {@link RundeckProject} instance - won't be null -129 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -130 * @throws RundeckApiLoginException if the login failed -131 * @throws IllegalArgumentException if the projectName is blank (null, empty or whitespace) -132 */ -133 public RundeckProject getProject(String projectName) throws RundeckApiException, RundeckApiLoginException, -134 IllegalArgumentException { -135 AssertUtil.notBlank(projectName, "projectName is mandatory to get the details of a project !"); -136 return new ApiCall(this).get(new ApiPathBuilder("/project/", projectName), -137 new ProjectParser("result/projects/project")); -138 } -139 -140 /* -141 * Jobs -142 */ -143 -144 /** -145 * List all jobs (for all projects) -146 * -147 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null -148 * @throws RundeckApiException in case of error when calling the API -149 * @throws RundeckApiLoginException if the login failed -150 */ -151 public List<RundeckJob> getJobs() throws RundeckApiException, RundeckApiLoginException { -152 List<RundeckJob> jobs = new ArrayList<RundeckJob>(); -153 for (RundeckProject project : getProjects()) { -154 jobs.addAll(getJobs(project.getName())); -155 } -156 return jobs; -157 } -158 -159 /** -160 * List all jobs that belongs to the given project -161 * -162 * @param project name of the project - mandatory -163 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null -164 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -165 * @throws RundeckApiLoginException if the login failed -166 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -167 * @see #getJobs(String, String, String, String...) -168 */ -169 public List<RundeckJob> getJobs(String project) throws RundeckApiException, RundeckApiLoginException, -170 IllegalArgumentException { -171 return getJobs(project, null, null, new String[0]); -172 } -173 -174 /** -175 * List the jobs that belongs to the given project, and matches the given criteria (jobFilter, groupPath and jobIds) -176 * -177 * @param project name of the project - mandatory -178 * @param jobFilter a filter for the job Name - optional -179 * @param groupPath a group or partial group path to include all jobs within that group path - optional -180 * @param jobIds a list of Job IDs to include - optional -181 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null -182 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -183 * @throws RundeckApiLoginException if the login failed -184 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -185 * @see #getJobs(String) -186 */ -187 public List<RundeckJob> getJobs(String project, String jobFilter, String groupPath, String... jobIds) -188 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -189 AssertUtil.notBlank(project, "project is mandatory to get all jobs !"); -190 return new ApiCall(this).get(new ApiPathBuilder("/jobs").param("project", project) -191 .param("jobFilter", jobFilter) -192 .param("groupPath", groupPath) -193 .param("idlist", StringUtils.join(jobIds, ",")), -194 new ListParser<RundeckJob>(new JobParser(), "result/jobs/job")); -195 } -196 -197 /** -198 * Find a job, identified by its project, group and name. Note that the groupPath is optional, as a job does not -199 * need to belong to a group (either pass null, or an empty string). -200 * -201 * @param project name of the project - mandatory -202 * @param groupPath group to which the job belongs (if it belongs to a group) - optional -203 * @param name of the job to find - mandatory -204 * @return a {@link RundeckJob} instance - null if not found -205 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -206 * @throws RundeckApiLoginException if the login failed -207 * @throws IllegalArgumentException if the project or the name is blank (null, empty or whitespace) -208 */ -209 public RundeckJob findJob(String project, String groupPath, String name) throws RundeckApiException, -210 RundeckApiLoginException, IllegalArgumentException { -211 AssertUtil.notBlank(project, "project is mandatory to find a job !"); -212 AssertUtil.notBlank(name, "job name is mandatory to find a job !"); -213 List<RundeckJob> jobs = getJobs(project, name, groupPath, new String[0]); -214 return jobs.isEmpty() ? null : jobs.get(0); -215 } -216 -217 /** -218 * Get the definition of a single job, identified by the given ID -219 * -220 * @param jobId identifier of the job - mandatory -221 * @return a {@link RundeckJob} instance - won't be null -222 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -223 * @throws RundeckApiLoginException if the login failed -224 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -225 */ -226 public RundeckJob getJob(String jobId) throws RundeckApiException, RundeckApiLoginException, -227 IllegalArgumentException { -228 AssertUtil.notBlank(jobId, "jobId is mandatory to get the details of a job !"); -229 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId), new JobParser("joblist/job")); -230 } -231 -232 /** -233 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the -234 * end of the job execution) -235 * -236 * @param jobId identifier of the job - mandatory -237 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -238 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -239 * @throws RundeckApiLoginException if the login failed -240 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -241 * @see #triggerJob(String, Properties, Properties) -242 * @see #runJob(String) -243 */ -244 public RundeckExecution triggerJob(String jobId) throws RundeckApiException, RundeckApiLoginException, -245 IllegalArgumentException { -246 return triggerJob(jobId, null); -247 } -248 -249 /** -250 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the -251 * end of the job execution) -252 * -253 * @param jobId identifier of the job - mandatory -254 * @param options of the job - optional. See {@link OptionsBuilder}. -255 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -256 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -257 * @throws RundeckApiLoginException if the login failed -258 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -259 * @see #triggerJob(String, Properties, Properties) -260 * @see #runJob(String, Properties) -261 */ -262 public RundeckExecution triggerJob(String jobId, Properties options) throws RundeckApiException, -263 RundeckApiLoginException, IllegalArgumentException { -264 return triggerJob(jobId, options, null); -265 } -266 -267 /** -268 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the -269 * end of the job execution) -270 * -271 * @param jobId identifier of the job - mandatory -272 * @param options of the job - optional. See {@link OptionsBuilder}. -273 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See -274 * {@link NodeFiltersBuilder} -275 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -276 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -277 * @throws RundeckApiLoginException if the login failed -278 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -279 * @see #triggerJob(String) -280 * @see #runJob(String, Properties, Properties) -281 */ -282 public RundeckExecution triggerJob(String jobId, Properties options, Properties nodeFilters) -283 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -284 AssertUtil.notBlank(jobId, "jobId is mandatory to trigger a job !"); -285 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId, "/run").param("argString", -286 ParametersUtil.generateArgString(options)) -287 .nodeFilters(nodeFilters), -288 new ExecutionParser("result/executions/execution")); -289 } -290 -291 /** -292 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -293 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or -294 * aborted) or is still running. -295 * -296 * @param jobId identifier of the job - mandatory -297 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -298 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -299 * @throws RundeckApiLoginException if the login failed -300 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -301 * @see #triggerJob(String) -302 * @see #runJob(String, Properties, Properties, long, TimeUnit) -303 */ -304 public RundeckExecution runJob(String jobId) throws RundeckApiException, RundeckApiLoginException, -305 IllegalArgumentException { -306 return runJob(jobId, null); -307 } -308 -309 /** -310 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -311 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or -312 * aborted) or is still running. -313 * -314 * @param jobId identifier of the job - mandatory -315 * @param options of the job - optional. See {@link OptionsBuilder}. -316 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -317 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -318 * @throws RundeckApiLoginException if the login failed -319 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -320 * @see #triggerJob(String, Properties) -321 * @see #runJob(String, Properties, Properties, long, TimeUnit) -322 */ -323 public RundeckExecution runJob(String jobId, Properties options) throws RundeckApiException, -324 RundeckApiLoginException, IllegalArgumentException { -325 return runJob(jobId, options, null); -326 } -327 -328 /** -329 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -330 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or -331 * aborted) or is still running. -332 * -333 * @param jobId identifier of the job - mandatory -334 * @param options of the job - optional. See {@link OptionsBuilder}. -335 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See -336 * {@link NodeFiltersBuilder} -337 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +72 private final String url; +73 +74 private final String login; +75 +76 private final String password; +77 +78 /** +79 * Instantiate a new {@link RundeckClient} for the RunDeck instance at the given url +80 * +81 * @param url of the RunDeck instance ("http://localhost:4440", "http://rundeck.your-compagny.com/", etc) +82 * @param login +83 * @param password +84 * @throws IllegalArgumentException if the url, login or password is blank (null, empty or whitespace) +85 */ +86 public RundeckClient(String url, String login, String password) throws IllegalArgumentException { +87 super(); +88 this.url = url; +89 this.login = login; +90 this.password = password; +91 AssertUtil.notBlank(url, "The RunDeck URL is mandatory !"); +92 AssertUtil.notBlank(login, "The RunDeck login is mandatory !"); +93 AssertUtil.notBlank(password, "The RunDeck password is mandatory !"); +94 } +95 +96 /** +97 * Try to "ping" the RunDeck instance to see if it is alive +98 * +99 * @throws RundeckApiException if the ping fails +100 */ +101 public void ping() throws RundeckApiException { +102 new ApiCall(this).ping(); +103 } +104 +105 /** +106 * Test your credentials (login/password) on the RunDeck instance +107 * +108 * @throws RundeckApiLoginException if the login fails +109 */ +110 public void testCredentials() throws RundeckApiLoginException { +111 new ApiCall(this).testCredentials(); +112 } +113 +114 /* +115 * Projects +116 */ +117 +118 /** +119 * List all projects +120 * +121 * @return a {@link List} of {@link RundeckProject} : might be empty, but won't be null +122 * @throws RundeckApiException in case of error when calling the API +123 * @throws RundeckApiLoginException if the login failed +124 */ +125 public List<RundeckProject> getProjects() throws RundeckApiException, RundeckApiLoginException { +126 return new ApiCall(this).get(new ApiPathBuilder("/projects"), +127 new ListParser<RundeckProject>(new ProjectParser(), "result/projects/project")); +128 } +129 +130 /** +131 * Get the definition of a single project, identified by the given name +132 * +133 * @param projectName name of the project - mandatory +134 * @return a {@link RundeckProject} instance - won't be null +135 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +136 * @throws RundeckApiLoginException if the login failed +137 * @throws IllegalArgumentException if the projectName is blank (null, empty or whitespace) +138 */ +139 public RundeckProject getProject(String projectName) throws RundeckApiException, RundeckApiLoginException, +140 IllegalArgumentException { +141 AssertUtil.notBlank(projectName, "projectName is mandatory to get the details of a project !"); +142 return new ApiCall(this).get(new ApiPathBuilder("/project/", projectName), +143 new ProjectParser("result/projects/project")); +144 } +145 +146 /* +147 * Jobs +148 */ +149 +150 /** +151 * List all jobs (for all projects) +152 * +153 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null +154 * @throws RundeckApiException in case of error when calling the API +155 * @throws RundeckApiLoginException if the login failed +156 */ +157 public List<RundeckJob> getJobs() throws RundeckApiException, RundeckApiLoginException { +158 List<RundeckJob> jobs = new ArrayList<RundeckJob>(); +159 for (RundeckProject project : getProjects()) { +160 jobs.addAll(getJobs(project.getName())); +161 } +162 return jobs; +163 } +164 +165 /** +166 * List all jobs that belongs to the given project +167 * +168 * @param project name of the project - mandatory +169 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null +170 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +171 * @throws RundeckApiLoginException if the login failed +172 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +173 * @see #getJobs(String, String, String, String...) +174 */ +175 public List<RundeckJob> getJobs(String project) throws RundeckApiException, RundeckApiLoginException, +176 IllegalArgumentException { +177 return getJobs(project, null, null, new String[0]); +178 } +179 +180 /** +181 * List the jobs that belongs to the given project, and matches the given criteria (jobFilter, groupPath and jobIds) +182 * +183 * @param project name of the project - mandatory +184 * @param jobFilter a filter for the job Name - optional +185 * @param groupPath a group or partial group path to include all jobs within that group path - optional +186 * @param jobIds a list of Job IDs to include - optional +187 * @return a {@link List} of {@link RundeckJob} : might be empty, but won't be null +188 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +189 * @throws RundeckApiLoginException if the login failed +190 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +191 * @see #getJobs(String) +192 */ +193 public List<RundeckJob> getJobs(String project, String jobFilter, String groupPath, String... jobIds) +194 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +195 AssertUtil.notBlank(project, "project is mandatory to get all jobs !"); +196 return new ApiCall(this).get(new ApiPathBuilder("/jobs").param("project", project) +197 .param("jobFilter", jobFilter) +198 .param("groupPath", groupPath) +199 .param("idlist", StringUtils.join(jobIds, ",")), +200 new ListParser<RundeckJob>(new JobParser(), "result/jobs/job")); +201 } +202 +203 /** +204 * Export the definitions of all jobs that belongs to the given project, as an XML file +205 * +206 * @param filename path of the file where the content should be saved +207 * @param project name of the project - mandatory +208 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +209 * @throws RundeckApiLoginException if the login failed +210 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +211 * @throws IOException if we failed to write to the file +212 * @see #exportJobsToFile(String, String, String, String, String...) +213 * @see #exportJobs(String) +214 */ +215 public void exportJobsToFile(String filename, String project) throws RundeckApiException, RundeckApiLoginException, +216 IllegalArgumentException, IOException { +217 exportJobsToFile(filename, project, null, null, new String[0]); +218 } +219 +220 /** +221 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, +222 * groupPath and jobIds), as an XML file +223 * +224 * @param filename path of the file where the content should be saved +225 * @param project name of the project - mandatory +226 * @param jobFilter a filter for the job Name - optional +227 * @param groupPath a group or partial group path to include all jobs within that group path - optional +228 * @param jobIds a list of Job IDs to include - optional +229 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +230 * @throws RundeckApiLoginException if the login failed +231 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +232 * @throws IOException if we failed to write to the file +233 * @see #exportJobsToFile(String, String) +234 * @see #exportJobs(String, String, String, String...) +235 */ +236 public void exportJobsToFile(String filename, String project, String jobFilter, String groupPath, String... jobIds) +237 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException, IOException { +238 InputStream inputStream = exportJobs(project, jobFilter, groupPath, jobIds); +239 FileUtils.writeByteArrayToFile(new File(filename), IOUtils.toByteArray(inputStream)); +240 } +241 +242 /** +243 * Export the definitions of all jobs that belongs to the given project +244 * +245 * @param project name of the project - mandatory +246 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +247 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +248 * @throws RundeckApiLoginException if the login failed +249 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +250 * @see #exportJobs(String, String, String, String...) +251 * @see #exportJobsToFile(String, String) +252 */ +253 public InputStream exportJobs(String project) throws RundeckApiException, RundeckApiLoginException, +254 IllegalArgumentException { +255 return exportJobs(project, null, null, new String[0]); +256 } +257 +258 /** +259 * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, +260 * groupPath and jobIds) +261 * +262 * @param project name of the project - mandatory +263 * @param jobFilter a filter for the job Name - optional +264 * @param groupPath a group or partial group path to include all jobs within that group path - optional +265 * @param jobIds a list of Job IDs to include - optional +266 * @return an {@link InputStream} instance, not linked to any network resources - won't be null +267 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +268 * @throws RundeckApiLoginException if the login failed +269 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +270 * @see #exportJobs(String) +271 * @see #exportJobsToFile(String, String, String, String, String...) +272 */ +273 public InputStream exportJobs(String project, String jobFilter, String groupPath, String... jobIds) +274 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +275 AssertUtil.notBlank(project, "project is mandatory to export all jobs !"); +276 return new ApiCall(this).get(new ApiPathBuilder("/jobs/export").param("project", project) +277 .param("jobFilter", jobFilter) +278 .param("groupPath", groupPath) +279 .param("idlist", StringUtils.join(jobIds, ","))); +280 } +281 +282 /** +283 * Find a job, identified by its project, group and name. Note that the groupPath is optional, as a job does not +284 * need to belong to a group (either pass null, or an empty string). +285 * +286 * @param project name of the project - mandatory +287 * @param groupPath group to which the job belongs (if it belongs to a group) - optional +288 * @param name of the job to find - mandatory +289 * @return a {@link RundeckJob} instance - null if not found +290 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +291 * @throws RundeckApiLoginException if the login failed +292 * @throws IllegalArgumentException if the project or the name is blank (null, empty or whitespace) +293 */ +294 public RundeckJob findJob(String project, String groupPath, String name) throws RundeckApiException, +295 RundeckApiLoginException, IllegalArgumentException { +296 AssertUtil.notBlank(project, "project is mandatory to find a job !"); +297 AssertUtil.notBlank(name, "job name is mandatory to find a job !"); +298 List<RundeckJob> jobs = getJobs(project, name, groupPath, new String[0]); +299 return jobs.isEmpty() ? null : jobs.get(0); +300 } +301 +302 /** +303 * Get the definition of a single job, identified by the given ID +304 * +305 * @param jobId identifier of the job - mandatory +306 * @return a {@link RundeckJob} instance - won't be null +307 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +308 * @throws RundeckApiLoginException if the login failed +309 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +310 */ +311 public RundeckJob getJob(String jobId) throws RundeckApiException, RundeckApiLoginException, +312 IllegalArgumentException { +313 AssertUtil.notBlank(jobId, "jobId is mandatory to get the details of a job !"); +314 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId), new JobParser("joblist/job")); +315 } +316 +317 /** +318 * Delete a single job, identified by the given ID +319 * +320 * @param jobId identifier of the job - mandatory +321 * @return the success message (note that in case of error, you'll get an exception) +322 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +323 * @throws RundeckApiLoginException if the login failed +324 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +325 */ +326 public String deleteJob(String jobId) throws RundeckApiException, RundeckApiLoginException, +327 IllegalArgumentException { +328 AssertUtil.notBlank(jobId, "jobId is mandatory to delete a job !"); +329 return new ApiCall(this).delete(new ApiPathBuilder("/job/", jobId), new StringParser("result/success/message")); +330 } +331 +332 /** +333 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the +334 * end of the job execution) +335 * +336 * @param jobId identifier of the job - mandatory +337 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null 338 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) 339 * @throws RundeckApiLoginException if the login failed 340 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) 341 * @see #triggerJob(String, Properties, Properties) -342 * @see #runJob(String, Properties, Properties, long, TimeUnit) +342 * @see #runJob(String) 343 */ -344 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters) -345 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -346 return runJob(jobId, options, nodeFilters, 5, TimeUnit.SECONDS); +344 public RundeckExecution triggerJob(String jobId) throws RundeckApiException, RundeckApiLoginException, +345 IllegalArgumentException { +346 return triggerJob(jobId, null); 347 } 348 349 /** -350 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -351 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to -352 * know if the execution is finished (or aborted) or is still running. -353 * -354 * @param jobId identifier of the job - mandatory -355 * @param options of the job - optional. See {@link OptionsBuilder}. -356 * @param poolingInterval for checking the status of the execution. Must be > 0. -357 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -358 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -359 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -360 * @throws RundeckApiLoginException if the login failed -361 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -362 * @see #triggerJob(String, Properties) -363 * @see #runJob(String, Properties, Properties, long, TimeUnit) -364 */ -365 public RundeckExecution runJob(String jobId, Properties options, long poolingInterval, TimeUnit poolingUnit) -366 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -367 return runJob(jobId, options, null, poolingInterval, poolingUnit); -368 } -369 -370 /** -371 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. -372 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to -373 * know if the execution is finished (or aborted) or is still running. -374 * -375 * @param jobId identifier of the job - mandatory -376 * @param options of the job - optional. See {@link OptionsBuilder}. -377 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See -378 * {@link NodeFiltersBuilder} -379 * @param poolingInterval for checking the status of the execution. Must be > 0. -380 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -381 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -382 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -383 * @throws RundeckApiLoginException if the login failed -384 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -385 * @see #triggerJob(String, Properties) -386 * @see #runJob(String, Properties, Properties, long, TimeUnit) -387 */ -388 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters, long poolingInterval, -389 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -390 if (poolingInterval <= 0) { -391 poolingInterval = 5; -392 poolingUnit = TimeUnit.SECONDS; -393 } -394 if (poolingUnit == null) { -395 poolingUnit = TimeUnit.SECONDS; -396 } -397 -398 RundeckExecution execution = triggerJob(jobId, options, nodeFilters); -399 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { -400 try { -401 Thread.sleep(poolingUnit.toMillis(poolingInterval)); -402 } catch (InterruptedException e) { -403 break; -404 } -405 execution = getExecution(execution.getId()); -406 } -407 return execution; -408 } -409 -410 /* -411 * Ad-hoc commands -412 */ -413 -414 /** -415 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). -416 * The command will not be dispatched to nodes, but be executed on the RunDeck server. -417 * -418 * @param project name of the project - mandatory -419 * @param command to be executed - mandatory -420 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -421 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -422 * @throws RundeckApiLoginException if the login failed -423 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -424 * @see #triggerAdhocCommand(String, String, Properties) -425 * @see #runAdhocCommand(String, String) -426 */ -427 public RundeckExecution triggerAdhocCommand(String project, String command) throws RundeckApiException, -428 RundeckApiLoginException, IllegalArgumentException { -429 return triggerAdhocCommand(project, command, null); -430 } -431 -432 /** -433 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). -434 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -435 * -436 * @param project name of the project - mandatory -437 * @param command to be executed - mandatory -438 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -439 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null -440 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -441 * @throws RundeckApiLoginException if the login failed -442 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -443 * @see #triggerAdhocCommand(String, String) -444 * @see #runAdhocCommand(String, String, Properties) -445 */ -446 public RundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters) -447 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -448 AssertUtil.notBlank(project, "project is mandatory to trigger an ad-hoc command !"); -449 AssertUtil.notBlank(command, "command is mandatory to trigger an ad-hoc command !"); -450 RundeckExecution execution = new ApiCall(this).get(new ApiPathBuilder("/run/command").param("project", project) -451 .param("exec", command) -452 .nodeFilters(nodeFilters), -453 new ExecutionParser("result/execution")); -454 // the first call just returns the ID of the execution, so we need another call to get a "real" execution -455 return getExecution(execution.getId()); -456 } -457 -458 /** -459 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -460 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -461 * running. The command will not be dispatched to nodes, but be executed on the RunDeck server. -462 * -463 * @param project name of the project - mandatory -464 * @param command to be executed - mandatory -465 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -466 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -467 * @throws RundeckApiLoginException if the login failed -468 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -469 * @see #runAdhocCommand(String, String, Properties, long, TimeUnit) -470 * @see #triggerAdhocCommand(String, String) -471 */ -472 public RundeckExecution runAdhocCommand(String project, String command) throws RundeckApiException, -473 RundeckApiLoginException, IllegalArgumentException { -474 return runAdhocCommand(project, command, null); -475 } -476 -477 /** -478 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -479 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -480 * finished (or aborted) or is still running. The command will not be dispatched to nodes, but be executed on the -481 * RunDeck server. -482 * -483 * @param project name of the project - mandatory -484 * @param command to be executed - mandatory -485 * @param poolingInterval for checking the status of the execution. Must be > 0. -486 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -487 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -488 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -489 * @throws RundeckApiLoginException if the login failed -490 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -491 * @see #runAdhocCommand(String, String, Properties, long, TimeUnit) -492 * @see #triggerAdhocCommand(String, String) -493 */ -494 public RundeckExecution runAdhocCommand(String project, String command, long poolingInterval, TimeUnit poolingUnit) -495 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -496 return runAdhocCommand(project, command, null, poolingInterval, poolingUnit); -497 } -498 -499 /** -500 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -501 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still -502 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter. -503 * -504 * @param project name of the project - mandatory -505 * @param command to be executed - mandatory -506 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -507 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -508 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -509 * @throws RundeckApiLoginException if the login failed -510 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -511 * @see #runAdhocCommand(String, String, Properties, long, TimeUnit) -512 * @see #triggerAdhocCommand(String, String, Properties) -513 */ -514 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters) -515 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -516 return runAdhocCommand(project, command, nodeFilters, 5, TimeUnit.SECONDS); -517 } -518 -519 /** -520 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck -521 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is -522 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the -523 * nodeFilters parameter. -524 * -525 * @param project name of the project - mandatory -526 * @param command to be executed - mandatory -527 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} -528 * @param poolingInterval for checking the status of the execution. Must be > 0. -529 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. -530 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null -531 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -532 * @throws RundeckApiLoginException if the login failed -533 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) -534 * @see #triggerAdhocCommand(String, String, Properties) -535 */ -536 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, -537 long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, -538 IllegalArgumentException { -539 if (poolingInterval <= 0) { -540 poolingInterval = 5; -541 poolingUnit = TimeUnit.SECONDS; -542 } -543 if (poolingUnit == null) { -544 poolingUnit = TimeUnit.SECONDS; -545 } -546 -547 RundeckExecution execution = triggerAdhocCommand(project, command, nodeFilters); -548 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { -549 try { -550 Thread.sleep(poolingUnit.toMillis(poolingInterval)); -551 } catch (InterruptedException e) { -552 break; -553 } -554 execution = getExecution(execution.getId()); -555 } -556 return execution; -557 } -558 -559 /* -560 * Executions -561 */ -562 -563 /** -564 * Get all running executions (for all projects) -565 * -566 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -567 * @throws RundeckApiException in case of error when calling the API -568 * @throws RundeckApiLoginException if the login failed -569 */ -570 public List<RundeckExecution> getRunningExecutions() throws RundeckApiException, RundeckApiLoginException { -571 List<RundeckExecution> executions = new ArrayList<RundeckExecution>(); -572 for (RundeckProject project : getProjects()) { -573 executions.addAll(getRunningExecutions(project.getName())); -574 } -575 return executions; -576 } -577 -578 /** -579 * Get the running executions for the given project -580 * -581 * @param project name of the project - mandatory -582 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -583 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -584 * @throws RundeckApiLoginException if the login failed -585 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -586 */ -587 public List<RundeckExecution> getRunningExecutions(String project) throws RundeckApiException, -588 RundeckApiLoginException, IllegalArgumentException { -589 AssertUtil.notBlank(project, "project is mandatory get all running executions !"); -590 return new ApiCall(this).get(new ApiPathBuilder("/executions/running").param("project", project), -591 new ListParser<RundeckExecution>(new ExecutionParser(), -592 "result/executions/execution")); -593 } -594 -595 /** -596 * Get the executions of the given job -597 * -598 * @param jobId identifier of the job - mandatory -599 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -600 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -601 * @throws RundeckApiLoginException if the login failed -602 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -603 */ -604 public List<RundeckExecution> getJobExecutions(String jobId) throws RundeckApiException, RundeckApiLoginException, -605 IllegalArgumentException { -606 return getJobExecutions(jobId, null); -607 } -608 -609 /** -610 * Get the executions of the given job -611 * -612 * @param jobId identifier of the job - mandatory -613 * @param status of the executions - optional (null for all) -614 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -615 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -616 * @throws RundeckApiLoginException if the login failed -617 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) -618 */ -619 public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status) throws RundeckApiException, -620 RundeckApiLoginException, IllegalArgumentException { -621 return getJobExecutions(jobId, status, null, null); -622 } -623 -624 /** -625 * Get the executions of the given job -626 * -627 * @param jobId identifier of the job - mandatory -628 * @param status of the executions - optional (null for all) -629 * @param max number of results to return - optional (null for all) -630 * @param offset the 0-indexed offset for the first result to return - optional -631 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null -632 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) -633 * @throws RundeckApiLoginException if the login failed -634 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +350 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the +351 * end of the job execution) +352 * +353 * @param jobId identifier of the job - mandatory +354 * @param options of the job - optional. See {@link OptionsBuilder}. +355 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +356 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +357 * @throws RundeckApiLoginException if the login failed +358 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +359 * @see #triggerJob(String, Properties, Properties) +360 * @see #runJob(String, Properties) +361 */ +362 public RundeckExecution triggerJob(String jobId, Properties options) throws RundeckApiException, +363 RundeckApiLoginException, IllegalArgumentException { +364 return triggerJob(jobId, options, null); +365 } +366 +367 /** +368 * Trigger the execution of a RunDeck job (identified by the given ID), and return immediately (without waiting the +369 * end of the job execution) +370 * +371 * @param jobId identifier of the job - mandatory +372 * @param options of the job - optional. See {@link OptionsBuilder}. +373 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See +374 * {@link NodeFiltersBuilder} +375 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +376 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +377 * @throws RundeckApiLoginException if the login failed +378 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +379 * @see #triggerJob(String) +380 * @see #runJob(String, Properties, Properties) +381 */ +382 public RundeckExecution triggerJob(String jobId, Properties options, Properties nodeFilters) +383 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +384 AssertUtil.notBlank(jobId, "jobId is mandatory to trigger a job !"); +385 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId, "/run").param("argString", +386 ParametersUtil.generateArgString(options)) +387 .nodeFilters(nodeFilters), +388 new ExecutionParser("result/executions/execution")); +389 } +390 +391 /** +392 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +393 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or +394 * aborted) or is still running. +395 * +396 * @param jobId identifier of the job - mandatory +397 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +398 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +399 * @throws RundeckApiLoginException if the login failed +400 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +401 * @see #triggerJob(String) +402 * @see #runJob(String, Properties, Properties, long, TimeUnit) +403 */ +404 public RundeckExecution runJob(String jobId) throws RundeckApiException, RundeckApiLoginException, +405 IllegalArgumentException { +406 return runJob(jobId, null); +407 } +408 +409 /** +410 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +411 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or +412 * aborted) or is still running. +413 * +414 * @param jobId identifier of the job - mandatory +415 * @param options of the job - optional. See {@link OptionsBuilder}. +416 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +417 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +418 * @throws RundeckApiLoginException if the login failed +419 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +420 * @see #triggerJob(String, Properties) +421 * @see #runJob(String, Properties, Properties, long, TimeUnit) +422 */ +423 public RundeckExecution runJob(String jobId, Properties options) throws RundeckApiException, +424 RundeckApiLoginException, IllegalArgumentException { +425 return runJob(jobId, options, null); +426 } +427 +428 /** +429 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +430 * We will poll the RunDeck server at regular interval (every 5 seconds) to know if the execution is finished (or +431 * aborted) or is still running. +432 * +433 * @param jobId identifier of the job - mandatory +434 * @param options of the job - optional. See {@link OptionsBuilder}. +435 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See +436 * {@link NodeFiltersBuilder} +437 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +438 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +439 * @throws RundeckApiLoginException if the login failed +440 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +441 * @see #triggerJob(String, Properties, Properties) +442 * @see #runJob(String, Properties, Properties, long, TimeUnit) +443 */ +444 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters) +445 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +446 return runJob(jobId, options, nodeFilters, 5, TimeUnit.SECONDS); +447 } +448 +449 /** +450 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +451 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to +452 * know if the execution is finished (or aborted) or is still running. +453 * +454 * @param jobId identifier of the job - mandatory +455 * @param options of the job - optional. See {@link OptionsBuilder}. +456 * @param poolingInterval for checking the status of the execution. Must be > 0. +457 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +458 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +459 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +460 * @throws RundeckApiLoginException if the login failed +461 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +462 * @see #triggerJob(String, Properties) +463 * @see #runJob(String, Properties, Properties, long, TimeUnit) +464 */ +465 public RundeckExecution runJob(String jobId, Properties options, long poolingInterval, TimeUnit poolingUnit) +466 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +467 return runJob(jobId, options, null, poolingInterval, poolingUnit); +468 } +469 +470 /** +471 * Run a RunDeck job (identified by the given ID), and wait until its execution is finished (or aborted) to return. +472 * We will poll the RunDeck server at regular interval (configured by the poolingInterval/poolingUnit couple) to +473 * know if the execution is finished (or aborted) or is still running. +474 * +475 * @param jobId identifier of the job - mandatory +476 * @param options of the job - optional. See {@link OptionsBuilder}. +477 * @param nodeFilters for overriding the nodes on which the job will be executed - optional. See +478 * {@link NodeFiltersBuilder} +479 * @param poolingInterval for checking the status of the execution. Must be > 0. +480 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +481 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +482 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +483 * @throws RundeckApiLoginException if the login failed +484 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +485 * @see #triggerJob(String, Properties) +486 * @see #runJob(String, Properties, Properties, long, TimeUnit) +487 */ +488 public RundeckExecution runJob(String jobId, Properties options, Properties nodeFilters, long poolingInterval, +489 TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +490 if (poolingInterval <= 0) { +491 poolingInterval = 5; +492 poolingUnit = TimeUnit.SECONDS; +493 } +494 if (poolingUnit == null) { +495 poolingUnit = TimeUnit.SECONDS; +496 } +497 +498 RundeckExecution execution = triggerJob(jobId, options, nodeFilters); +499 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { +500 try { +501 Thread.sleep(poolingUnit.toMillis(poolingInterval)); +502 } catch (InterruptedException e) { +503 break; +504 } +505 execution = getExecution(execution.getId()); +506 } +507 return execution; +508 } +509 +510 /* +511 * Ad-hoc commands +512 */ +513 +514 /** +515 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). +516 * The command will not be dispatched to nodes, but be executed on the RunDeck server. +517 * +518 * @param project name of the project - mandatory +519 * @param command to be executed - mandatory +520 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +521 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +522 * @throws RundeckApiLoginException if the login failed +523 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +524 * @see #triggerAdhocCommand(String, String, Properties) +525 * @see #runAdhocCommand(String, String) +526 */ +527 public RundeckExecution triggerAdhocCommand(String project, String command) throws RundeckApiException, +528 RundeckApiLoginException, IllegalArgumentException { +529 return triggerAdhocCommand(project, command, null); +530 } +531 +532 /** +533 * Trigger the execution of an ad-hoc command, and return immediately (without waiting the end of the execution). +534 * The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +535 * +536 * @param project name of the project - mandatory +537 * @param command to be executed - mandatory +538 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +539 * @return a {@link RundeckExecution} instance for the newly created (and running) execution - won't be null +540 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +541 * @throws RundeckApiLoginException if the login failed +542 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +543 * @see #triggerAdhocCommand(String, String) +544 * @see #runAdhocCommand(String, String, Properties) +545 */ +546 public RundeckExecution triggerAdhocCommand(String project, String command, Properties nodeFilters) +547 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +548 AssertUtil.notBlank(project, "project is mandatory to trigger an ad-hoc command !"); +549 AssertUtil.notBlank(command, "command is mandatory to trigger an ad-hoc command !"); +550 RundeckExecution execution = new ApiCall(this).get(new ApiPathBuilder("/run/command").param("project", project) +551 .param("exec", command) +552 .nodeFilters(nodeFilters), +553 new ExecutionParser("result/execution")); +554 // the first call just returns the ID of the execution, so we need another call to get a "real" execution +555 return getExecution(execution.getId()); +556 } +557 +558 /** +559 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +560 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +561 * running. The command will not be dispatched to nodes, but be executed on the RunDeck server. +562 * +563 * @param project name of the project - mandatory +564 * @param command to be executed - mandatory +565 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +566 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +567 * @throws RundeckApiLoginException if the login failed +568 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +569 * @see #runAdhocCommand(String, String, Properties, long, TimeUnit) +570 * @see #triggerAdhocCommand(String, String) +571 */ +572 public RundeckExecution runAdhocCommand(String project, String command) throws RundeckApiException, +573 RundeckApiLoginException, IllegalArgumentException { +574 return runAdhocCommand(project, command, null); +575 } +576 +577 /** +578 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +579 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +580 * finished (or aborted) or is still running. The command will not be dispatched to nodes, but be executed on the +581 * RunDeck server. +582 * +583 * @param project name of the project - mandatory +584 * @param command to be executed - mandatory +585 * @param poolingInterval for checking the status of the execution. Must be > 0. +586 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +587 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +588 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +589 * @throws RundeckApiLoginException if the login failed +590 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +591 * @see #runAdhocCommand(String, String, Properties, long, TimeUnit) +592 * @see #triggerAdhocCommand(String, String) +593 */ +594 public RundeckExecution runAdhocCommand(String project, String command, long poolingInterval, TimeUnit poolingUnit) +595 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +596 return runAdhocCommand(project, command, null, poolingInterval, poolingUnit); +597 } +598 +599 /** +600 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +601 * server at regular interval (every 5 seconds) to know if the execution is finished (or aborted) or is still +602 * running. The command will be dispatched to nodes, accordingly to the nodeFilters parameter. +603 * +604 * @param project name of the project - mandatory +605 * @param command to be executed - mandatory +606 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +607 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +608 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +609 * @throws RundeckApiLoginException if the login failed +610 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +611 * @see #runAdhocCommand(String, String, Properties, long, TimeUnit) +612 * @see #triggerAdhocCommand(String, String, Properties) +613 */ +614 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters) +615 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +616 return runAdhocCommand(project, command, nodeFilters, 5, TimeUnit.SECONDS); +617 } +618 +619 /** +620 * Run an ad-hoc command, and wait until its execution is finished (or aborted) to return. We will poll the RunDeck +621 * server at regular interval (configured by the poolingInterval/poolingUnit couple) to know if the execution is +622 * finished (or aborted) or is still running. The command will be dispatched to nodes, accordingly to the +623 * nodeFilters parameter. +624 * +625 * @param project name of the project - mandatory +626 * @param command to be executed - mandatory +627 * @param nodeFilters for selecting nodes on which the command will be executed. See {@link NodeFiltersBuilder} +628 * @param poolingInterval for checking the status of the execution. Must be > 0. +629 * @param poolingUnit unit (seconds, milli-seconds, ...) of the interval. Default to seconds. +630 * @return a {@link RundeckExecution} instance for the (finished/aborted) execution - won't be null +631 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +632 * @throws RundeckApiLoginException if the login failed +633 * @throws IllegalArgumentException if the project or command is blank (null, empty or whitespace) +634 * @see #triggerAdhocCommand(String, String, Properties) 635 */ -636 public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status, Long max, Long offset) -637 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { -638 AssertUtil.notBlank(jobId, "jobId is mandatory to get the executions of a job !"); -639 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId, "/executions").param("status", -640 status != null ? StringUtils.lowerCase(status.toString()) : null) -641 .param("max", max) -642 .param("offset", offset), -643 new ListParser<RundeckExecution>(new ExecutionParser(), -644 "result/executions/execution")); -645 } +636 public RundeckExecution runAdhocCommand(String project, String command, Properties nodeFilters, +637 long poolingInterval, TimeUnit poolingUnit) throws RundeckApiException, RundeckApiLoginException, +638 IllegalArgumentException { +639 if (poolingInterval <= 0) { +640 poolingInterval = 5; +641 poolingUnit = TimeUnit.SECONDS; +642 } +643 if (poolingUnit == null) { +644 poolingUnit = TimeUnit.SECONDS; +645 } 646 -647 /** -648 * Get a single execution, identified by the given ID -649 * -650 * @param executionId identifier of the execution - mandatory -651 * @return a {@link RundeckExecution} instance - won't be null -652 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) -653 * @throws RundeckApiLoginException if the login failed -654 * @throws IllegalArgumentException if the executionId is null -655 */ -656 public RundeckExecution getExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException, -657 IllegalArgumentException { -658 AssertUtil.notNull(executionId, "executionId is mandatory to get the details of an execution !"); -659 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString()), -660 new ExecutionParser("result/executions/execution")); -661 } +647 RundeckExecution execution = triggerAdhocCommand(project, command, nodeFilters); +648 while (ExecutionStatus.RUNNING.equals(execution.getStatus())) { +649 try { +650 Thread.sleep(poolingUnit.toMillis(poolingInterval)); +651 } catch (InterruptedException e) { +652 break; +653 } +654 execution = getExecution(execution.getId()); +655 } +656 return execution; +657 } +658 +659 /* +660 * Executions +661 */ 662 663 /** -664 * Abort an execution (identified by the given ID). The execution should be running... +664 * Get all running executions (for all projects) 665 * -666 * @param executionId identifier of the execution - mandatory -667 * @return a {@link RundeckAbort} instance - won't be null -668 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) -669 * @throws RundeckApiLoginException if the login failed -670 * @throws IllegalArgumentException if the executionId is null -671 */ -672 public RundeckAbort abortExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException, -673 IllegalArgumentException { -674 AssertUtil.notNull(executionId, "executionId is mandatory to abort an execution !"); -675 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/abort"), -676 new AbortParser("result/abort")); -677 } -678 -679 /* -680 * Nodes -681 */ -682 -683 /** -684 * List all nodes (for all projects) -685 * -686 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null -687 * @throws RundeckApiException in case of error when calling the API -688 * @throws RundeckApiLoginException if the login failed -689 */ -690 public List<RundeckNode> getNodes() throws RundeckApiException, RundeckApiLoginException { -691 List<RundeckNode> nodes = new ArrayList<RundeckNode>(); -692 for (RundeckProject project : getProjects()) { -693 nodes.addAll(getNodes(project.getName())); -694 } -695 return nodes; -696 } -697 -698 /** -699 * List all nodes that belongs to the given project -700 * -701 * @param project name of the project - mandatory -702 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null -703 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -704 * @throws RundeckApiLoginException if the login failed -705 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -706 * @see #getNodes(String, Properties) -707 */ -708 public List<RundeckNode> getNodes(String project) throws RundeckApiException, RundeckApiLoginException, -709 IllegalArgumentException { -710 return getNodes(project, null); -711 } -712 -713 /** -714 * List nodes that belongs to the given project -715 * -716 * @param project name of the project - mandatory -717 * @param nodeFilters for filtering the nodes - optional. See {@link NodeFiltersBuilder} -718 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null -719 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) -720 * @throws RundeckApiLoginException if the login failed -721 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) -722 */ -723 public List<RundeckNode> getNodes(String project, Properties nodeFilters) throws RundeckApiException, -724 RundeckApiLoginException, IllegalArgumentException { -725 AssertUtil.notBlank(project, "project is mandatory to get all nodes !"); -726 return new ApiCall(this).get(new ApiPathBuilder("/resources").param("project", project) -727 .nodeFilters(nodeFilters), -728 new ListParser<RundeckNode>(new NodeParser(), "project/node")); -729 } -730 -731 /** -732 * Get the definition of a single node -733 * -734 * @param name of the node - mandatory -735 * @param project name of the project - mandatory -736 * @return a {@link RundeckNode} instance - won't be null -737 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) -738 * @throws RundeckApiLoginException if the login failed -739 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) -740 */ -741 public RundeckNode getNode(String name, String project) throws RundeckApiException, RundeckApiLoginException, -742 IllegalArgumentException { -743 AssertUtil.notBlank(name, "the name of the node is mandatory to get a node !"); -744 AssertUtil.notBlank(project, "project is mandatory to get a node !"); -745 return new ApiCall(this).get(new ApiPathBuilder("/resource/", name).param("project", project), -746 new NodeParser("project/node")); -747 } -748 -749 public String getUrl() { -750 return url; -751 } -752 -753 public String getLogin() { -754 return login; -755 } -756 -757 public String getPassword() { -758 return password; -759 } -760 -761 @Override -762 public String toString() { -763 return "RundeckClient [url=" + url + ", login=" + login + ", password=" + password + "]"; -764 } -765 -766 @Override -767 public int hashCode() { -768 final int prime = 31; -769 int result = 1; -770 result = prime * result + ((login == null) ? 0 : login.hashCode()); -771 result = prime * result + ((password == null) ? 0 : password.hashCode()); -772 result = prime * result + ((url == null) ? 0 : url.hashCode()); -773 return result; -774 } -775 -776 @Override -777 public boolean equals(Object obj) { -778 if (this == obj) -779 return true; -780 if (obj == null) -781 return false; -782 if (getClass() != obj.getClass()) -783 return false; -784 RundeckClient other = (RundeckClient) obj; -785 if (login == null) { -786 if (other.login != null) -787 return false; -788 } else if (!login.equals(other.login)) -789 return false; -790 if (password == null) { -791 if (other.password != null) -792 return false; -793 } else if (!password.equals(other.password)) -794 return false; -795 if (url == null) { -796 if (other.url != null) -797 return false; -798 } else if (!url.equals(other.url)) -799 return false; -800 return true; -801 } -802 -803 } +666 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +667 * @throws RundeckApiException in case of error when calling the API +668 * @throws RundeckApiLoginException if the login failed +669 */ +670 public List<RundeckExecution> getRunningExecutions() throws RundeckApiException, RundeckApiLoginException { +671 List<RundeckExecution> executions = new ArrayList<RundeckExecution>(); +672 for (RundeckProject project : getProjects()) { +673 executions.addAll(getRunningExecutions(project.getName())); +674 } +675 return executions; +676 } +677 +678 /** +679 * Get the running executions for the given project +680 * +681 * @param project name of the project - mandatory +682 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +683 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +684 * @throws RundeckApiLoginException if the login failed +685 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +686 */ +687 public List<RundeckExecution> getRunningExecutions(String project) throws RundeckApiException, +688 RundeckApiLoginException, IllegalArgumentException { +689 AssertUtil.notBlank(project, "project is mandatory get all running executions !"); +690 return new ApiCall(this).get(new ApiPathBuilder("/executions/running").param("project", project), +691 new ListParser<RundeckExecution>(new ExecutionParser(), +692 "result/executions/execution")); +693 } +694 +695 /** +696 * Get the executions of the given job +697 * +698 * @param jobId identifier of the job - mandatory +699 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +700 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +701 * @throws RundeckApiLoginException if the login failed +702 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +703 */ +704 public List<RundeckExecution> getJobExecutions(String jobId) throws RundeckApiException, RundeckApiLoginException, +705 IllegalArgumentException { +706 return getJobExecutions(jobId, null); +707 } +708 +709 /** +710 * Get the executions of the given job +711 * +712 * @param jobId identifier of the job - mandatory +713 * @param status of the executions - optional (null for all) +714 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +715 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +716 * @throws RundeckApiLoginException if the login failed +717 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +718 */ +719 public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status) throws RundeckApiException, +720 RundeckApiLoginException, IllegalArgumentException { +721 return getJobExecutions(jobId, status, null, null); +722 } +723 +724 /** +725 * Get the executions of the given job +726 * +727 * @param jobId identifier of the job - mandatory +728 * @param status of the executions - optional (null for all) +729 * @param max number of results to return - optional (null for all) +730 * @param offset the 0-indexed offset for the first result to return - optional +731 * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null +732 * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) +733 * @throws RundeckApiLoginException if the login failed +734 * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) +735 */ +736 public List<RundeckExecution> getJobExecutions(String jobId, ExecutionStatus status, Long max, Long offset) +737 throws RundeckApiException, RundeckApiLoginException, IllegalArgumentException { +738 AssertUtil.notBlank(jobId, "jobId is mandatory to get the executions of a job !"); +739 return new ApiCall(this).get(new ApiPathBuilder("/job/", jobId, "/executions").param("status", +740 status != null ? StringUtils.lowerCase(status.toString()) : null) +741 .param("max", max) +742 .param("offset", offset), +743 new ListParser<RundeckExecution>(new ExecutionParser(), +744 "result/executions/execution")); +745 } +746 +747 /** +748 * Get a single execution, identified by the given ID +749 * +750 * @param executionId identifier of the execution - mandatory +751 * @return a {@link RundeckExecution} instance - won't be null +752 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) +753 * @throws RundeckApiLoginException if the login failed +754 * @throws IllegalArgumentException if the executionId is null +755 */ +756 public RundeckExecution getExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException, +757 IllegalArgumentException { +758 AssertUtil.notNull(executionId, "executionId is mandatory to get the details of an execution !"); +759 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString()), +760 new ExecutionParser("result/executions/execution")); +761 } +762 +763 /** +764 * Abort an execution (identified by the given ID). The execution should be running... +765 * +766 * @param executionId identifier of the execution - mandatory +767 * @return a {@link RundeckAbort} instance - won't be null +768 * @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID) +769 * @throws RundeckApiLoginException if the login failed +770 * @throws IllegalArgumentException if the executionId is null +771 */ +772 public RundeckAbort abortExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException, +773 IllegalArgumentException { +774 AssertUtil.notNull(executionId, "executionId is mandatory to abort an execution !"); +775 return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/abort"), +776 new AbortParser("result/abort")); +777 } +778 +779 /* +780 * Nodes +781 */ +782 +783 /** +784 * List all nodes (for all projects) +785 * +786 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null +787 * @throws RundeckApiException in case of error when calling the API +788 * @throws RundeckApiLoginException if the login failed +789 */ +790 public List<RundeckNode> getNodes() throws RundeckApiException, RundeckApiLoginException { +791 List<RundeckNode> nodes = new ArrayList<RundeckNode>(); +792 for (RundeckProject project : getProjects()) { +793 nodes.addAll(getNodes(project.getName())); +794 } +795 return nodes; +796 } +797 +798 /** +799 * List all nodes that belongs to the given project +800 * +801 * @param project name of the project - mandatory +802 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null +803 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +804 * @throws RundeckApiLoginException if the login failed +805 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +806 * @see #getNodes(String, Properties) +807 */ +808 public List<RundeckNode> getNodes(String project) throws RundeckApiException, RundeckApiLoginException, +809 IllegalArgumentException { +810 return getNodes(project, null); +811 } +812 +813 /** +814 * List nodes that belongs to the given project +815 * +816 * @param project name of the project - mandatory +817 * @param nodeFilters for filtering the nodes - optional. See {@link NodeFiltersBuilder} +818 * @return a {@link List} of {@link RundeckNode} : might be empty, but won't be null +819 * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) +820 * @throws RundeckApiLoginException if the login failed +821 * @throws IllegalArgumentException if the project is blank (null, empty or whitespace) +822 */ +823 public List<RundeckNode> getNodes(String project, Properties nodeFilters) throws RundeckApiException, +824 RundeckApiLoginException, IllegalArgumentException { +825 AssertUtil.notBlank(project, "project is mandatory to get all nodes !"); +826 return new ApiCall(this).get(new ApiPathBuilder("/resources").param("project", project) +827 .nodeFilters(nodeFilters), +828 new ListParser<RundeckNode>(new NodeParser(), "project/node")); +829 } +830 +831 /** +832 * Get the definition of a single node +833 * +834 * @param name of the node - mandatory +835 * @param project name of the project - mandatory +836 * @return a {@link RundeckNode} instance - won't be null +837 * @throws RundeckApiException in case of error when calling the API (non-existent name or project with this name) +838 * @throws RundeckApiLoginException if the login failed +839 * @throws IllegalArgumentException if the name or project is blank (null, empty or whitespace) +840 */ +841 public RundeckNode getNode(String name, String project) throws RundeckApiException, RundeckApiLoginException, +842 IllegalArgumentException { +843 AssertUtil.notBlank(name, "the name of the node is mandatory to get a node !"); +844 AssertUtil.notBlank(project, "project is mandatory to get a node !"); +845 return new ApiCall(this).get(new ApiPathBuilder("/resource/", name).param("project", project), +846 new NodeParser("project/node")); +847 } +848 +849 public String getUrl() { +850 return url; +851 } +852 +853 public String getLogin() { +854 return login; +855 } +856 +857 public String getPassword() { +858 return password; +859 } +860 +861 @Override +862 public String toString() { +863 return "RundeckClient [url=" + url + ", login=" + login + ", password=" + password + "]"; +864 } +865 +866 @Override +867 public int hashCode() { +868 final int prime = 31; +869 int result = 1; +870 result = prime * result + ((login == null) ? 0 : login.hashCode()); +871 result = prime * result + ((password == null) ? 0 : password.hashCode()); +872 result = prime * result + ((url == null) ? 0 : url.hashCode()); +873 return result; +874 } +875 +876 @Override +877 public boolean equals(Object obj) { +878 if (this == obj) +879 return true; +880 if (obj == null) +881 return false; +882 if (getClass() != obj.getClass()) +883 return false; +884 RundeckClient other = (RundeckClient) obj; +885 if (login == null) { +886 if (other.login != null) +887 return false; +888 } else if (!login.equals(other.login)) +889 return false; +890 if (password == null) { +891 if (other.password != null) +892 return false; +893 } else if (!password.equals(other.password)) +894 return false; +895 if (url == null) { +896 if (other.url != null) +897 return false; +898 } else if (!url.equals(other.url)) +899 return false; +900 return true; +901 } +902 +903 }
    diff --git a/xref/org/rundeck/api/domain/RundeckExecution.html b/xref/org/rundeck/api/domain/RundeckExecution.html index 96babd0..1f56d7b 100644 --- a/xref/org/rundeck/api/domain/RundeckExecution.html +++ b/xref/org/rundeck/api/domain/RundeckExecution.html @@ -28,227 +28,252 @@ 18 import java.io.Serializable; 19 import java.util.Date; 20 import java.util.concurrent.TimeUnit; -21 -22 /** -23 * Represents a RunDeck execution, usually triggered by an API call. An execution could be a {@link RundeckJob} -24 * execution or an "ad-hoc" execution. -25 * -26 * @author Vincent Behar -27 */ -28 public class RundeckExecution implements Serializable { -29 -30 private static final long serialVersionUID = 1L; -31 -32 private Long id; -33 -34 private String url; -35 -36 private ExecutionStatus status; -37 -38 /** Optional - only if it is a job execution */ -39 private RundeckJob job; -40 -41 private String startedBy; -42 -43 private Date startedAt; -44 -45 /** only if the execution has ended */ -46 private Date endedAt; -47 -48 /** only if the execution was aborted */ -49 private String abortedBy; -50 -51 private String description; -52 -53 /** -54 * @return the duration of the execution in milliseconds (or null if the duration is still running, or has been -55 * aborted) -56 */ -57 public Long getDurationInMillis() { -58 if (startedAt == null || endedAt == null) { -59 return null; -60 } -61 return endedAt.getTime() - startedAt.getTime(); -62 } -63 -64 /** -65 * @return the duration of the execution in seconds (or null if the duration is still running, or has been aborted) -66 */ -67 public Long getDurationInSeconds() { -68 Long durationInMillis = getDurationInMillis(); -69 if (durationInMillis == null) { -70 return null; -71 } -72 return TimeUnit.MILLISECONDS.toSeconds(durationInMillis); -73 } -74 -75 public Long getId() { -76 return id; -77 } -78 -79 public void setId(Long id) { -80 this.id = id; -81 } -82 -83 public String getUrl() { -84 return url; -85 } -86 -87 public void setUrl(String url) { -88 this.url = url; -89 } -90 -91 /** -92 * @return the status of the execution - see {@link ExecutionStatus} -93 */ -94 public ExecutionStatus getStatus() { -95 return status; -96 } -97 -98 public void setStatus(ExecutionStatus status) { -99 this.status = status; -100 } -101 -102 /** -103 * @return the {@link RundeckJob} associated with this execution, or null in the case of an ad-hoc execution -104 * (command or script) -105 */ -106 public RundeckJob getJob() { -107 return job; -108 } -109 -110 public void setJob(RundeckJob job) { -111 this.job = job; -112 } -113 -114 public String getStartedBy() { -115 return startedBy; -116 } -117 -118 public void setStartedBy(String startedBy) { -119 this.startedBy = startedBy; -120 } -121 -122 public Date getStartedAt() { -123 return (startedAt != null) ? new Date(startedAt.getTime()) : null; -124 } -125 -126 public void setStartedAt(Date startedAt) { -127 this.startedAt = ((startedAt != null) ? new Date(startedAt.getTime()) : null); -128 } -129 -130 public Date getEndedAt() { -131 return (endedAt != null) ? new Date(endedAt.getTime()) : null; -132 } -133 -134 public void setEndedAt(Date endedAt) { -135 this.endedAt = ((endedAt != null) ? new Date(endedAt.getTime()) : null); -136 } -137 -138 public String getAbortedBy() { -139 return abortedBy; -140 } -141 -142 public void setAbortedBy(String abortedBy) { -143 this.abortedBy = abortedBy; -144 } -145 -146 public String getDescription() { -147 return description; -148 } -149 -150 public void setDescription(String description) { -151 this.description = description; -152 } -153 -154 @Override -155 public String toString() { -156 return "RundeckExecution [id=" + id + ", description=" + description + ", url=" + url + ", status=" + status -157 + ", startedBy=" + startedBy + ", startedAt=" + startedAt + ", endedAt=" + endedAt -158 + ", durationInSeconds=" + getDurationInSeconds() + ", abortedBy=" + abortedBy + ", job=" + job + "]"; -159 } -160 -161 @Override -162 public int hashCode() { -163 final int prime = 31; -164 int result = 1; -165 result = prime * result + ((abortedBy == null) ? 0 : abortedBy.hashCode()); -166 result = prime * result + ((description == null) ? 0 : description.hashCode()); -167 result = prime * result + ((endedAt == null) ? 0 : endedAt.hashCode()); -168 result = prime * result + ((id == null) ? 0 : id.hashCode()); -169 result = prime * result + ((job == null) ? 0 : job.hashCode()); -170 result = prime * result + ((startedAt == null) ? 0 : startedAt.hashCode()); -171 result = prime * result + ((startedBy == null) ? 0 : startedBy.hashCode()); -172 result = prime * result + ((status == null) ? 0 : status.hashCode()); -173 result = prime * result + ((url == null) ? 0 : url.hashCode()); -174 return result; -175 } -176 -177 @Override -178 public boolean equals(Object obj) { -179 if (this == obj) -180 return true; -181 if (obj == null) -182 return false; -183 if (getClass() != obj.getClass()) -184 return false; -185 RundeckExecution other = (RundeckExecution) obj; -186 if (abortedBy == null) { -187 if (other.abortedBy != null) -188 return false; -189 } else if (!abortedBy.equals(other.abortedBy)) -190 return false; -191 if (description == null) { -192 if (other.description != null) -193 return false; -194 } else if (!description.equals(other.description)) -195 return false; -196 if (endedAt == null) { -197 if (other.endedAt != null) -198 return false; -199 } else if (!endedAt.equals(other.endedAt)) -200 return false; -201 if (id == null) { -202 if (other.id != null) -203 return false; -204 } else if (!id.equals(other.id)) -205 return false; -206 if (job == null) { -207 if (other.job != null) -208 return false; -209 } else if (!job.equals(other.job)) -210 return false; -211 if (startedAt == null) { -212 if (other.startedAt != null) +21 import org.apache.commons.lang.time.DurationFormatUtils; +22 +23 /** +24 * Represents a RunDeck execution, usually triggered by an API call. An execution could be a {@link RundeckJob} +25 * execution or an "ad-hoc" execution. +26 * +27 * @author Vincent Behar +28 */ +29 public class RundeckExecution implements Serializable { +30 +31 private static final long serialVersionUID = 1L; +32 +33 private Long id; +34 +35 private String url; +36 +37 private ExecutionStatus status; +38 +39 /** Optional - only if it is a job execution */ +40 private RundeckJob job; +41 +42 private String startedBy; +43 +44 private Date startedAt; +45 +46 /** only if the execution has ended */ +47 private Date endedAt; +48 +49 /** only if the execution was aborted */ +50 private String abortedBy; +51 +52 private String description; +53 +54 /** +55 * @return the duration of the execution in milliseconds (or null if the duration is still running, or has been +56 * aborted) +57 */ +58 public Long getDurationInMillis() { +59 if (startedAt == null || endedAt == null) { +60 return null; +61 } +62 return endedAt.getTime() - startedAt.getTime(); +63 } +64 +65 /** +66 * @return the duration of the execution in seconds (or null if the duration is still running, or has been aborted) +67 */ +68 public Long getDurationInSeconds() { +69 Long durationInMillis = getDurationInMillis(); +70 if (durationInMillis == null) { +71 return null; +72 } +73 return TimeUnit.MILLISECONDS.toSeconds(durationInMillis); +74 } +75 +76 /** +77 * @return the duration of the execution, as a human-readable string : "3 minutes 34 seconds" (or null if the +78 * duration is still running, or has been aborted) +79 */ +80 public String getDuration() { +81 Long durationInMillis = getDurationInMillis(); +82 if (durationInMillis == null) { +83 return null; +84 } +85 return DurationFormatUtils.formatDurationWords(durationInMillis, true, true); +86 } +87 +88 /** +89 * @return the duration of the execution, as a "short" human-readable string : "0:03:34.187" (or null if the +90 * duration is still running, or has been aborted) +91 */ +92 public String getShortDuration() { +93 Long durationInMillis = getDurationInMillis(); +94 if (durationInMillis == null) { +95 return null; +96 } +97 return DurationFormatUtils.formatDurationHMS(durationInMillis); +98 } +99 +100 public Long getId() { +101 return id; +102 } +103 +104 public void setId(Long id) { +105 this.id = id; +106 } +107 +108 public String getUrl() { +109 return url; +110 } +111 +112 public void setUrl(String url) { +113 this.url = url; +114 } +115 +116 /** +117 * @return the status of the execution - see {@link ExecutionStatus} +118 */ +119 public ExecutionStatus getStatus() { +120 return status; +121 } +122 +123 public void setStatus(ExecutionStatus status) { +124 this.status = status; +125 } +126 +127 /** +128 * @return the {@link RundeckJob} associated with this execution, or null in the case of an ad-hoc execution +129 * (command or script) +130 */ +131 public RundeckJob getJob() { +132 return job; +133 } +134 +135 public void setJob(RundeckJob job) { +136 this.job = job; +137 } +138 +139 public String getStartedBy() { +140 return startedBy; +141 } +142 +143 public void setStartedBy(String startedBy) { +144 this.startedBy = startedBy; +145 } +146 +147 public Date getStartedAt() { +148 return (startedAt != null) ? new Date(startedAt.getTime()) : null; +149 } +150 +151 public void setStartedAt(Date startedAt) { +152 this.startedAt = ((startedAt != null) ? new Date(startedAt.getTime()) : null); +153 } +154 +155 public Date getEndedAt() { +156 return (endedAt != null) ? new Date(endedAt.getTime()) : null; +157 } +158 +159 public void setEndedAt(Date endedAt) { +160 this.endedAt = ((endedAt != null) ? new Date(endedAt.getTime()) : null); +161 } +162 +163 public String getAbortedBy() { +164 return abortedBy; +165 } +166 +167 public void setAbortedBy(String abortedBy) { +168 this.abortedBy = abortedBy; +169 } +170 +171 public String getDescription() { +172 return description; +173 } +174 +175 public void setDescription(String description) { +176 this.description = description; +177 } +178 +179 @Override +180 public String toString() { +181 return "RundeckExecution [id=" + id + ", description=" + description + ", url=" + url + ", status=" + status +182 + ", startedBy=" + startedBy + ", startedAt=" + startedAt + ", endedAt=" + endedAt +183 + ", durationInSeconds=" + getDurationInSeconds() + ", abortedBy=" + abortedBy + ", job=" + job + "]"; +184 } +185 +186 @Override +187 public int hashCode() { +188 final int prime = 31; +189 int result = 1; +190 result = prime * result + ((abortedBy == null) ? 0 : abortedBy.hashCode()); +191 result = prime * result + ((description == null) ? 0 : description.hashCode()); +192 result = prime * result + ((endedAt == null) ? 0 : endedAt.hashCode()); +193 result = prime * result + ((id == null) ? 0 : id.hashCode()); +194 result = prime * result + ((job == null) ? 0 : job.hashCode()); +195 result = prime * result + ((startedAt == null) ? 0 : startedAt.hashCode()); +196 result = prime * result + ((startedBy == null) ? 0 : startedBy.hashCode()); +197 result = prime * result + ((status == null) ? 0 : status.hashCode()); +198 result = prime * result + ((url == null) ? 0 : url.hashCode()); +199 return result; +200 } +201 +202 @Override +203 public boolean equals(Object obj) { +204 if (this == obj) +205 return true; +206 if (obj == null) +207 return false; +208 if (getClass() != obj.getClass()) +209 return false; +210 RundeckExecution other = (RundeckExecution) obj; +211 if (abortedBy == null) { +212 if (other.abortedBy != null) 213 return false; -214 } else if (!startedAt.equals(other.startedAt)) +214 } else if (!abortedBy.equals(other.abortedBy)) 215 return false; -216 if (startedBy == null) { -217 if (other.startedBy != null) +216 if (description == null) { +217 if (other.description != null) 218 return false; -219 } else if (!startedBy.equals(other.startedBy)) +219 } else if (!description.equals(other.description)) 220 return false; -221 if (status == null) { -222 if (other.status != null) +221 if (endedAt == null) { +222 if (other.endedAt != null) 223 return false; -224 } else if (!status.equals(other.status)) +224 } else if (!endedAt.equals(other.endedAt)) 225 return false; -226 if (url == null) { -227 if (other.url != null) +226 if (id == null) { +227 if (other.id != null) 228 return false; -229 } else if (!url.equals(other.url)) +229 } else if (!id.equals(other.id)) 230 return false; -231 return true; -232 } -233 -234 /** -235 * The status of an execution -236 */ -237 public static enum ExecutionStatus { -238 RUNNING, SUCCEEDED, FAILED, ABORTED; -239 } -240 -241 } +231 if (job == null) { +232 if (other.job != null) +233 return false; +234 } else if (!job.equals(other.job)) +235 return false; +236 if (startedAt == null) { +237 if (other.startedAt != null) +238 return false; +239 } else if (!startedAt.equals(other.startedAt)) +240 return false; +241 if (startedBy == null) { +242 if (other.startedBy != null) +243 return false; +244 } else if (!startedBy.equals(other.startedBy)) +245 return false; +246 if (status == null) { +247 if (other.status != null) +248 return false; +249 } else if (!status.equals(other.status)) +250 return false; +251 if (url == null) { +252 if (other.url != null) +253 return false; +254 } else if (!url.equals(other.url)) +255 return false; +256 return true; +257 } +258 +259 /** +260 * The status of an execution +261 */ +262 public static enum ExecutionStatus { +263 RUNNING, SUCCEEDED, FAILED, ABORTED; +264 } +265 +266 }
    diff --git a/xref/org/rundeck/api/parser/ParserHelper.html b/xref/org/rundeck/api/parser/ParserHelper.html index d718b4f..51b4d8e 100644 --- a/xref/org/rundeck/api/parser/ParserHelper.html +++ b/xref/org/rundeck/api/parser/ParserHelper.html @@ -25,76 +25,51 @@ 15 */ 16 package org.rundeck.api.parser; 17 -18 import java.io.IOException; -19 import java.io.InputStream; -20 import org.apache.http.HttpResponse; -21 import org.dom4j.Document; -22 import org.dom4j.DocumentException; -23 import org.dom4j.Node; -24 import org.dom4j.io.SAXReader; -25 import org.rundeck.api.RundeckApiException; -26 -27 /** -28 * Helper for parsing RunDeck responses -29 * -30 * @author Vincent Behar -31 */ -32 public class ParserHelper { -33 -34 /** -35 * Load an XML {@link Document} from the given RunDeck {@link HttpResponse}. -36 * -37 * @param httpResponse from an API call to RunDeck -38 * @return an XML {@link Document} -39 * @throws RundeckApiException if we failed to read the response, or if the response is an error -40 * @see #loadDocument(InputStream) -41 */ -42 public static Document loadDocument(HttpResponse httpResponse) throws RundeckApiException { -43 InputStream inputStream = null; -44 -45 try { -46 inputStream = httpResponse.getEntity().getContent(); -47 } catch (IllegalStateException e) { -48 throw new RundeckApiException("Failed to read RunDeck reponse", e); -49 } catch (IOException e) { -50 throw new RundeckApiException("Failed to read RunDeck reponse", e); -51 } -52 -53 return loadDocument(inputStream); -54 } -55 -56 /** -57 * Load an XML {@link Document} from the given {@link InputStream} -58 * -59 * @param inputStream from an API call to RunDeck -60 * @return an XML {@link Document} -61 * @throws RundeckApiException if we failed to read the response, or if the response is an error -62 * @see #loadDocument(HttpResponse) -63 */ -64 public static Document loadDocument(InputStream inputStream) throws RundeckApiException { -65 SAXReader reader = new SAXReader(); -66 reader.setEncoding("UTF-8"); -67 -68 Document document; -69 try { -70 document = reader.read(inputStream); -71 } catch (DocumentException e) { -72 throw new RundeckApiException("Failed to read RunDeck reponse", e); -73 } -74 document.setXMLEncoding("UTF-8"); -75 -76 Node result = document.selectSingleNode("result"); -77 if (result != null) { -78 Boolean failure = Boolean.valueOf(result.valueOf("@error")); -79 if (failure) { -80 throw new RundeckApiException(result.valueOf("error/message")); -81 } -82 } -83 -84 return document; -85 } -86 -87 } +18 import java.io.InputStream; +19 import org.dom4j.Document; +20 import org.dom4j.DocumentException; +21 import org.dom4j.Node; +22 import org.dom4j.io.SAXReader; +23 import org.rundeck.api.RundeckApiException; +24 +25 /** +26 * Helper for parsing RunDeck responses +27 * +28 * @author Vincent Behar +29 */ +30 public class ParserHelper { +31 +32 /** +33 * Load an XML {@link Document} from the given {@link InputStream} +34 * +35 * @param inputStream from an API call to RunDeck +36 * @return an XML {@link Document} +37 * @throws RundeckApiException if we failed to read the response, or if the response is an error +38 */ +39 public static Document loadDocument(InputStream inputStream) throws RundeckApiException { +40 SAXReader reader = new SAXReader(); +41 reader.setEncoding("UTF-8"); +42 +43 Document document; +44 try { +45 document = reader.read(inputStream); +46 } catch (DocumentException e) { +47 throw new RundeckApiException("Failed to read RunDeck reponse", e); +48 } +49 document.setXMLEncoding("UTF-8"); +50 +51 Node result = document.selectSingleNode("result"); +52 if (result != null) { +53 Boolean failure = Boolean.valueOf(result.valueOf("@error")); +54 if (failure) { +55 throw new RundeckApiException(result.valueOf("error/message")); +56 } +57 } +58 +59 return document; +60 } +61 +62 }
    diff --git a/xref/org/rundeck/api/parser/StringParser.html b/xref/org/rundeck/api/parser/StringParser.html new file mode 100644 index 0000000..cf82d3a --- /dev/null +++ b/xref/org/rundeck/api/parser/StringParser.html @@ -0,0 +1,63 @@ + + + + +StringParser xref + + + +
    +
    +1   /*
    +2    * Copyright 2011 Vincent Behar
    +3    *
    +4    * Licensed under the Apache License, Version 2.0 (the "License");
    +5    * you may not use this file except in compliance with the License.
    +6    * You may obtain a copy of the License at
    +7    *
    +8    *     http://www.apache.org/licenses/LICENSE-2.0
    +9    *
    +10   * Unless required by applicable law or agreed to in writing, software
    +11   * distributed under the License is distributed on an "AS IS" BASIS,
    +12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +13   * See the License for the specific language governing permissions and
    +14   * limitations under the License.
    +15   */
    +16  package org.rundeck.api.parser;
    +17  
    +18  import org.apache.commons.lang.StringUtils;
    +19  import org.dom4j.Node;
    +20  
    +21  /**
    +22   * Parser for a single {@link String}
    +23   * 
    +24   * @author Vincent Behar
    +25   */
    +26  public class StringParser implements XmlNodeParser<String> {
    +27  
    +28      private String xpath;
    +29  
    +30      public StringParser() {
    +31          super();
    +32      }
    +33  
    +34      /**
    +35       * @param xpath of the string element if it is not the root node
    +36       */
    +37      public StringParser(String xpath) {
    +38          super();
    +39          this.xpath = xpath;
    +40      }
    +41  
    +42      @Override
    +43      public String parseXmlNode(Node node) {
    +44          Node strNode = xpath != null ? node.selectSingleNode(xpath) : node;
    +45  
    +46          return StringUtils.trimToNull(strNode.getStringValue());
    +47      }
    +48  
    +49  }
    +
    +
    + + diff --git a/xref/org/rundeck/api/parser/package-frame.html b/xref/org/rundeck/api/parser/package-frame.html index e2ac1b0..aa9e310 100644 --- a/xref/org/rundeck/api/parser/package-frame.html +++ b/xref/org/rundeck/api/parser/package-frame.html @@ -35,6 +35,9 @@
  • ProjectParser +
  • +
  • + StringParser
  • XmlNodeParser diff --git a/xref/org/rundeck/api/parser/package-summary.html b/xref/org/rundeck/api/parser/package-summary.html index b71b289..3e55ecd 100644 --- a/xref/org/rundeck/api/parser/package-summary.html +++ b/xref/org/rundeck/api/parser/package-summary.html @@ -69,6 +69,11 @@ ProjectParser + + + + StringParser +