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 java.lang.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(java.lang.String configId)` Removes the configuration from the list of known configurations.
    `java.util.Map<java.lang.String,java.lang.String>` | `getConfig(java.lang.String configId)` Get configuration properties
    `java.util.Set<java.lang.String>` | `getConfigs()` Returns a list of all configurations created.
    `java.lang.String` | `getProperty(java.lang.String configId, java.lang.String propertyId)` Get property
    `javax.ws.rs.core.Response` | `updateProperty(java.lang.String confId, java.lang.String propertyKey, java.lang.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 java.lang.String DEFAULT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ConfigResource

          public ConfigResource()

  - ### Method Detail

    - #### getConfigs

          @GET
           @Path(value="/")
          public java.util.Set<java.lang.String> getConfigs()

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

    - #### getConfig

          @GET
           @Path(value="/{configId}")
          public java.util.Map<java.lang.String,java.lang.String> getConfig(@PathParam(value="configId")
                                                                                                             java.lang.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 java.lang.String getProperty(@PathParam(value="configId")
                                                                                                                           java.lang.String configId,
                                                                                                                           @PathParam(value="propertyId")
                                                                                                                           java.lang.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")
                                                                       java.lang.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")
                                                                                                                                       java.lang.String confId,
                                                                                                                                       @PathParam(value="propertyId")
                                                                                                                                       java.lang.String propertyKey,
                                                                                                                                       java.lang.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 © 2019 The Apache Software Foundation