public class NiFiAtlasClient extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
private org.apache.atlas.AtlasClientV2 |
atlasClient |
private Pattern |
FLOW_PATH_URL_PATTERN |
private static org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
NiFiAtlasClient(org.apache.atlas.AtlasClientV2 atlasClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
(package private) void |
deleteTypeDefs(String... typeNames)
This is an utility method to delete unused types.
|
private Map<org.apache.atlas.model.instance.AtlasObjectId,org.apache.atlas.model.instance.AtlasEntity> |
fetchFlowComponents(String componentType,
Map<String,org.apache.atlas.model.instance.AtlasEntity> referredEntities)
Retrieves the flow components of type
componentType from Atlas server. |
NiFiFlow |
fetchNiFiFlow(String rootProcessGroupId,
String namespace)
Fetch existing NiFiFlow entity from Atlas.
|
private org.apache.atlas.model.typedef.AtlasTypesDef |
getTypeDefs(String... typeNames) |
boolean |
isNiFiTypeDefsRegistered() |
private Map<String,List<org.apache.atlas.model.instance.AtlasEntity>> |
registerDataSetEntities(NiFiFlow nifiFlow)
Register DataSet within specified NiFiFlow.
|
private Set<org.apache.atlas.model.instance.AtlasObjectId> |
registerFlowPathEntities(NiFiFlow nifiFlow) |
void |
registerNiFiFlow(NiFiFlow nifiFlow) |
private org.apache.atlas.model.instance.AtlasEntity |
registerNiFiFlowEntity(NiFiFlow nifiFlow) |
void |
registerNiFiTypeDefs(boolean update)
Create or update NiFi types in Atlas type system.
|
org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo |
searchEntityDef(org.apache.atlas.model.instance.AtlasObjectId id) |
private List<org.apache.atlas.model.instance.AtlasObjectId> |
toAtlasObjectIds(Object _references) |
private Map<org.apache.atlas.model.instance.AtlasObjectId,org.apache.atlas.model.instance.AtlasEntity> |
toQualifiedNameIds(List<org.apache.atlas.model.instance.AtlasObjectId> ids)
AtlasObjectIds returned from Atlas have GUID, but do not have qualifiedName, while ones created by the reporting task
do not have GUID, but qualifiedName.
|
private static final org.slf4j.Logger logger
private final org.apache.atlas.AtlasClientV2 atlasClient
private Pattern FLOW_PATH_URL_PATTERN
public NiFiAtlasClient(org.apache.atlas.AtlasClientV2 atlasClient)
public void close()
close in interface AutoCloseablevoid deleteTypeDefs(String... typeNames) throws org.apache.atlas.AtlasServiceException
typeNames - to deleteorg.apache.atlas.AtlasServiceExceptionpublic boolean isNiFiTypeDefsRegistered()
throws org.apache.atlas.AtlasServiceException
org.apache.atlas.AtlasServiceExceptionpublic void registerNiFiTypeDefs(boolean update)
throws org.apache.atlas.AtlasServiceException
update - If false, doesn't perform anything if there is existing type def for the name.org.apache.atlas.AtlasServiceExceptionprivate org.apache.atlas.model.typedef.AtlasTypesDef getTypeDefs(String... typeNames) throws org.apache.atlas.AtlasServiceException
org.apache.atlas.AtlasServiceExceptionpublic NiFiFlow fetchNiFiFlow(String rootProcessGroupId, String namespace) throws org.apache.atlas.AtlasServiceException
rootProcessGroupId - The id of a NiFi flow root process group.namespace - The namespace of a flow.org.apache.atlas.AtlasServiceException - Thrown if requesting to Atlas API failed, including when the flow is not found.private Map<org.apache.atlas.model.instance.AtlasObjectId,org.apache.atlas.model.instance.AtlasEntity> fetchFlowComponents(String componentType, Map<String,org.apache.atlas.model.instance.AtlasEntity> referredEntities)
componentType from Atlas server.
Deleted components will be filtered out before calling Atlas.
Atlas object ids will be initialized with all the attributes (guid, type, unique attributes) in order to be able
to match ids retrieved from Atlas (having guid) and ids created by the reporting task (not having guid yet).componentType - Atlas type of the flow component (nifi_flow_path, nifi_queue, nifi_input_port, nifi_output_port)referredEntities - referred entities of the flow entity (returned when the flow fetched) containing the basic data (id, status) of the flow componentsprivate List<org.apache.atlas.model.instance.AtlasObjectId> toAtlasObjectIds(Object _references)
private Map<org.apache.atlas.model.instance.AtlasObjectId,org.apache.atlas.model.instance.AtlasEntity> toQualifiedNameIds(List<org.apache.atlas.model.instance.AtlasObjectId> ids)
AtlasObjectIds returned from Atlas have GUID, but do not have qualifiedName, while ones created by the reporting task do not have GUID, but qualifiedName. AtlasObjectId.equals returns false for this combination. In order to match ids correctly, this method converts fetches actual entities from ids to get qualifiedName attribute.
Also, AtlasObjectIds returned from Atlas does not have entity state. If Atlas is configured to use soft-delete (default), deleted ids are still returned. Fetched entities are used to determine whether an AtlasObjectId is still active or deleted. Deleted entities will not be included in the result of this method.
ids - to convertpublic void registerNiFiFlow(NiFiFlow nifiFlow) throws org.apache.atlas.AtlasServiceException
org.apache.atlas.AtlasServiceExceptionprivate org.apache.atlas.model.instance.AtlasEntity registerNiFiFlowEntity(NiFiFlow nifiFlow) throws org.apache.atlas.AtlasServiceException
org.apache.atlas.AtlasServiceExceptionprivate Map<String,List<org.apache.atlas.model.instance.AtlasEntity>> registerDataSetEntities(NiFiFlow nifiFlow) throws org.apache.atlas.AtlasServiceException
org.apache.atlas.AtlasServiceExceptionprivate Set<org.apache.atlas.model.instance.AtlasObjectId> registerFlowPathEntities(NiFiFlow nifiFlow) throws org.apache.atlas.AtlasServiceException
org.apache.atlas.AtlasServiceExceptionpublic org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo searchEntityDef(org.apache.atlas.model.instance.AtlasObjectId id)
throws org.apache.atlas.AtlasServiceException
org.apache.atlas.AtlasServiceExceptionCopyright © 2024 Apache NiFi Project. All rights reserved.