Search in sources :

Example 11 with ScheduledState

use of org.apache.nifi.controller.ScheduledState in project nifi by apache.

the class StandardProcessGroup method stopInputPort.

@Override
public void stopInputPort(final Port port) {
    readLock.lock();
    try {
        if (!inputPorts.containsKey(port.getIdentifier())) {
            throw new IllegalStateException("No Input Port with ID " + port.getIdentifier() + " belongs to this Process Group");
        }
        final ScheduledState state = port.getScheduledState();
        if (state == ScheduledState.DISABLED) {
            throw new IllegalStateException("InputPort is disabled");
        } else if (state == ScheduledState.STOPPED) {
            return;
        }
        scheduler.stopPort(port);
    } finally {
        readLock.unlock();
    }
}
Also used : ScheduledState(org.apache.nifi.controller.ScheduledState)

Example 12 with ScheduledState

use of org.apache.nifi.controller.ScheduledState in project nifi by apache.

the class StandardProcessGroup method startFunnel.

@Override
public void startFunnel(final Funnel funnel) {
    readLock.lock();
    try {
        if (getFunnel(funnel.getIdentifier()) == null) {
            throw new IllegalStateException("Funnel is not a member of this Process Group");
        }
        final ScheduledState state = funnel.getScheduledState();
        if (state == ScheduledState.RUNNING) {
            return;
        }
        scheduler.startFunnel(funnel);
    } finally {
        readLock.unlock();
    }
}
Also used : ScheduledState(org.apache.nifi.controller.ScheduledState)

Example 13 with ScheduledState

use of org.apache.nifi.controller.ScheduledState in project nifi by apache.

the class StandardProcessGroup method stopFunnel.

private void stopFunnel(final Funnel funnel) {
    readLock.lock();
    try {
        if (!funnels.containsKey(funnel.getIdentifier())) {
            throw new IllegalStateException("No Funnel with ID " + funnel.getIdentifier() + " belongs to this Process Group");
        }
        final ScheduledState state = funnel.getScheduledState();
        if (state == ScheduledState.DISABLED) {
            throw new IllegalStateException("Funnel is disabled");
        } else if (state == ScheduledState.STOPPED) {
            return;
        }
        scheduler.stopFunnel(funnel);
    } finally {
        readLock.unlock();
    }
}
Also used : ScheduledState(org.apache.nifi.controller.ScheduledState)

Example 14 with ScheduledState

use of org.apache.nifi.controller.ScheduledState in project nifi by apache.

the class StandardProcessGroup method disableOutputPort.

@Override
public void disableOutputPort(final Port port) {
    readLock.lock();
    try {
        if (!outputPorts.containsKey(port.getIdentifier())) {
            throw new IllegalStateException("No OutputPort with ID " + port.getIdentifier() + " belongs to this Process Group");
        }
        final ScheduledState state = port.getScheduledState();
        if (state == ScheduledState.DISABLED) {
            return;
        } else if (state == ScheduledState.RUNNING) {
            throw new IllegalStateException("OutputPort is currently running");
        }
        scheduler.disablePort(port);
    } finally {
        readLock.unlock();
    }
}
Also used : ScheduledState(org.apache.nifi.controller.ScheduledState)

Example 15 with ScheduledState

use of org.apache.nifi.controller.ScheduledState in project nifi by apache.

the class StandardProcessGroup method enableProcessor.

@Override
public void enableProcessor(final ProcessorNode processor) {
    readLock.lock();
    try {
        if (!processors.containsKey(processor.getIdentifier())) {
            throw new IllegalStateException("No Processor with ID " + processor.getIdentifier() + " belongs to this Process Group");
        }
        final ScheduledState state = processor.getScheduledState();
        if (state == ScheduledState.STOPPED) {
            return;
        } else if (state == ScheduledState.RUNNING) {
            throw new IllegalStateException("Processor is currently running");
        }
        scheduler.enableProcessor(processor);
    } finally {
        readLock.unlock();
    }
}
Also used : ScheduledState(org.apache.nifi.controller.ScheduledState)

Aggregations

ScheduledState (org.apache.nifi.controller.ScheduledState)35 NiFiUser (org.apache.nifi.authorization.user.NiFiUser)9 Map (java.util.Map)7 Set (java.util.Set)7 Collectors (java.util.stream.Collectors)7 ControllerServiceState (org.apache.nifi.controller.service.ControllerServiceState)7 Date (java.util.Date)6 HttpMethod (javax.ws.rs.HttpMethod)6 MediaType (javax.ws.rs.core.MediaType)6 ValidationException (org.apache.nifi.controller.exception.ValidationException)6 List (java.util.List)5 HashSet (java.util.HashSet)4 NiFiServiceFacade (org.apache.nifi.web.NiFiServiceFacade)4 Revision (org.apache.nifi.web.Revision)4 BundleDTO (org.apache.nifi.web.api.dto.BundleDTO)4 ProcessorConfigDTO (org.apache.nifi.web.api.dto.ProcessorConfigDTO)4 ControllerServiceEntity (org.apache.nifi.web.api.entity.ControllerServiceEntity)4 Api (io.swagger.annotations.Api)3 ApiOperation (io.swagger.annotations.ApiOperation)3 ApiParam (io.swagger.annotations.ApiParam)3