Search in sources :

Example 6 with SerDesInfo

use of com.hortonworks.registries.schemaregistry.SerDesInfo in project registry by hortonworks.

the class SchemaRegistryResource method getSerializers.

@GET
@Path("/schemas/{name}/serdes")
@ApiOperation(value = "Get list of Serializers registered for the given schema name", response = SerDesInfo.class, responseContainer = "List", tags = OPERATION_GROUP_SERDE)
@Timed
@UnitOfWork
public Response getSerializers(@ApiParam(value = "Schema name", required = true) @PathParam("name") String schemaName) {
    Response response;
    try {
        SchemaMetadataInfo schemaMetadataInfoStorable = schemaRegistry.getSchemaMetadataInfo(schemaName);
        if (schemaMetadataInfoStorable != null) {
            Collection<SerDesInfo> schemaSerializers = schemaRegistry.getSerDes(schemaMetadataInfoStorable.getSchemaMetadata().getName());
            response = WSUtils.respondEntities(schemaSerializers, Response.Status.OK);
        } else {
            LOG.info("No schemas found with schemakey: [{}]", schemaName);
            response = WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName);
        }
    } catch (Exception ex) {
        LOG.error("Encountered error while getting serializers for schemaKey [{}]", schemaName, ex);
        response = WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage());
    }
    return response;
}
Also used : Response(javax.ws.rs.core.Response) CatalogResponse(com.hortonworks.registries.common.catalog.CatalogResponse) SerDesInfo(com.hortonworks.registries.schemaregistry.SerDesInfo) SchemaBranchNotFoundException(com.hortonworks.registries.schemaregistry.errors.SchemaBranchNotFoundException) InvalidSchemaBranchDeletionException(com.hortonworks.registries.schemaregistry.errors.InvalidSchemaBranchDeletionException) FileNotFoundException(java.io.FileNotFoundException) SchemaNotFoundException(com.hortonworks.registries.schemaregistry.errors.SchemaNotFoundException) SchemaBranchAlreadyExistsException(com.hortonworks.registries.schemaregistry.errors.SchemaBranchAlreadyExistsException) UnsupportedSchemaTypeException(com.hortonworks.registries.schemaregistry.errors.UnsupportedSchemaTypeException) IncompatibleSchemaException(com.hortonworks.registries.schemaregistry.errors.IncompatibleSchemaException) InvalidSchemaException(com.hortonworks.registries.schemaregistry.errors.InvalidSchemaException) SchemaLifecycleException(com.hortonworks.registries.schemaregistry.state.SchemaLifecycleException) IOException(java.io.IOException) AggregatedSchemaMetadataInfo(com.hortonworks.registries.schemaregistry.AggregatedSchemaMetadataInfo) SchemaMetadataInfo(com.hortonworks.registries.schemaregistry.SchemaMetadataInfo) Path(javax.ws.rs.Path) UnitOfWork(com.hortonworks.registries.common.transaction.UnitOfWork) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

SerDesInfo (com.hortonworks.registries.schemaregistry.SerDesInfo)6 IncompatibleSchemaException (com.hortonworks.registries.schemaregistry.errors.IncompatibleSchemaException)4 InvalidSchemaException (com.hortonworks.registries.schemaregistry.errors.InvalidSchemaException)4 SchemaBranchAlreadyExistsException (com.hortonworks.registries.schemaregistry.errors.SchemaBranchAlreadyExistsException)4 SchemaBranchNotFoundException (com.hortonworks.registries.schemaregistry.errors.SchemaBranchNotFoundException)4 SchemaNotFoundException (com.hortonworks.registries.schemaregistry.errors.SchemaNotFoundException)4 SchemaLifecycleException (com.hortonworks.registries.schemaregistry.state.SchemaLifecycleException)4 IOException (java.io.IOException)4 CatalogResponse (com.hortonworks.registries.common.catalog.CatalogResponse)3 SchemaMetadataInfo (com.hortonworks.registries.schemaregistry.SchemaMetadataInfo)3 InvalidSchemaBranchDeletionException (com.hortonworks.registries.schemaregistry.errors.InvalidSchemaBranchDeletionException)3 UnsupportedSchemaTypeException (com.hortonworks.registries.schemaregistry.errors.UnsupportedSchemaTypeException)3 FileNotFoundException (java.io.FileNotFoundException)3 Response (javax.ws.rs.core.Response)3 Timed (com.codahale.metrics.annotation.Timed)2 UnitOfWork (com.hortonworks.registries.common.transaction.UnitOfWork)2 AggregatedSchemaMetadataInfo (com.hortonworks.registries.schemaregistry.AggregatedSchemaMetadataInfo)2 SchemaMetadata (com.hortonworks.registries.schemaregistry.SchemaMetadata)2 ArrayList (java.util.ArrayList)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1