@POST @Path("/data/datasets/{name}/admin/upgrade") public void upgrade(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("name") String instanceName) { propagateUserId(request); try { DatasetId instanceId = new DatasetId(namespaceId, instanceName); datasetAdminService.upgrade(instanceId); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(new DatasetAdminOpResponse(null, null))); } catch (NotFoundException e) { LOG.debug("Got handler exception", e); responder.sendString(HttpResponseStatus.NOT_FOUND, StringUtils.defaultIfEmpty(e.getMessage(), "")); } catch (Exception e) { LOG.error(getAdminOpErrorMessage("upgrade", instanceName), e); responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, getAdminOpErrorMessage("upgrade", instanceName)); } }
@POST @Path("/data/datasets/{name}/admin/upgrade") public void upgrade(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("name") String instanceName) { propagateUserId(request); try { DatasetId instanceId = new DatasetId(namespaceId, instanceName); datasetAdminService.upgrade(instanceId); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(new DatasetAdminOpResponse(null, null))); } catch (NotFoundException e) { LOG.debug("Got handler exception", e); responder.sendString(HttpResponseStatus.NOT_FOUND, StringUtils.defaultIfEmpty(e.getMessage(), "")); } catch (Exception e) { LOG.error(getAdminOpErrorMessage("upgrade", instanceName), e); responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, getAdminOpErrorMessage("upgrade", instanceName)); } }
@POST @Path("/data/datasets/{name}/admin/truncate") public void truncate(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("name") String instanceName) { propagateUserId(request); try { DatasetId instanceId = new DatasetId(namespaceId, instanceName); datasetAdminService.truncate(instanceId); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(new DatasetAdminOpResponse(null, null))); } catch (NotFoundException e) { LOG.debug("Got handler exception", e); responder.sendString(HttpResponseStatus.NOT_FOUND, StringUtils.defaultIfEmpty(e.getMessage(), "")); } catch (Exception e) { LOG.error(getAdminOpErrorMessage("truncate", instanceName), e); responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, getAdminOpErrorMessage("truncate", instanceName)); } }
@POST @Path("/data/datasets/{name}/admin/truncate") public void truncate(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("name") String instanceName) { propagateUserId(request); try { DatasetId instanceId = new DatasetId(namespaceId, instanceName); datasetAdminService.truncate(instanceId); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(new DatasetAdminOpResponse(null, null))); } catch (NotFoundException e) { LOG.debug("Got handler exception", e); responder.sendString(HttpResponseStatus.NOT_FOUND, StringUtils.defaultIfEmpty(e.getMessage(), "")); } catch (Exception e) { LOG.error(getAdminOpErrorMessage("truncate", instanceName), e); responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, getAdminOpErrorMessage("truncate", instanceName)); } }
@POST @Path("/data/datasets/{name}/admin/exists") public void exists(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("name") String instanceName) { propagateUserId(request); NamespaceId namespace = new NamespaceId(namespaceId); try { DatasetId instanceId = namespace.dataset(instanceName); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(new DatasetAdminOpResponse(datasetAdminService.exists(instanceId), null))); } catch (NotFoundException e) { LOG.debug("Got handler exception", e); responder.sendString(HttpResponseStatus.NOT_FOUND, StringUtils.defaultIfEmpty(e.getMessage(), "")); } catch (Exception e) { LOG.error(getAdminOpErrorMessage("exists", instanceName), e); responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, getAdminOpErrorMessage("exists", instanceName)); } }
@POST @Path("/data/datasets/{name}/admin/exists") public void exists(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("name") String instanceName) { propagateUserId(request); NamespaceId namespace = new NamespaceId(namespaceId); try { DatasetId instanceId = namespace.dataset(instanceName); responder.sendJson(HttpResponseStatus.OK, GSON.toJson(new DatasetAdminOpResponse(datasetAdminService.exists(instanceId), null))); } catch (NotFoundException e) { LOG.debug("Got handler exception", e); responder.sendString(HttpResponseStatus.NOT_FOUND, StringUtils.defaultIfEmpty(e.getMessage(), "")); } catch (Exception e) { LOG.error(getAdminOpErrorMessage("exists", instanceName), e); responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, getAdminOpErrorMessage("exists", instanceName)); } }