use of org.apache.atlas.annotation.Timed in project atlas by apache.
the class EntityREST method updateClassificationsByUniqueAttribute.
/**
* Updates classification on an entity identified by its type and unique attributes.
* @param typeName
*/
@PUT
@Path("/uniqueAttribute/type/{typeName}/classifications")
@Timed
public void updateClassificationsByUniqueAttribute(@PathParam("typeName") String typeName, @Context HttpServletRequest servletRequest, List<AtlasClassification> classifications) throws AtlasBaseException {
Servlets.validateQueryParamLength("typeName", typeName);
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.updateClassificationsByUniqueAttribute(" + typeName + ")");
}
AtlasEntityType entityType = ensureEntityType(typeName);
Map<String, Object> attributes = getAttributes(servletRequest);
String guid = entitiesStore.getGuidByUniqueAttributes(entityType, attributes);
if (guid == null) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND, typeName, attributes.toString());
}
entitiesStore.updateClassifications(guid, classifications);
} finally {
AtlasPerfTracer.log(perf);
}
}
use of org.apache.atlas.annotation.Timed in project atlas by apache.
the class EntityREST method getEntityHeaders.
@GET
@Path("bulk/headers")
@Produces(Servlets.JSON_MEDIA_TYPE)
@Timed
public AtlasEntityHeaders getEntityHeaders(@QueryParam("tagUpdateStartTime") long tagUpdateStartTime) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
long tagUpdateEndTime = System.currentTimeMillis();
if (tagUpdateStartTime > tagUpdateEndTime) {
throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "fromTimestamp should be less than toTimestamp");
}
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.getEntityHeaders(" + tagUpdateStartTime + ", " + tagUpdateEndTime + ")");
}
ClassificationAssociator.Retriever associator = new ClassificationAssociator.Retriever(typeRegistry, auditRepository);
return associator.get(tagUpdateStartTime, tagUpdateEndTime);
} finally {
AtlasPerfTracer.log(perf);
}
}
use of org.apache.atlas.annotation.Timed in project atlas by apache.
the class EntityREST method getHeaderById.
/**
* Get entity header given its GUID.
* @param guid GUID for the entity
* @return AtlasEntity
* @throws AtlasBaseException
*/
@GET
@Path("/guid/{guid}/header")
@Timed
public AtlasEntityHeader getHeaderById(@PathParam("guid") String guid) throws AtlasBaseException {
Servlets.validateQueryParamLength("guid", guid);
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.getHeaderById(" + guid + ")");
}
return entitiesStore.getHeaderById(guid);
} finally {
AtlasPerfTracer.log(perf);
}
}
use of org.apache.atlas.annotation.Timed in project atlas by apache.
the class EntityREST method deleteClassification.
/**
* Deletes a given classification from an existing entity represented by a guid.
* @param guid globally unique identifier for the entity
* @param classificationName name of the classifcation
*/
@DELETE
@Path("/guid/{guid}/classification/{classificationName}")
@Timed
public void deleteClassification(@PathParam("guid") String guid, @PathParam("classificationName") final String classificationName, @QueryParam("associatedEntityGuid") final String associatedEntityGuid) throws AtlasBaseException {
Servlets.validateQueryParamLength("guid", guid);
Servlets.validateQueryParamLength("classificationName", classificationName);
Servlets.validateQueryParamLength("associatedEntityGuid", associatedEntityGuid);
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.deleteClassification(" + guid + "," + classificationName + "," + associatedEntityGuid + ")");
}
if (StringUtils.isEmpty(guid)) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
}
ensureClassificationType(classificationName);
entitiesStore.deleteClassification(guid, classificationName, associatedEntityGuid);
} finally {
AtlasPerfTracer.log(perf);
}
}
use of org.apache.atlas.annotation.Timed in project atlas by apache.
the class EntityREST method getById.
/**
* Fetch complete definition of an entity given its GUID.
* @param guid GUID for the entity
* @return AtlasEntity
* @throws AtlasBaseException
*/
@GET
@Path("/guid/{guid}")
@Timed
public AtlasEntityWithExtInfo getById(@PathParam("guid") String guid, @QueryParam("minExtInfo") @DefaultValue("false") boolean minExtInfo, @QueryParam("ignoreRelationships") @DefaultValue("false") boolean ignoreRelationships) throws AtlasBaseException {
Servlets.validateQueryParamLength("guid", guid);
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.getById(" + guid + ", " + minExtInfo + " )");
}
return entitiesStore.getById(guid, minExtInfo, ignoreRelationships);
} finally {
AtlasPerfTracer.log(perf);
}
}
Aggregations