Search in sources :

Example 1 with UpdateInterpreterSettingRequest

use of org.apache.zeppelin.rest.message.UpdateInterpreterSettingRequest in project zeppelin by apache.

the class InterpreterRestApi method updateSetting.

@PUT
@Path("setting/{settingId}")
@ZeppelinApi
public Response updateSetting(String message, @PathParam("settingId") String settingId) {
    logger.info("Update interpreterSetting {}", settingId);
    try {
        UpdateInterpreterSettingRequest request = gson.fromJson(message, UpdateInterpreterSettingRequest.class);
        interpreterSettingManager.setPropertyAndRestart(settingId, request.getOption(), request.getProperties(), request.getDependencies());
    } catch (InterpreterException e) {
        logger.error("Exception in InterpreterRestApi while updateSetting ", e);
        return new JsonResponse<>(Status.NOT_FOUND, e.getMessage(), ExceptionUtils.getStackTrace(e)).build();
    } catch (IOException e) {
        logger.error("Exception in InterpreterRestApi while updateSetting ", e);
        return new JsonResponse<>(Status.INTERNAL_SERVER_ERROR, e.getMessage(), ExceptionUtils.getStackTrace(e)).build();
    }
    InterpreterSetting setting = interpreterSettingManager.get(settingId);
    if (setting == null) {
        return new JsonResponse<>(Status.NOT_FOUND, "", settingId).build();
    }
    return new JsonResponse<>(Status.OK, "", setting).build();
}
Also used : InterpreterException(org.apache.zeppelin.interpreter.InterpreterException) InterpreterSetting(org.apache.zeppelin.interpreter.InterpreterSetting) UpdateInterpreterSettingRequest(org.apache.zeppelin.rest.message.UpdateInterpreterSettingRequest) IOException(java.io.IOException) JsonResponse(org.apache.zeppelin.server.JsonResponse) Path(javax.ws.rs.Path) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi) PUT(javax.ws.rs.PUT)

Aggregations

IOException (java.io.IOException)1 PUT (javax.ws.rs.PUT)1 Path (javax.ws.rs.Path)1 ZeppelinApi (org.apache.zeppelin.annotation.ZeppelinApi)1 InterpreterException (org.apache.zeppelin.interpreter.InterpreterException)1 InterpreterSetting (org.apache.zeppelin.interpreter.InterpreterSetting)1 UpdateInterpreterSettingRequest (org.apache.zeppelin.rest.message.UpdateInterpreterSettingRequest)1 JsonResponse (org.apache.zeppelin.server.JsonResponse)1