org.apache.nutch.crawl

## Class InjectorJob

- java.lang.Object
- - org.apache.hadoop.conf.Configured
  - - org.apache.nutch.util.NutchTool
    - - org.apache.nutch.crawl.InjectorJob

- All Implemented Interfaces:
    Configurable, Tool

      public class InjectorJob
      extends NutchTool
      implements Tool

  This class takes a flat file of URLs and adds them to the of pages to be crawled. Useful for bootstrapping the system. The URL files contain one URL per line, optionally followed by custom metadata separated by tabs with the metadata key separated from the corresponding value by '='.
  Note that some metadata keys are reserved :
  - nutch.score : allows to set a custom score for a specific URL
  - nutch.fetchInterval : allows to set a custom fetch interval for a specific URL
  e.g. http://www.nutch.org/ \t nutch.score=10 \t nutch.fetchInterval=2592000 \t userType=open_source

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `InjectorJob.UrlMapper`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `nutchFetchIntervalMDName` metadata key reserved for setting a custom fetchInterval for a specific URL
    `static java.lang.String` | `nutchScoreMDName` metadata key reserved for setting a custom score for a specific URL

    - ### Fields inherited from class org.apache.nutch.util.NutchTool

      `currentJob, currentJobNum, numJobs, results, status`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InjectorJob()`
    `InjectorJob(Configuration conf)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `inject(Path urlDir)`
    `static void` | `main(java.lang.String[] args)`
    `java.util.Map<java.lang.String,java.lang.Object>` | `run(java.util.Map<java.lang.String,java.lang.Object> args)` Runs the tool, using a map of arguments.
    `int` | `run(java.lang.String[] args)`

    - ### Methods inherited from class org.apache.nutch.util.NutchTool

      `getProgress, getStatus, killJob, stopJob`

    - ### Methods inherited from class org.apache.hadoop.conf.Configured

      `getConf, setConf`

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

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

    - ### Methods inherited from interface org.apache.hadoop.conf.Configurable

      `getConf, setConf`

- - ### Field Detail

    - #### nutchScoreMDName

          public static java.lang.String nutchScoreMDName

      metadata key reserved for setting a custom score for a specific URL

    - #### nutchFetchIntervalMDName

          public static java.lang.String nutchFetchIntervalMDName

      metadata key reserved for setting a custom fetchInterval for a specific URL

  - ### Constructor Detail

    - #### InjectorJob

          public InjectorJob()

    - #### InjectorJob

          public InjectorJob(Configuration conf)

  - ### Method Detail

    - #### run

          public java.util.Map<java.lang.String,java.lang.Object> run(java.util.Map<java.lang.String,java.lang.Object> args)
                                                               throws java.lang.Exception

      Description copied from class: `NutchTool`
      Runs the tool, using a map of arguments. May return results, or null.
      Specified by:
        `run` in class `NutchTool`
      Parameters:
        `args` - map of arguments
      Returns:
        results or null
      Throws:
        `java.lang.Exception`

    - #### inject

          public void inject(Path urlDir)
                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### run

          public int run(java.lang.String[] args)
                  throws java.lang.Exception

      Specified by:
        `run` in interface `Tool`
      Throws:
        `java.lang.Exception`

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Exception

      Throws:
        `java.lang.Exception`

Copyright © 2019 The Apache Software Foundation