Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-815

Add list in Oozie for ClientDSL

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 0.7.0
    • 0.12.0
    • ClientDSL

    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

          Activity

            People

              Unassigned Unassigned
              Khanh Khanh Maudoux
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: