org.apache.nutch.api

## Class NutchServer

- java.lang.Object
- - javax.ws.rs.core.Application
  - - org.apache.nutch.api.NutchServer

-     public class NutchServer
      extends javax.ws.rs.core.Application

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `NUTCH_SERVER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NutchServer()` Public constructor which accepts the port we wish to run the server on as well as the logging granularity.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canStop(boolean force)` Safety and convenience method to determine whether or not it is safe to shut down the server.
    `Set<Class<?>>` | `getClasses()`
    `ConfManager` | `getConfMgr()`
    `JobManager` | `getJobMgr()`
    `long` | `getStarted()`
    `boolean` | `isRunning()` Convenience method to determine whether a Nutch server is running.
    `static void` | `main(String[] args)`
    `void` | `start()` Starts the Nutch server printing some logging to the log file.
    `boolean` | `stop(boolean force)` Stop the Nutch server.

    - ### Methods inherited from class javax.ws.rs.core.Application

      `getSingletons`

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

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

- - ### Field Detail

    - #### NUTCH_SERVER

          public static final String NUTCH_SERVER

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### NutchServer

          public NutchServer()

      Public constructor which accepts the port we wish to run the server on as well as the logging granularity. If the latter option is not provided via `main(String[])` then it defaults to 'INFO' however best attempts should always be made to specify a logging level.

  - ### Method Detail

    - #### getClasses

          public Set<Class<?>> getClasses()

      Overrides:
        `getClasses` in class `javax.ws.rs.core.Application`

    - #### getConfMgr

          public ConfManager getConfMgr()

    - #### getJobMgr

          public JobManager getJobMgr()

    - #### getStarted

          public long getStarted()

    - #### isRunning

          public boolean isRunning()

      Convenience method to determine whether a Nutch server is running.
      Returns:
        true if a server instance is running.

    - #### start

          public void start()

      Starts the Nutch server printing some logging to the log file.

    - #### canStop

          public boolean canStop(boolean force)

      Safety and convenience method to determine whether or not it is safe to shut down the server. We make this assertion by consulting the `org.apache.nutch.api.NutchApp#jobManager` for a list of jobs with `JobInfo.state` equal to 'RUNNING'.
      Parameters:
        `force` - ignore running tasks
      Returns:
        true if there are no jobs running or false if there are jobs with running state.

    - #### stop

          public boolean stop(boolean force)

      Stop the Nutch server.
      Parameters:
        `force` - boolean method to effectively kill jobs regardless of state.
      Returns:
        true if no server is running or if the shutdown was successful. Return false if there are running jobs and the force switch has not been activated.

    - #### main

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

      Throws:
        `Exception`

Copyright © 2015 The Apache Software Foundation