Search in sources :

Example 1 with EntityUpdateRequestV2

use of org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2 in project atlas by apache.

the class HBaseAtlasHook method createOrUpdateColumnFamilyInstance.

private void createOrUpdateColumnFamilyInstance(HBaseOperationContext hbaseOperationContext) {
    AtlasEntity nameSpace = buildNameSpace(hbaseOperationContext);
    AtlasEntity table = buildTable(hbaseOperationContext, nameSpace);
    AtlasEntity columnFamily = buildColumnFamily(hbaseOperationContext, hbaseOperationContext.gethColumnDescriptor(), nameSpace, table);
    AtlasEntitiesWithExtInfo entities = new AtlasEntitiesWithExtInfo(columnFamily);
    entities.addReferredEntity(nameSpace);
    entities.addReferredEntity(table);
    switch(hbaseOperationContext.getOperation()) {
        case CREATE_COLUMN_FAMILY:
            LOG.info("Create ColumnFamily {}", columnFamily.getAttribute(REFERENCEABLE_ATTRIBUTE_NAME));
            hbaseOperationContext.addMessage(new EntityCreateRequestV2(hbaseOperationContext.getUser(), entities));
            break;
        case ALTER_COLUMN_FAMILY:
            LOG.info("Alter ColumnFamily {}", columnFamily.getAttribute(REFERENCEABLE_ATTRIBUTE_NAME));
            hbaseOperationContext.addMessage(new EntityUpdateRequestV2(hbaseOperationContext.getUser(), entities));
            break;
    }
}
Also used : AtlasEntity(org.apache.atlas.model.instance.AtlasEntity) AtlasEntitiesWithExtInfo(org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo) EntityUpdateRequestV2(org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2) EntityCreateRequestV2(org.apache.atlas.model.notification.HookNotification.EntityCreateRequestV2)

Example 2 with EntityUpdateRequestV2

use of org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2 in project atlas by apache.

the class HBaseAtlasHook method createOrUpdateNamespaceInstance.

private void createOrUpdateNamespaceInstance(HBaseOperationContext hbaseOperationContext) {
    AtlasEntity nameSpace = buildNameSpace(hbaseOperationContext);
    switch(hbaseOperationContext.getOperation()) {
        case CREATE_NAMESPACE:
            LOG.info("Create NameSpace {}", nameSpace.getAttribute(REFERENCEABLE_ATTRIBUTE_NAME));
            hbaseOperationContext.addMessage(new EntityCreateRequestV2(hbaseOperationContext.getUser(), new AtlasEntitiesWithExtInfo(nameSpace)));
            break;
        case ALTER_NAMESPACE:
            LOG.info("Modify NameSpace {}", nameSpace.getAttribute(REFERENCEABLE_ATTRIBUTE_NAME));
            hbaseOperationContext.addMessage(new EntityUpdateRequestV2(hbaseOperationContext.getUser(), new AtlasEntitiesWithExtInfo(nameSpace)));
            break;
    }
}
Also used : AtlasEntity(org.apache.atlas.model.instance.AtlasEntity) AtlasEntitiesWithExtInfo(org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo) EntityUpdateRequestV2(org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2) EntityCreateRequestV2(org.apache.atlas.model.notification.HookNotification.EntityCreateRequestV2)

Example 3 with EntityUpdateRequestV2

use of org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2 in project atlas by apache.

the class HBaseAtlasHook method createOrUpdateTableInstance.

private void createOrUpdateTableInstance(HBaseOperationContext hbaseOperationContext) {
    AtlasEntity nameSpace = buildNameSpace(hbaseOperationContext);
    AtlasEntity table = buildTable(hbaseOperationContext, nameSpace);
    List<AtlasEntity> columnFamilies = buildColumnFamilies(hbaseOperationContext, nameSpace, table);
    table.setAttribute(ATTR_COLUMNFAMILIES, AtlasTypeUtil.getAtlasObjectIds(columnFamilies));
    AtlasEntitiesWithExtInfo entities = new AtlasEntitiesWithExtInfo(table);
    entities.addReferredEntity(nameSpace);
    if (CollectionUtils.isNotEmpty(columnFamilies)) {
        for (AtlasEntity columnFamily : columnFamilies) {
            entities.addReferredEntity(columnFamily);
        }
    }
    switch(hbaseOperationContext.getOperation()) {
        case CREATE_TABLE:
            LOG.info("Create Table {}", table.getAttribute(REFERENCEABLE_ATTRIBUTE_NAME));
            hbaseOperationContext.addMessage(new EntityCreateRequestV2(hbaseOperationContext.getUser(), entities));
            break;
        case ALTER_TABLE:
            LOG.info("Modify Table {}", table.getAttribute(REFERENCEABLE_ATTRIBUTE_NAME));
            hbaseOperationContext.addMessage(new EntityUpdateRequestV2(hbaseOperationContext.getUser(), entities));
            break;
    }
}
Also used : AtlasEntity(org.apache.atlas.model.instance.AtlasEntity) AtlasEntitiesWithExtInfo(org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo) EntityUpdateRequestV2(org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2) EntityCreateRequestV2(org.apache.atlas.model.notification.HookNotification.EntityCreateRequestV2)

Example 4 with EntityUpdateRequestV2

use of org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2 in project atlas by apache.

the class AlterDatabase method getNotificationMessages.

@Override
public List<HookNotification> getNotificationMessages() throws Exception {
    List<HookNotification> ret = null;
    AtlasEntitiesWithExtInfo entities = getEntities();
    if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) {
        ret = Collections.singletonList(new EntityUpdateRequestV2(getUserName(), entities));
    }
    return ret;
}
Also used : HookNotification(org.apache.atlas.model.notification.HookNotification) AtlasEntitiesWithExtInfo(org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo) EntityUpdateRequestV2(org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2)

Example 5 with EntityUpdateRequestV2

use of org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2 in project atlas by apache.

the class AlterTable method getNotificationMessages.

@Override
public List<HookNotification> getNotificationMessages() throws Exception {
    List<HookNotification> ret = null;
    AtlasEntitiesWithExtInfo entities = getEntities();
    if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) {
        ret = Collections.singletonList(new EntityUpdateRequestV2(getUserName(), entities));
    }
    return ret;
}
Also used : HookNotification(org.apache.atlas.model.notification.HookNotification) AtlasEntitiesWithExtInfo(org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo) EntityUpdateRequestV2(org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2)

Aggregations

AtlasEntitiesWithExtInfo (org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo)7 EntityUpdateRequestV2 (org.apache.atlas.model.notification.HookNotification.EntityUpdateRequestV2)7 AtlasEntity (org.apache.atlas.model.instance.AtlasEntity)4 HookNotification (org.apache.atlas.model.notification.HookNotification)4 EntityCreateRequestV2 (org.apache.atlas.model.notification.HookNotification.EntityCreateRequestV2)3 AtlasObjectId (org.apache.atlas.model.instance.AtlasObjectId)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 AtlasEntityWithExtInfo (org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo)1 EntityPartialUpdateRequestV2 (org.apache.atlas.model.notification.HookNotification.EntityPartialUpdateRequestV2)1 WriteEntity (org.apache.hadoop.hive.ql.hooks.WriteEntity)1 Table (org.apache.hadoop.hive.ql.metadata.Table)1 Test (org.testng.annotations.Test)1