Java Code Examples for org.apache.atlas.AtlasServiceException#getStatus()

The following examples show how to use org.apache.atlas.AtlasServiceException#getStatus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HiveMetaStoreBridge.java    From atlas with Apache License 2.0 6 votes vote down vote up
private AtlasEntityWithExtInfo findEntity(final String typeName, final String qualifiedName) throws AtlasServiceException {
    AtlasEntityWithExtInfo ret = null;

    try {
        ret = atlasClientV2.getEntityByAttribute(typeName, Collections.singletonMap(ATTRIBUTE_QUALIFIED_NAME, qualifiedName));
    } catch (AtlasServiceException e) {
        if(e.getStatus() == ClientResponse.Status.NOT_FOUND) {
            return null;
        }

        throw e;
    }

    clearRelationshipAttributes(ret);

    return ret;
}
 
Example 2
Source File: HiveITBase.java    From atlas with Apache License 2.0 6 votes vote down vote up
protected void assertEntityIsNotRegistered(final String typeName, final String property, final String value) throws Exception {
    // wait for sufficient time before checking if entity is not available.
    long waitTime = 10000;
    LOG.debug("Waiting for {} msecs, before asserting entity is not registered.", waitTime);
    Thread.sleep(waitTime);

    try {
        atlasClientV2.getEntityByAttribute(typeName, Collections.singletonMap(property, value));

        fail(String.format("Entity was not supposed to exist for typeName = %s, attributeName = %s, attributeValue = %s", typeName, property, value));
    } catch (AtlasServiceException e) {
        if (e.getStatus() == NOT_FOUND) {
            return;
        }
    }
}
 
Example 3
Source File: FalconHookIT.java    From atlas with Apache License 2.0 5 votes vote down vote up
private boolean isDataModelAlreadyRegistered() throws Exception {
    try {
        atlasClient.getType(FalconDataTypes.FALCON_PROCESS.getName());
        LOG.info("Hive data model is already registered!");
        return true;
    } catch(AtlasServiceException ase) {
        if (ase.getStatus() == ClientResponse.Status.NOT_FOUND) {
            return false;
        }
        throw ase;
    }
}
 
Example 4
Source File: FalconHookIT.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
private boolean isDataModelAlreadyRegistered() throws Exception {
    try {
        atlasClient.getType(FalconDataTypes.FALCON_PROCESS.getName());
        LOG.info("Hive data model is already registered!");
        return true;
    } catch(AtlasServiceException ase) {
        if (ase.getStatus() == ClientResponse.Status.NOT_FOUND) {
            return false;
        }
        throw ase;
    }
}
 
Example 5
Source File: HiveMetaStoreBridge.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
private Referenceable getEntityReference(final String typeName, final String tblQualifiedName) throws AtlasServiceException {
    AtlasClient dgiClient = getAtlasClient();
    try {
        return dgiClient.getEntity(typeName, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tblQualifiedName);
    } catch (AtlasServiceException e) {
        if(e.getStatus() == ClientResponse.Status.NOT_FOUND) {
            return null;
        }
        throw e;
    }
}