Search in sources :

Example 21 with ResourceNotFoundException

use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.

the class StandardConnectionDAO method getFlowFileListingRequest.

@Override
public ListFlowFileStatus getFlowFileListingRequest(String connectionId, String listingRequestId) {
    final Connection connection = locateConnection(connectionId);
    final FlowFileQueue queue = connection.getFlowFileQueue();
    final ListFlowFileStatus listRequest = queue.getListFlowFileStatus(listingRequestId);
    if (listRequest == null) {
        throw new ResourceNotFoundException(String.format("Unable to find listing request with id '%s'.", listingRequestId));
    }
    return listRequest;
}
Also used : ListFlowFileStatus(org.apache.nifi.controller.queue.ListFlowFileStatus) Connection(org.apache.nifi.connectable.Connection) FlowFileQueue(org.apache.nifi.controller.queue.FlowFileQueue) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Example 22 with ResourceNotFoundException

use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.

the class StandardConnectionDAO method getFlowFileDropRequest.

@Override
public DropFlowFileStatus getFlowFileDropRequest(String connectionId, String dropRequestId) {
    final Connection connection = locateConnection(connectionId);
    final FlowFileQueue queue = connection.getFlowFileQueue();
    final DropFlowFileStatus dropRequest = queue.getDropFlowFileStatus(dropRequestId);
    if (dropRequest == null) {
        throw new ResourceNotFoundException(String.format("Unable to find drop request with id '%s'.", dropRequestId));
    }
    return dropRequest;
}
Also used : Connection(org.apache.nifi.connectable.Connection) DropFlowFileStatus(org.apache.nifi.controller.queue.DropFlowFileStatus) FlowFileQueue(org.apache.nifi.controller.queue.FlowFileQueue) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Example 23 with ResourceNotFoundException

use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.

the class StandardConnectionDAO method deleteFlowFileListingRequest.

@Override
public ListFlowFileStatus deleteFlowFileListingRequest(String connectionId, String listingRequestId) {
    final Connection connection = locateConnection(connectionId);
    final FlowFileQueue queue = connection.getFlowFileQueue();
    final ListFlowFileStatus listFlowFileStatus = queue.cancelListFlowFileRequest(listingRequestId);
    if (listFlowFileStatus == null) {
        throw new ResourceNotFoundException(String.format("Unable to find listing request with id '%s'.", listingRequestId));
    }
    return listFlowFileStatus;
}
Also used : ListFlowFileStatus(org.apache.nifi.controller.queue.ListFlowFileStatus) Connection(org.apache.nifi.connectable.Connection) FlowFileQueue(org.apache.nifi.controller.queue.FlowFileQueue) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Example 24 with ResourceNotFoundException

use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.

the class StandardControllerServiceDAO method createControllerService.

@Override
public ControllerServiceNode createControllerService(final ControllerServiceDTO controllerServiceDTO) {
    // ensure the type is specified
    if (controllerServiceDTO.getType() == null) {
        throw new IllegalArgumentException("The controller service type must be specified.");
    }
    try {
        // create the controller service
        final ControllerServiceNode controllerService = serviceProvider.createControllerService(controllerServiceDTO.getType(), controllerServiceDTO.getId(), BundleUtils.getBundle(controllerServiceDTO.getType(), controllerServiceDTO.getBundle()), Collections.emptySet(), true);
        // ensure we can perform the update
        verifyUpdate(controllerService, controllerServiceDTO);
        // perform the update
        configureControllerService(controllerService, controllerServiceDTO);
        final String groupId = controllerServiceDTO.getParentGroupId();
        if (groupId == null) {
            flowController.addRootControllerService(controllerService);
        } else {
            final ProcessGroup group;
            if (groupId.equals(ROOT_GROUP_ID_ALIAS)) {
                group = flowController.getGroup(flowController.getRootGroupId());
            } else {
                group = flowController.getGroup(flowController.getRootGroupId()).findProcessGroup(groupId);
            }
            if (group == null) {
                throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
            }
            group.addControllerService(controllerService);
        }
        return controllerService;
    } catch (final ControllerServiceInstantiationException csie) {
        throw new NiFiCoreException(csie.getMessage(), csie);
    }
}
Also used : NiFiCoreException(org.apache.nifi.web.NiFiCoreException) ControllerServiceNode(org.apache.nifi.controller.service.ControllerServiceNode) ProcessGroup(org.apache.nifi.groups.ProcessGroup) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException) ControllerServiceInstantiationException(org.apache.nifi.controller.exception.ControllerServiceInstantiationException)

Example 25 with ResourceNotFoundException

use of org.apache.nifi.web.ResourceNotFoundException in project nifi by apache.

the class StandardFunnelDAO method locateFunnel.

private Funnel locateFunnel(final String funnelId) {
    final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId());
    final Funnel funnel = rootGroup.findFunnel(funnelId);
    if (funnel == null) {
        throw new ResourceNotFoundException(String.format("Unable to find funnel with id '%s'.", funnelId));
    } else {
        return funnel;
    }
}
Also used : Funnel(org.apache.nifi.connectable.Funnel) ProcessGroup(org.apache.nifi.groups.ProcessGroup) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Aggregations

ResourceNotFoundException (org.apache.nifi.web.ResourceNotFoundException)59 ProcessGroup (org.apache.nifi.groups.ProcessGroup)22 Authorizable (org.apache.nifi.authorization.resource.Authorizable)16 RemoteProcessGroup (org.apache.nifi.groups.RemoteProcessGroup)16 NiFiUser (org.apache.nifi.authorization.user.NiFiUser)12 Connection (org.apache.nifi.connectable.Connection)10 VersionedProcessGroup (org.apache.nifi.registry.flow.VersionedProcessGroup)10 IOException (java.io.IOException)9 RemoteGroupPort (org.apache.nifi.remote.RemoteGroupPort)7 ApiOperation (io.swagger.annotations.ApiOperation)6 ApiResponses (io.swagger.annotations.ApiResponses)6 Consumes (javax.ws.rs.Consumes)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 AuthorizationResult (org.apache.nifi.authorization.AuthorizationResult)5 DataAuthorizable (org.apache.nifi.authorization.resource.DataAuthorizable)5 FlowFileQueue (org.apache.nifi.controller.queue.FlowFileQueue)5 ProcessGroupStatus (org.apache.nifi.controller.status.ProcessGroupStatus)5 RemoteProcessGroupStatus (org.apache.nifi.controller.status.RemoteProcessGroupStatus)5 HashMap (java.util.HashMap)4