@GET @Path("/schemaproviders") @ApiOperation(value = "Get list of registered Schema Providers", notes = "The Schema Registry supports different types of schemas, such as Avro, JSON etc. " + "" + "A Schema Provider is needed for each type of schema supported by the Schema Registry. " + "Schema Provider supports defining schema, serializing and deserializing data using the schema, " + " and checking compatibility between different versions of the schema.", response = SchemaProviderInfo.class, responseContainer = "List", tags = OPERATION_GROUP_OTHER) @Timed public Response getRegisteredSchemaProviderInfos(@Context UriInfo uriInfo) { try { Collection<SchemaProviderInfo> schemaProviderInfos = schemaRegistry.getSupportedSchemaProviders(); return WSUtils.respondEntities(schemaProviderInfos, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while listing schemas", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
private Response _addSerDesInfo(SerDesPair serDesInfo) { Response response; try { Long serializerId = schemaRegistry.addSerDes(serDesInfo); response = WSUtils.respondEntity(serializerId, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while adding serializer/deserializer [{}]", serDesInfo, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
@GET @Produces({"application/octet-stream", "application/json"}) @Path("/files/download/{fileId}") @ApiOperation(value = "Downloads the respective for the given fileId if it exists", response = StreamingOutput.class, tags = OPERATION_GROUP_OTHER) @Timed public Response downloadFile(@ApiParam(value = "Identifier of the file to be downloaded", required = true) @PathParam("fileId") String fileId) { Response response; try { StreamingOutput streamOutput = WSUtils.wrapWithStreamingOutput(schemaRegistry.downloadFile(fileId)); response = Response.ok(streamOutput).build(); return response; } catch (FileNotFoundException e) { LOG.error("No file found for fileId [{}]", fileId, e); response = WSUtils.respondEntity(fileId, Response.Status.NOT_FOUND); } catch (Exception ex) { LOG.error("Encountered error while downloading file [{}]", fileId, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
@GET @Path("/version") @ApiOperation(value = "Get the version information of this Schema Registry instance", response = SchemaRegistryVersion.class, tags = OPERATION_GROUP_OTHER) @Timed public Response getVersion(@Context UriInfo uriInfo) { return WSUtils.respondEntity(schemaRegistryVersion, Response.Status.OK); }
tags = tagService.listTags(); } else { queryParams = WSUtils.buildQueryParameters(params); tags = tagService.listTags(queryParams); return WSUtils.respondEntities(makeTagDto(tags), OK);
@GET @Path("ml/models") @Produces(MediaType.APPLICATION_JSON) @Timed public Response listModelInfos() { return WSUtils.respondEntities(modelRegistryService.listModelInfos(), OK); }
@POST @Path(("/notifications/node/debut")) public Response registerNodeDebut(String nodeUrl) { try { LOG.debug("Acknowledged another peer server : {}", nodeUrl); schemaRegistry.registerNodeDebut(nodeUrl); return WSUtils.respond(Response.Status.OK); } catch (Exception e) { return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, e.getMessage()); } }
@GET @Path("/version") @ApiOperation(value = "Get the version information of this Schema Registry instance", response = SchemaRegistryVersion.class, tags = OPERATION_GROUP_OTHER) @Timed public Response getVersion(@Context UriInfo uriInfo) { return WSUtils.respondEntity(schemaRegistryVersion, Response.Status.OK); }
/** * <p> * Gets all the entities tagged with the given tag id. This also recursively gets * all the entities belonging to any child tags of the given tag. The child tags itself * are not included in the result. * </p> * <b>GET /api/v1/catalog/tags/1/entities</b> * <pre> * { * "entities":[{ * "id":12, * "namespace":"tag" * }] * } * </pre> * * @param tagId the tag id * @return the response */ @GET @Path("/tags/{id}/entities") @Timed @UnitOfWork public Response getTaggedEntities(@PathParam("id") Long tagId) { List<TaggedEntity> result = tagService.getEntities(tagId, true); if (result != null) { return WSUtils.respondEntities(result, OK); } throw EntityNotFoundException.byId(tagId.toString()); }
@POST @Path(("/notifications/node/debut")) public Response registerNodeDebut(String nodeUrl) { try { LOG.debug("Acknowledged another peer server : {}", nodeUrl); schemaRegistry.registerNodeDebut(nodeUrl); return WSUtils.respond(Response.Status.OK); } catch (Exception e) { return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, e.getMessage()); } }
private Response _getSerDesInfo(Long serializerId) { Response response; try { SerDesInfo serializerInfo = schemaRegistry.getSerDes(serializerId); response = WSUtils.respondEntity(serializerInfo, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while getting serializer/deserializer [{}]", serializerId, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
@GET @Path("/schemaproviders") @ApiOperation(value = "Get list of registered Schema Providers", notes = "The Schema Registry supports different types of schemas, such as Avro, JSON etc. " + "" + "A Schema Provider is needed for each type of schema supported by the Schema Registry. " + "Schema Provider supports defining schema, serializing and deserializing data using the schema, " + " and checking compatibility between different versions of the schema.", response = SchemaProviderInfo.class, responseContainer = "List", tags = OPERATION_GROUP_OTHER) @Timed public Response getRegisteredSchemaProviderInfos(@Context UriInfo uriInfo) { try { Collection<SchemaProviderInfo> schemaProviderInfos = schemaRegistry.getSupportedSchemaProviders(); return WSUtils.respondEntities(schemaProviderInfos, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while listing schemas", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
@GET @Produces(MediaType.APPLICATION_JSON) @Path("ml/models/pmml/{name}") @Timed public Response getMLModelContents(@PathParam("name") String modelName) { MLModel modelInfo = modelRegistryService.getModelInfo(modelName); return WSUtils.respondEntity(modelInfo.getPmml(), OK); } }
@GET @Produces({"application/octet-stream", "application/json"}) @Path("/files/download/{fileId}") @ApiOperation(value = "Downloads the respective for the given fileId if it exists", response = StreamingOutput.class, tags = OPERATION_GROUP_OTHER) @Timed public Response downloadFile(@ApiParam(value = "Identifier of the file to be downloaded", required = true) @PathParam("fileId") String fileId) { Response response; try { StreamingOutput streamOutput = WSUtils.wrapWithStreamingOutput(schemaRegistry.downloadFile(fileId)); response = Response.ok(streamOutput).build(); return response; } catch (FileNotFoundException e) { LOG.error("No file found for fileId [{}]", fileId, e); response = WSUtils.respondEntity(fileId, Response.Status.NOT_FOUND); } catch (Exception ex) { LOG.error("Encountered error while downloading file [{}]", fileId, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
List<Tag> tags = tagService.getTags(new TaggedEntity(namespace, entityId)); if (tags != null) { return WSUtils.respondEntities(makeTagDto(tags), OK);
@POST @Path("/cache/{cacheType}/invalidate") @UnitOfWork public Response invalidateCache(@ApiParam(value = "Cache Id to be invalidated", required = true) @PathParam("cacheType") SchemaRegistryCacheType cacheType, String keyString) { try { LOG.debug("Request to invalidate cache : {} with key : {} accepted", cacheType.name(), keyString); schemaRegistry.invalidateCache(cacheType, keyString); return WSUtils.respond(Response.Status.OK); } catch (Exception e) { return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, e.getMessage()); } }
private Response _addSerDesInfo(SerDesPair serDesInfo) { Response response; try { Long serializerId = schemaRegistry.addSerDes(serDesInfo); response = WSUtils.respondEntity(serializerId, Response.Status.OK); } catch (Exception ex) { LOG.error("Encountered error while adding serializer/deserializer [{}]", serDesInfo, ex); response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } return response; }
@GET @Path("/schemas/{name}/branches") @ApiOperation(value = "Get list of registered schema branches", response = SchemaBranch.class, responseContainer = "List", tags = OPERATION_GROUP_OTHER) @Timed @UnitOfWork public Response getAllBranches(@ApiParam(value = "Details about schema name",required = true) @PathParam("name") String schemaName, @Context UriInfo uriInfo) { try { Collection<SchemaBranch> schemaBranches = schemaRegistry.getSchemaBranches(schemaName); return WSUtils.respondEntities(schemaBranches, Response.Status.OK); } catch(SchemaNotFoundException e) { return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName); } catch (Exception ex) { LOG.error("Encountered error while listing schema branches", ex); return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage()); } }
/** * Get a model info by name * <p> * curl -sS -X GET http://localhost:8080/api/v1/catalog/ml/models/names/testModel * </p> * <pre> *{ * "responseCode":1000, * "responseMessage":"Success", * "entities":{ * "id": 1, * "modelName": "model", * "pmmlFileName":"modelFile" * "timestamp":... * } *} * </pre> */ @GET @Path("ml/models/names/{name}") @Produces(MediaType.APPLICATION_JSON) @Timed public Response getModelInfoByName(@PathParam("name") final String modelName) { MLModel modelInfo = modelRegistryService.getModelInfo(modelName); return WSUtils.respondEntity(modelInfo, OK); }
@POST @Path("/cache/{cacheType}/invalidate") @UnitOfWork public Response invalidateCache(@ApiParam(value = "Cache Id to be invalidated", required = true) @PathParam("cacheType") SchemaRegistryCacheType cacheType, String keyString) { try { LOG.debug("Request to invalidate cache : {} with key : {} accepted", cacheType.name(), keyString); schemaRegistry.invalidateCache(cacheType, keyString); return WSUtils.respond(Response.Status.OK); } catch (Exception e) { return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, e.getMessage()); } }