port.verifyCanStop();
@Override public void verifyScheduleComponents(final String groupId, final ScheduledState state,final Set<String> componentIds) { final ProcessGroup group = locateProcessGroup(flowController, groupId); final Set<ProcessGroup> validGroups = new HashSet<>(); validGroups.add(group); validGroups.addAll(group.findAllProcessGroups()); for (final String componentId : componentIds) { final Connectable connectable = findConnectable(componentId, groupId, validGroups); if (connectable == null) { throw new ResourceNotFoundException("Unable to find component with id " + componentId); } if (connectable instanceof RemoteGroupPort) { final RemoteGroupPort remotePort = (RemoteGroupPort) connectable; if (ScheduledState.RUNNING.equals(state)) { remotePort.verifyCanStart(); } else { remotePort.verifyCanStop(); } continue; } // verify as appropriate if (ScheduledState.RUNNING.equals(state)) { group.verifyCanStart(connectable); } else { group.verifyCanStop(connectable); } } }
/** * Verified the specified remote port can be updated, if necessary. */ private void verifyUpdatePort(RemoteGroupPort port, RemoteProcessGroupPortDTO remoteProcessGroupPortDto) { // see if the remote process group can start/stop transmitting if (isNotNull(remoteProcessGroupPortDto.isTransmitting())) { if (!port.isRunning() && remoteProcessGroupPortDto.isTransmitting()) { port.verifyCanStart(); } else if (port.isRunning() && !remoteProcessGroupPortDto.isTransmitting()) { port.verifyCanStop(); } } // validate the proposed configuration final List<String> requestValidation = validateProposedRemoteProcessGroupPortConfiguration(port, remoteProcessGroupPortDto); // ensure there was no validation errors if (!requestValidation.isEmpty()) { throw new ValidationException(requestValidation); } // verify update when appropriate if (isAnyNotNull(remoteProcessGroupPortDto.getConcurrentlySchedulableTaskCount(), remoteProcessGroupPortDto.getUseCompression(), remoteProcessGroupPortDto.getBatchSettings())) { port.verifyCanUpdate(); } }