Package org.apache.ambari.view.pig.utils

Examples of org.apache.ambari.view.pig.utils.FilePaginator


      } catch (ItemNotFound itemNotFound) {
        throw new NotFoundFormattedException("Job with id '" + jobId + "' not found", null);
      }
      String filePath = job.getStatusDir() + "/" + fileName;
      LOG.debug("Reading file " + filePath);
      FilePaginator paginator = new FilePaginator(filePath, context);

      if (page == null)
        page = 0L;

      FileResource file = new FileResource();
      file.setFilePath(filePath);
      file.setFileContent(paginator.readPage(page));
      file.setHasNext(paginator.pageCount() > page + 1);
      file.setPage(page);
      file.setPageCount(paginator.pageCount());

      JSONObject object = new JSONObject();
      object.put("file", file);
      return Response.ok(object).status(200).build();
    } catch (WebApplicationException ex) {
View Full Code Here


      return Response.ok("No such job").status(404).build();
    }
    try {
      String filePath = job.getStatusDir() + "/" + fileName;
      LOG.debug("Reading file " + filePath);
      FilePaginator paginator = new FilePaginator(filePath, context);

      if (page == null)
        page = 0L;

      FileResource file = new FileResource();
      file.setFilePath(filePath);
      file.setFileContent(paginator.readPage(page));
      file.setHasNext(paginator.pageCount() > page + 1);
      file.setPage(page);
      file.setPageCount(paginator.pageCount());

      JSONObject object = new JSONObject();
      object.put("file", file);
      return Response.ok(object).status(200).build();
    } catch (IOException e) {
View Full Code Here

  @Path("{filePath:.*}")
  @Produces(MediaType.APPLICATION_JSON)
  public Response getFile(@PathParam("filePath") String filePath, @QueryParam("page") Long page) throws IOException, InterruptedException {
    LOG.debug("Reading file " + filePath);
    try {
      FilePaginator paginator = new FilePaginator(filePath, context);

      if (page == null)
        page = 0L;

      FileResource file = new FileResource();
      file.setFilePath(filePath);
      file.setFileContent(paginator.readPage(page));
      file.setHasNext(paginator.pageCount() > page + 1);
      file.setPage(page);
      file.setPageCount(paginator.pageCount());

      JSONObject object = new JSONObject();
      object.put("file", file);
      return Response.ok(object).status(200).build();
    } catch (FileNotFoundException e) {
View Full Code Here

TOP

Related Classes of org.apache.ambari.view.pig.utils.FilePaginator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.