@Override public SchemaMetadataInfo updateSchemaMetadata(String schemaName, SchemaMetadata schemaMetadata) { return schemaRegistry.updateSchemaMetadata(schemaName, schemaMetadata); }
@POST @Path("/schemas/{name}") @ApiOperation(value = "Updates schema information for the given schema name", response = SchemaMetadataInfo.class, tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response updateSchemaInfo(@ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName, @ApiParam(value = "Schema to be added to the registry", required = true) SchemaMetadata schemaMetadata, @Context UriInfo uriInfo) { return handleLeaderAction(uriInfo, () -> { Response response; try { SchemaMetadataInfo schemaMetadataInfo = schemaRegistry.updateSchemaMetadata(schemaName, schemaMetadata); if (schemaMetadataInfo != null) { response = WSUtils.respondEntity(schemaMetadataInfo, Response.Status.OK); } else { response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } } catch (IllegalArgumentException ex) { LOG.error("Expected parameter is invalid", schemaName, schemaMetadata, ex); response = WSUtils.respond(Response.Status.BAD_REQUEST, CatalogResponse.ResponseMessage.BAD_REQUEST_PARAM_MISSING, ex.getMessage()); } catch (Exception ex) { LOG.error("Encountered error while retrieving SchemaInfo with name: [{}]", schemaName, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }); }
@POST @Path("/schemas/{name}") @ApiOperation(value = "Updates schema information for the given schema name", response = SchemaMetadataInfo.class, tags = OPERATION_GROUP_SCHEMA) @Timed @UnitOfWork public Response updateSchemaInfo(@ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName, @ApiParam(value = "Schema to be added to the registry", required = true) SchemaMetadata schemaMetadata, @Context UriInfo uriInfo) { return handleLeaderAction(uriInfo, () -> { Response response; try { SchemaMetadataInfo schemaMetadataInfo = schemaRegistry.updateSchemaMetadata(schemaName, schemaMetadata); if (schemaMetadataInfo != null) { response = WSUtils.respondEntity(schemaMetadataInfo, Response.Status.OK); } else { response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } } catch (IllegalArgumentException ex) { LOG.error("Expected parameter is invalid", schemaName, schemaMetadata, ex); response = WSUtils.respond(Response.Status.BAD_REQUEST, CatalogResponse.ResponseMessage.BAD_REQUEST_PARAM_MISSING, ex.getMessage()); } catch (Exception ex) { LOG.error("Encountered error while retrieving SchemaInfo with name: [{}]", schemaName, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }); }