use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NifiConnectionOrderVisitor method fetchProcessGroup.
private NifiVisitableProcessGroup fetchProcessGroup(String groupId) {
NifiVisitableProcessGroup group = processGroup;
// 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);
}
// if the parent is null the parent is the starting process group
if (processGroupEntity != null) {
group = new NifiVisitableProcessGroup(processGroupEntity);
}
} catch (Exception e) {
log.error("Exception fetching the process group " + groupId);
}
return group;
}
use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NiFiPortsRestClientV1 method deleteInputPort.
@Override
public PortDTO deleteInputPort(@Nonnull String portId) {
try {
PortEntity current = client.get("/input-ports/" + portId, null, PortEntity.class);
if (current != null) {
Map<String, Object> params = new HashMap<>();
params.put("version", current.getRevision().getVersion());
params.put("clientId", current.getRevision().getClientId());
PortEntity inputPortsEntity = client.delete("/input-ports/" + portId, params, PortEntity.class);
if (inputPortsEntity != null) {
return inputPortsEntity.getComponent();
}
}
} catch (NotFoundException e) {
throw new NifiComponentNotFoundException(portId, NifiConstants.NIFI_COMPONENT_TYPE.INPUT_PORT, e);
}
return null;
}
use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NiFiPortsRestClientV1 method updateOutputPort.
@Nonnull
@Override
public PortDTO updateOutputPort(@Nonnull final String processGroupId, @Nonnull final PortDTO outputPort) {
// Get revision
final PortEntity current;
try {
current = client.get("/output-ports/" + outputPort.getId(), null, PortEntity.class);
} catch (NotFoundException e) {
throw new NifiComponentNotFoundException(outputPort.getId(), NifiConstants.NIFI_COMPONENT_TYPE.OUTPUT_PORT, e);
}
// Update output port
final PortEntity entity = new PortEntity();
entity.setComponent(outputPort);
final RevisionDTO revision = new RevisionDTO();
revision.setVersion(current.getRevision().getVersion());
entity.setRevision(revision);
try {
return client.put("/output-ports/" + outputPort.getId(), entity, PortEntity.class).getComponent();
} catch (final NotFoundException e) {
throw new NifiComponentNotFoundException(outputPort.getId(), NifiConstants.NIFI_COMPONENT_TYPE.OUTPUT_PORT, e);
}
}
use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NiFiPortsRestClientV1 method updateInputPort.
@Nonnull
@Override
public PortDTO updateInputPort(@Nonnull final String processGroupId, @Nonnull final PortDTO inputPort) {
// Get revision
final PortEntity current;
try {
current = client.get("/input-ports/" + inputPort.getId(), null, PortEntity.class);
} catch (NotFoundException e) {
throw new NifiComponentNotFoundException(inputPort.getId(), NifiConstants.NIFI_COMPONENT_TYPE.INPUT_PORT, e);
}
// Update input port
final PortEntity entity = new PortEntity();
entity.setComponent(inputPort);
final RevisionDTO revision = new RevisionDTO();
revision.setVersion(current.getRevision().getVersion());
entity.setRevision(revision);
try {
return client.put("/input-ports/" + inputPort.getId(), entity, PortEntity.class).getComponent();
} catch (final NotFoundException e) {
throw new NifiComponentNotFoundException(inputPort.getId(), NifiConstants.NIFI_COMPONENT_TYPE.INPUT_PORT, e);
}
}
use of com.thinkbiganalytics.nifi.rest.client.NifiComponentNotFoundException in project kylo by Teradata.
the class NiFiProcessGroupsRestClientV1 method createConnection.
@Nonnull
@Override
public ConnectionDTO createConnection(@Nonnull final String processGroupId, @Nonnull final ConnectableDTO source, @Nonnull final ConnectableDTO dest) {
final ConnectionEntity entity = new ConnectionEntity();
final ConnectionDTO connection = new ConnectionDTO();
connection.setDestination(dest);
connection.setName(source.getName() + "-" + dest.getName());
connection.setSource(source);
entity.setComponent(connection);
final RevisionDTO revision = new RevisionDTO();
revision.setVersion(0L);
entity.setRevision(revision);
try {
return client.post(BASE_PATH + processGroupId + "/connections", entity, ConnectionEntity.class).getComponent();
} catch (final NotFoundException e) {
throw new NifiComponentNotFoundException(processGroupId, NifiConstants.NIFI_COMPONENT_TYPE.PROCESS_GROUP, e);
}
}
Aggregations