@@ -48,13 +48,14 @@ public JobWithDetails details() throws IOException {
48
48
/**
49
49
* Get a file from workspace.
50
50
*
51
- * @param fileName The name of the file to download from workspace.
52
- * You can also access files which are in sub folders of the workspace.
51
+ * @param fileName
52
+ * The name of the file to download from workspace. You can also
53
+ * access files which are in sub folders of the workspace.
53
54
* @return The string which contains the content of the file.
54
55
* @throws IOException
55
56
*/
56
57
public String getFileFromWorkspace (String fileName ) throws IOException {
57
- InputStream is = client .getFile ( URI .create ( url + "/ws/" + fileName ));
58
+ InputStream is = client .getFile (URI .create (url + "/ws/" + fileName ));
58
59
ByteArrayOutputStream result = new ByteArrayOutputStream ();
59
60
byte [] buffer = new byte [1024 ];
60
61
int length ;
@@ -66,30 +67,44 @@ public String getFileFromWorkspace(String fileName) throws IOException {
66
67
67
68
/**
68
69
* Trigger a build without parameters
70
+ *
71
+ * @return {@link QueueReference} for further analysis of the queued build.
72
+ * @throws IOException
73
+ * in case of an error.
69
74
*/
70
- public void build () throws IOException {
71
- client .post (url + "build" );
75
+ public QueueReference build () throws IOException {
76
+ ExtractHeader location = client .post (url + "build" , null , ExtractHeader .class , false );
77
+ return new QueueReference (location .getLocation ());
78
+
72
79
}
73
80
74
81
/**
75
82
* Trigger a build with crumbFlag.
76
- * @param crumbFlag true or false.
77
- * @throws IOException in case of an error.
83
+ *
84
+ * @param crumbFlag
85
+ * true or false.
86
+ * @return {@link QueueReference} for further analysis of the queued build.
87
+ * @throws IOException
88
+ * in case of an error.
78
89
*/
79
- public void build (boolean crumbFlag ) throws IOException {
80
- client .post (url + "build" , crumbFlag );
90
+ public QueueReference build (boolean crumbFlag ) throws IOException {
91
+ ExtractHeader location = client .post (url + "build" , null , ExtractHeader .class , crumbFlag );
92
+ return new QueueReference (location .getLocation ());
81
93
}
82
94
83
95
/**
84
96
* Trigger a parameterized build
85
97
*
86
98
* @param params
87
99
* the job parameters
100
+ * @return {@link QueueReference} for further analysis of the queued build.
88
101
* @throws IOException
89
102
*/
90
- public void build (Map <String , String > params ) throws IOException {
103
+ public QueueReference build (Map <String , String > params ) throws IOException {
91
104
String qs = join (Collections2 .transform (params .entrySet (), new MapEntryToQueryStringPair ()), "&" );
92
105
client .post (url + "buildWithParameters?" + qs );
106
+ ExtractHeader location = client .post (url + "buildWithParameters?" + qs , null , ExtractHeader .class , false );
107
+ return new QueueReference (location .getLocation ());
93
108
}
94
109
95
110
/**
@@ -99,6 +114,7 @@ public void build(Map<String, String> params) throws IOException {
99
114
* the job parameters
100
115
* @param crumbFlag
101
116
* determines whether crumb flag is used
117
+ * @return {@link QueueReference} for further analysis of the queued build.
102
118
* @throws IOException
103
119
*/
104
120
public QueueReference build (Map <String , String > params , boolean crumbFlag ) throws IOException {
0 commit comments