Description
The ClientDSL for Oozie shoud provide the list method.
It could be easily done with something like that (in a java 8 style):
public static class Request extends AbstractRequest<Status.Response> { private List<String> filter = new ArrayList<>(); private String type; Request( Hadoop session ) { super( session ); } public Request filter( String filter ) { this.filter.add( filter ); return this; } public Request type( String type ) { this.type = type; return this; } protected Callable<Status.Response> callable() { return new Callable<Status.Response>() { @Override public Status.Response call() throws Exception { String comma = URLEncoder.encode(";"); String filters = Request.this.filter.stream().map(e -> URLEncoder.encode(e)).collect(Collectors.joining(comma)); URIBuilder uri = null; if (StringUtils.isEmpty(filters)) { uri = Request.this.uri(new String[]{Workflow.SERVICE_PATH, "/jobs/"}); } else { uri = Request.this.uri(new String[]{Workflow.SERVICE_PATH, "/jobs/", "?filter=" + filters}); } if (StringUtils.isNotEmpty(type)) { uri.addParameter("jobtype", type); } HttpGet request = new HttpGet(uri.build()); return new Status.Response((Request.this.execute(request))); } }; } }
Attachments
Issue Links
- duplicates
-
KNOX-835 Improvements for Oozie in the ClientDSL
- Open