use of org.apache.atlas.utils.AtlasPerfTracer in project incubator-atlas by apache.
the class TaxonomyService method getTaxonomies.
@GET
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response getTaxonomies(@Context HttpHeaders headers, @Context UriInfo ui) throws CatalogException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TaxonomyService.getTaxonomies()");
}
String queryString = decode(getQueryString(ui));
Request request = new CollectionRequest(Collections.<String, Object>emptyMap(), queryString);
Result result = getResources(taxonomyResourceProvider, request);
return Response.status(Response.Status.OK).entity(getSerializer().serialize(result, ui)).build();
} finally {
AtlasPerfTracer.log(perf);
}
}
use of org.apache.atlas.utils.AtlasPerfTracer in project incubator-atlas by apache.
the class TaxonomyService method updateTaxonomy.
@PUT
@Path("{taxonomyName}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response updateTaxonomy(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("taxonomyName") String taxonomyName) throws CatalogException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TaxonomyService.updateTaxonomy(" + taxonomyName + ")");
}
Map<String, Object> queryProperties = new HashMap<>();
queryProperties.put("name", taxonomyName);
Map<String, Object> updateProperties = parsePayload(body);
updateResource(taxonomyResourceProvider, new InstanceRequest(queryProperties, updateProperties));
return Response.status(Response.Status.OK).entity(new Results(ui.getRequestUri().toString(), 200)).build();
} finally {
AtlasPerfTracer.log(perf);
}
}
use of org.apache.atlas.utils.AtlasPerfTracer in project incubator-atlas by apache.
the class TaxonomyService method deleteTerm.
@DELETE
@Path("{taxonomyName}/terms/{termName}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response deleteTerm(@Context HttpHeaders headers, @Context UriInfo ui, @PathParam("taxonomyName") String taxonomyName, @PathParam("termName") String termName) throws CatalogException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TaxonomyService.deleteTerm(" + taxonomyName + ", " + termName + ")");
}
Map<String, Object> properties = new HashMap<>();
properties.put("termPath", new TermPath(taxonomyName, termName));
deleteResource(termResourceProvider, new InstanceRequest(properties));
return Response.status(Response.Status.OK).entity(new Results(ui.getRequestUri().toString(), 200)).build();
} finally {
AtlasPerfTracer.log(perf);
}
}
use of org.apache.atlas.utils.AtlasPerfTracer in project incubator-atlas by apache.
the class TaxonomyService method updateSubTerm.
@PUT
@Path("{taxonomyName}/terms/{termName}/{remainder:.*}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response updateSubTerm(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("taxonomyName") String taxonomyName, @PathParam("termName") String termName, @PathParam("remainder") String remainder) throws CatalogException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TaxonomyService.updateSubTerm(" + taxonomyName + ", " + termName + ", " + remainder + ")");
}
Map<String, Object> queryProperties = new HashMap<>();
queryProperties.put("termPath", new TermPath(taxonomyName, String.format("%s%s", termName, remainder.replaceAll("/?terms/?([.]*)", "$1."))));
Map<String, Object> updateProperties = parsePayload(body);
updateResource(termResourceProvider, new InstanceRequest(queryProperties, updateProperties));
return Response.status(Response.Status.OK).entity(new Results(ui.getRequestUri().toString(), 200)).build();
} finally {
AtlasPerfTracer.log(perf);
}
}
use of org.apache.atlas.utils.AtlasPerfTracer in project incubator-atlas by apache.
the class TaxonomyService method getTaxonomy.
@GET
@Path("{taxonomyName}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response getTaxonomy(@Context HttpHeaders headers, @Context UriInfo ui, @PathParam("taxonomyName") String taxonomyName) throws CatalogException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TaxonomyService.getTaxonomy(" + taxonomyName + ")");
}
Map<String, Object> properties = new HashMap<>();
properties.put("name", taxonomyName);
Result result = getResource(taxonomyResourceProvider, new InstanceRequest(properties));
return Response.status(Response.Status.OK).entity(getSerializer().serialize(result, ui)).build();
} finally {
AtlasPerfTracer.log(perf);
}
}
Aggregations