org.apache.nutch.service.resources

## Class ConfigResource

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

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

- - ### Field Summary

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

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

      `configManager, jobManager, server`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConfigResource()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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(value="/")
          public Set<String> getConfigs()

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

    - #### getConfig

          @GET
           @Path(value="/{configId}")
          public Map<String,String> getConfig(@PathParam(value="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(value="/{configId}/{propertyId}")
           @Produces(value="text/plain")
          public String getProperty(@PathParam(value="configId")
                                                                                                                 String configId,
                                                                                                                 @PathParam(value="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(value="/{configId}")
          public void deleteConfig(@PathParam(value="configId")
                                                                       String configId)

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

    - #### createConfig

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

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

    - #### updateProperty

          @PUT
           @Path(value="/{configId}/{propertyId}")
           @Consumes(value="text/plain")
          public javax.ws.rs.core.Response updateProperty(@PathParam(value="configId")
                                                                                                                                       String confId,
                                                                                                                                       @PathParam(value="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

Copyright © 2020 The Apache Software Foundation