org.apache.nutch.service.resources

## Class JobResource

- java.lang.Object
- - org.apache.nutch.service.resources.AbstractResource
  - - org.apache.nutch.service.resources.JobResource

-     @Path(value="/job")
      public class JobResource
      extends AbstractResource

- - ### Field Summary

    - ### Fields inherited from class org.apache.nutch.service.resources.AbstractResource

      `configManager, jobManager, server`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JobResource()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `abort(String id, String crawlId)`
    `JobInfo` | `create(JobConfig config)` Create a new job
    `JobInfo` | `getInfo(String id, String crawlId)` Get job info
    `Collection<JobInfo>` | `getJobs(String crawlId)` Get job history
    `boolean` | `stop(String id, String crawlId)` Stop Job

    - ### Methods inherited from class org.apache.nutch.service.resources.AbstractResource

      `throwBadRequestException`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JobResource

          public JobResource()

  - ### Method Detail

    - #### getJobs

          @GET
           @Path(value="/")
          public Collection<JobInfo> getJobs(@QueryParam(value="crawlId")
                                                                    String crawlId)

      Get job history
      Parameters:
        `crawlId` -
      Returns:
        A nested JSON object of all the jobs created

    - #### getInfo

          @GET
           @Path(value="/{id}")
          public JobInfo getInfo(@PathParam(value="id")
                                                            String id,
                                                            @QueryParam(value="crawlId")
                                                            String crawlId)

      Get job info
      Parameters:
        `id` - Job ID
        `crawlId` - Crawl ID
      Returns:
        A JSON object of job parameters

    - #### stop

          @GET
           @Path(value="/{id}/stop")
          public boolean stop(@PathParam(value="id")
                                                              String id,
                                                              @QueryParam(value="crawlId")
                                                              String crawlId)

      Stop Job
      Parameters:
        `id` - Job ID
        `crawlId` -
      Returns:

    - #### abort

          @GET
           @Path(value="/{id}/abort")
          public boolean abort(@PathParam(value="id")
                                                                String id,
                                                                @QueryParam(value="crawlId")
                                                                String crawlId)

    - #### create

          @POST
           @Path(value="/create")
           @Consumes(value="application/json")
          public JobInfo create(JobConfig config)

      Create a new job
      Parameters:
        `config` - The parameters of the job to create
      Returns:
        A JSON object of the job created with its details

Copyright © 2021 The Apache Software Foundation