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 propertiesSet<String>
getConfigs()
Returns a list of all configurations created.String
getProperty(String configId, String propertyId)
Get propertyjavax.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
-
-
-
-
Field Detail
-
DEFAULT
public static final String DEFAULT
- See Also:
- Constant Field Values
-
-
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 configurationpropertyId
- 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 populatedNutchConfig
- 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 propertyvalue
- Value as a simple text- Returns:
- Success code
-
-