Package org.apache.nutch.service.resources

## Class ConfigResource

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

-     @Path("/config")
      public class ConfigResource
      extends AbstractResource

- - ### Field Summary

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

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

      `configManager, jobManager, server`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConfigResource()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `javax.ws.rs.core.Response` | `createConfig​(NutchConfig newConfig)` | Create new configuration.
    `void` | `deleteConfig​(String configId)` | Removes the configuration from the list of known configurations.
    `Map<String,​String>` | `getConfig​(String configId)` | Get configuration properties
    `Set<String>` | `getConfigs()` | Returns a list of all configurations created.
    `String` | `getProperty​(String configId, String propertyId)` | Get property
    `javax.ws.rs.core.Response` | `updateProperty​(String confId, String propertyKey, String value)` | Adds/Updates a particular property value in the configuration

    - ### 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`

- - ### Field Detail

    - #### DEFAULT

          public static final String DEFAULT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ConfigResource

          public ConfigResource()

  - ### Method Detail

    - #### getConfigs

          @GET
          @Path("/")
          public Set<String> getConfigs()

      Returns a list of all configurations created.
      Returns:
        List of configurations

    - #### getConfig

          @GET
          @Path("/{configId}")
          public Map<String,​String> getConfig​(@PathParam("configId")
                                                    String configId)

      Get configuration properties
      Parameters:
        `configId` - The configuration ID to fetch
      Returns:
        HashMap of the properties set within the given configId

    - #### getProperty

          @GET
          @Path("/{configId}/{propertyId}")
          @Produces("text/plain")
          public String getProperty​(@PathParam("configId")
                                    String configId,
                                    @PathParam("propertyId")
                                    String propertyId)

      Get property
      Parameters:
        `configId` - The ID of the configuration
        `propertyId` - The name(key) of the property
      Returns:
        value of the specified property in the provided configId.

    - #### deleteConfig

          @DELETE
          @Path("/{configId}")
          public void deleteConfig​(@PathParam("configId")
                                   String configId)

      Removes the configuration from the list of known configurations.
      Parameters:
        `configId` - The ID of the configuration to delete

    - #### createConfig

          @POST
          @Path("/create")
          @Consumes("application/json")
          @Produces("text/plain")
          public javax.ws.rs.core.Response createConfig​(NutchConfig newConfig)

      Create new configuration.
      Parameters:
        `newConfig` - a new populated `NutchConfig`
      Returns:
        The name of the new configuration created

    - #### updateProperty

          @PUT
          @Path("/{configId}/{propertyId}")
          @Consumes("text/plain")
          public javax.ws.rs.core.Response updateProperty​(@PathParam("configId")
                                                          String confId,
                                                          @PathParam("propertyId")
                                                          String propertyKey,
                                                          String value)

      Adds/Updates a particular property value in the configuration
      Parameters:
        `confId` - Configuration ID whose property needs to be updated. Make sure that the given confId exists to prevent errors.
        `propertyKey` - Name of the property
        `value` - Value as a simple text
      Returns:
        Success code