Refs #10241: Expose API to Read the Context definition

Task-Url: https://support.d4science.org/issues/10241

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@158254 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-11-07 15:50:59 +00:00
parent f4673a0517
commit 73de150208
1 changed files with 17 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import java.util.UUID;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue; import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.PUT; import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -67,6 +68,21 @@ public class ContextManager {
return Response.status(Status.CREATED).entity(ret).type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build(); return Response.status(Status.CREATED).entity(ret).type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build();
} }
/**
* e.g. GET /resource-registry/context/c0f314e7-2807-4241-a792-2a6c79ed4fd0
* @param uuid
* @return
* @throws ContextException
*/
@GET
@Path("{" + ID_PATH_PARAM + "}")
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String read(@PathParam(ID_PATH_PARAM) String uuid)
throws ContextNotFoundException, ContextException {
logger.info("Requested to read {} with id {} ", Context.NAME, uuid);
return contextManager.read(UUID.fromString(uuid));
}
/** /**
* e.g. DELETE /resource-registry/context/c0f314e7-2807-4241-a792-2a6c79ed4fd0 * e.g. DELETE /resource-registry/context/c0f314e7-2807-4241-a792-2a6c79ed4fd0
* @param uuid * @param uuid