use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NifiConnectionOrderVisitor method fetchProcessGroupForNameAndIdentifier.
private ProcessGroupDTO fetchProcessGroupForNameAndIdentifier(String groupId) {
// fetch it
ProcessGroupDTO processGroupEntity = null;
try {
try {
log.debug("fetchProcessGroup {} ", groupId);
processGroupEntity = getGroup(groupId);
} catch (NifiComponentNotFoundException e) {
log.debug("Unable to find the process group " + groupId);
}
} catch (Exception e) {
log.error("Exception fetching the process group " + groupId);
}
return processGroupEntity;
}
use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NifiConnectionOrderVisitor method visitProcessGroup.
@Override
public void visitProcessGroup(NifiVisitableProcessGroup processGroup) {
log.debug(" Visit Process Group: {}, ({}) ", processGroup.getDto().getName(), processGroup.getDto().getId());
NifiVisitableProcessGroup group = visitedProcessGroups.get(processGroup.getDto().getId());
if (group == null) {
group = processGroup;
}
this.currentProcessGroup = group;
if (processGroup.getParentProcessGroup() == null) {
try {
ProcessGroupDTO parent = fetchProcessGroupForNameAndIdentifier(processGroup.getDto().getParentGroupId());
if (parent != null) {
group.setParentProcessGroup(parent);
}
} catch (NifiComponentNotFoundException e) {
// cant find the parent
}
}
group.accept(this);
this.visitedProcessGroups.put(group.getDto().getId(), group);
}
use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NifiConnectionOrderVisitor method searchConnectionMatchingSource.
private ConnectionDTO searchConnectionMatchingSource(String parentGroupId, String destinationId) {
// search up to find the connection that matches this dest id
try {
ProcessGroupDTO parent = null;
try {
log.debug("fetch ProcessGroup for searchConnectionMatchingSource {} ", parentGroupId);
parent = getGroup(parentGroupId);
} catch (NifiComponentNotFoundException e) {
log.debug("Exception searching Connection matching the source. Parent Group ID: " + parentGroupId + ", and destinationId of " + destinationId);
}
if (parent != null) {
// processGroup.getDto().setParent(parentParent.getProcessGroup());
// get Contents of this parent
NifiVisitableProcessGroup visitableProcessGroup = new NifiVisitableProcessGroup(parent);
ConnectionDTO conn = visitableProcessGroup.getConnectionMatchingSourceId(destinationId);
if (conn != null) {
return conn;
}
if (conn == null && parent.getParentGroupId() != null) {
return searchConnectionMatchingSource(parent.getParentGroupId(), destinationId);
}
}
} catch (Exception e) {
log.error("Exception searching Connection matching the source. Parent Group ID: " + parentGroupId + ", and destinationId of " + destinationId);
}
return null;
}
use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NiFiProcessGroupsRestClientV1 method instantiateTemplate.
@Nonnull
@Override
public FlowSnippetDTO instantiateTemplate(@Nonnull final String processGroupId, @Nonnull final String templateId) {
final InstantiateTemplateRequestEntity entity = new InstantiateTemplateRequestEntity();
entity.setOriginX(10.0);
entity.setOriginY(10.0);
entity.setTemplateId(templateId);
try {
final FlowEntity flow = client.post(BASE_PATH + processGroupId + "/template-instance", entity, FlowEntity.class);
return toFlowSnippet(flow.getFlow(), true);
} catch (final NotFoundException e) {
throw new NifiComponentNotFoundException(processGroupId, NifiConstants.NIFI_COMPONENT_TYPE.PROCESS_GROUP, e);
} catch (final ClientErrorException e) {
final String msg = e.getResponse().readEntity(String.class);
throw new NifiComponentNotFoundException("Unable to create Template instance for templateId: " + templateId + " under Process Group " + processGroupId + ". " + msg);
}
}
use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NiFiProcessGroupsRestClientV1 method schedule.
@Override
public void schedule(@Nonnull final String processGroupId, @Nonnull final String parentGroupId, @Nonnull final NiFiComponentState state) {
final ScheduleComponentsEntity entity = new ScheduleComponentsEntity();
entity.setId(processGroupId);
entity.setState(state.toString());
try {
client.put("/flow/process-groups/" + processGroupId, entity, ScheduleComponentsEntity.class);
} catch (final NotFoundException e) {
throw new NifiComponentNotFoundException(processGroupId, NifiConstants.NIFI_COMPONENT_TYPE.PROCESS_GROUP, e);
}
}
Aggregations