use of org.apache.nifi.controller.ScheduledState in project nifi by apache.
the class StandardProcessGroup method startProcessor.
@Override
public CompletableFuture<Void> startProcessor(final ProcessorNode processor, final boolean failIfStopping) {
readLock.lock();
try {
if (getProcessor(processor.getIdentifier()) == null) {
throw new IllegalStateException("Processor is not a member of this Process Group");
}
final ScheduledState state = processor.getScheduledState();
if (state == ScheduledState.DISABLED) {
throw new IllegalStateException("Processor is disabled");
} else if (state == ScheduledState.RUNNING) {
return CompletableFuture.completedFuture(null);
}
processor.reloadAdditionalResourcesIfNecessary();
return scheduler.startProcessor(processor, failIfStopping);
} finally {
readLock.unlock();
}
}
use of org.apache.nifi.controller.ScheduledState in project nifi by apache.
the class StandardProcessGroup method enableInputPort.
@Override
public void enableInputPort(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.STOPPED) {
return;
} else if (state == ScheduledState.RUNNING) {
throw new IllegalStateException("InputPort is currently running");
}
scheduler.enablePort(port);
} finally {
readLock.unlock();
}
}
use of org.apache.nifi.controller.ScheduledState in project nifi by apache.
the class StandardProcessGroup method enableOutputPort.
@Override
public void enableOutputPort(final Port port) {
readLock.lock();
try {
if (!outputPorts.containsKey(port.getIdentifier())) {
throw new IllegalStateException("No Output Port with ID " + port.getIdentifier() + " belongs to this Process Group");
}
final ScheduledState state = port.getScheduledState();
if (state == ScheduledState.STOPPED) {
return;
} else if (state == ScheduledState.RUNNING) {
throw new IllegalStateException("OutputPort is currently running");
}
scheduler.enablePort(port);
} finally {
readLock.unlock();
}
}
use of org.apache.nifi.controller.ScheduledState in project nifi by apache.
the class StandardProcessGroup method startOutputPort.
@Override
public void startOutputPort(final Port port) {
readLock.lock();
try {
if (getOutputPort(port.getIdentifier()) == null) {
throw new IllegalStateException("Port is not a member of this Process Group");
}
final ScheduledState state = port.getScheduledState();
if (state == ScheduledState.DISABLED) {
throw new IllegalStateException("OutputPort is disabled");
} else if (state == ScheduledState.RUNNING) {
return;
}
scheduler.startPort(port);
} finally {
readLock.unlock();
}
}
use of org.apache.nifi.controller.ScheduledState in project nifi by apache.
the class FlowFromDOMFactory method getPort.
public static PortDTO getPort(final Element element) {
final PortDTO portDTO = new PortDTO();
portDTO.setId(getString(element, "id"));
portDTO.setVersionedComponentId(getString(element, "versionedComponentId"));
portDTO.setPosition(getPosition(DomUtils.getChild(element, "position")));
portDTO.setName(getString(element, "name"));
portDTO.setComments(getString(element, "comments"));
final ScheduledState scheduledState = getScheduledState(element);
portDTO.setState(scheduledState.toString());
final List<Element> maxTasksElements = getChildrenByTagName(element, "maxConcurrentTasks");
if (!maxTasksElements.isEmpty()) {
portDTO.setConcurrentlySchedulableTaskCount(Integer.parseInt(maxTasksElements.get(0).getTextContent()));
}
final List<Element> userAccessControls = getChildrenByTagName(element, "userAccessControl");
if (userAccessControls != null && !userAccessControls.isEmpty()) {
final Set<String> users = new HashSet<>();
portDTO.setUserAccessControl(users);
for (final Element userElement : userAccessControls) {
users.add(userElement.getTextContent());
}
}
final List<Element> groupAccessControls = getChildrenByTagName(element, "groupAccessControl");
if (groupAccessControls != null && !groupAccessControls.isEmpty()) {
final Set<String> groups = new HashSet<>();
portDTO.setGroupAccessControl(groups);
for (final Element groupElement : groupAccessControls) {
groups.add(groupElement.getTextContent());
}
}
return portDTO;
}
Aggregations