org.apache.nifi.controller.ScheduledState Java Examples
The following examples show how to use
org.apache.nifi.controller.ScheduledState.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StandardProcessGroup.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void stopOutputPort(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.DISABLED) { throw new IllegalStateException("OutputPort is disabled"); } else if (state == ScheduledState.STOPPED) { return; } scheduler.stopPort(port); } finally { readLock.unlock(); } }
Example #2
Source File: ProcessGroupAuditor.java From nifi with Apache License 2.0 | 6 votes |
/** * Audits the update of process group configuration. * * @param proceedingJoinPoint join point * @param groupId group id * @param state scheduled state * @throws Throwable ex */ @Around("within(org.apache.nifi.web.dao.ProcessGroupDAO+) && " + "execution(void enableComponents(String, org.apache.nifi.controller.ScheduledState, java.util.Set<String>)) && " + "args(groupId, state, componentIds)") public void enableComponentsAdvice(ProceedingJoinPoint proceedingJoinPoint, String groupId, ScheduledState state, Set<String> componentIds) throws Throwable { final Operation operation; proceedingJoinPoint.proceed(); // determine the running state if (ScheduledState.DISABLED.equals(state)) { operation = Operation.Disable; } else { operation = Operation.Enable; } saveUpdateAction(groupId, operation); }
Example #3
Source File: LocalComponentLifecycle.java From nifi with Apache License 2.0 | 6 votes |
/** * Waits for all of the given Processors to reach the given Scheduled State. * * @return <code>true</code> if all processors have reached the desired state, false if the given {@link Pause} indicates * to give up before all of the processors have reached the desired state */ private boolean waitForProcessorState(final String groupId, final Map<String, AffectedComponentEntity> affectedComponents, final ScheduledState desiredState, final Pause pause, final InvalidComponentAction invalidComponentAction) throws LifecycleManagementException { logger.debug("Waiting for {} processors to transition their states to {}", affectedComponents.size(), desiredState); boolean continuePolling = true; while (continuePolling) { final Set<ProcessorEntity> processorEntities = serviceFacade.getProcessors(groupId, true); if (isProcessorActionComplete(processorEntities, affectedComponents, desiredState, invalidComponentAction)) { logger.debug("All {} processors of interest now have the desired state of {}", affectedComponents.size(), desiredState); return true; } // Not all of the processors are in the desired state. Pause for a bit and poll again. continuePolling = pause.pause(); } return false; }
Example #4
Source File: LocalComponentLifecycle.java From nifi with Apache License 2.0 | 6 votes |
private void startComponents(final String processGroupId, final Map<String, Revision> componentRevisions, final Map<String, AffectedComponentEntity> affectedComponents, final Pause pause, final InvalidComponentAction invalidComponentAction) throws LifecycleManagementException { if (componentRevisions.isEmpty()) { return; } logger.debug("Starting components with ID's {} from Process Group {}", componentRevisions.keySet(), processGroupId); // Wait for all affected processors to be either VALID or INVALID waitForProcessorValidation(processGroupId, affectedComponents, pause); serviceFacade.verifyScheduleComponents(processGroupId, ScheduledState.RUNNING, componentRevisions.keySet()); serviceFacade.scheduleComponents(processGroupId, ScheduledState.RUNNING, componentRevisions); // wait for all of the Processors to reach the desired state. We don't have to wait for other components because // Local and Remote Ports as well as funnels start immediately. waitForProcessorState(processGroupId, affectedComponents, ScheduledState.RUNNING, pause, invalidComponentAction); }
Example #5
Source File: ProcessorLifecycleIT.java From nifi with Apache License 2.0 | 6 votes |
/** * Validates that the Processor can be stopped when @OnScheduled blocks * indefinitely and written to ignore thread interrupts */ @Test public void validateProcessorCanBeStoppedWhenOnScheduledBlocksIndefinitelyUninterruptable() throws Exception { final FlowManagerAndSystemBundle fcsb = this.buildFlowControllerForTest(NiFiProperties.PROCESSOR_SCHEDULING_TIMEOUT, "1 sec"); flowManager = fcsb.getFlowManager(); ProcessGroup testGroup = flowManager.createProcessGroup(UUID.randomUUID().toString()); ProcessorNode testProcNode = flowManager.createProcessor(TestProcessor.class.getName(), UUID.randomUUID().toString(), fcsb.getSystemBundle().getBundleDetails().getCoordinate()); testProcNode.setProperties(properties); TestProcessor testProcessor = (TestProcessor) testProcNode.getProcessor(); // sets the scenario for the processor to run this.blockingUninterruptableOnUnschedule(testProcessor); testProcNode.performValidation(); processScheduler.startProcessor(testProcNode, true); assertCondition(() -> ScheduledState.RUNNING == testProcNode.getScheduledState(), MEDIUM_DELAY_TOLERANCE); processScheduler.stopProcessor(testProcNode); assertCondition(() -> ScheduledState.STOPPED == testProcNode.getScheduledState(), MEDIUM_DELAY_TOLERANCE); }
Example #6
Source File: ProcessorLifecycleIT.java From nifi with Apache License 2.0 | 6 votes |
/** * Validates that stop calls are harmless and idempotent if processor is not * in STARTING or RUNNING state. */ @Test public void validateStopCallsAreMeaninglessIfProcessorNotStarted() throws Exception { final FlowManagerAndSystemBundle fcsb = this.buildFlowControllerForTest(); flowManager = fcsb.getFlowManager(); ProcessGroup testGroup = flowManager.createProcessGroup(UUID.randomUUID().toString()); final ProcessorNode testProcNode = flowManager.createProcessor(TestProcessor.class.getName(), UUID.randomUUID().toString(), fcsb.getSystemBundle().getBundleDetails().getCoordinate()); testProcNode.setProperties(properties); TestProcessor testProcessor = (TestProcessor) testProcNode.getProcessor(); assertCondition(() -> ScheduledState.STOPPED == testProcNode.getScheduledState()); // sets the scenario for the processor to run int randomDelayLimit = 3000; this.randomOnTriggerDelay(testProcessor, randomDelayLimit); processScheduler.stopProcessor(testProcNode); assertCondition(() -> ScheduledState.STOPPED == testProcNode.getScheduledState()); assertTrue(testProcessor.operationNames.isEmpty()); }
Example #7
Source File: ParameterContextResource.java From nifi with Apache License 2.0 | 6 votes |
private void restartProcessors(final Set<AffectedComponentEntity> processors, final AsynchronousWebRequest<?, ?> asyncRequest, final ComponentLifecycle componentLifecycle, final URI uri) throws ResumeFlowException, LifecycleManagementException { if (logger.isDebugEnabled()) { logger.debug("Restarting {} Processors after having updated Parameter Context: {}", processors.size(), processors); } else { logger.info("Restarting {} Processors after having updated Parameter Context", processors.size()); } // Step 14. Restart all components final Set<AffectedComponentEntity> componentsToStart = getUpdatedEntities(processors); final CancellableTimedPause startComponentsPause = new CancellableTimedPause(250, Long.MAX_VALUE, TimeUnit.MILLISECONDS); asyncRequest.setCancelCallback(startComponentsPause::cancel); try { componentLifecycle.scheduleComponents(uri, "root", componentsToStart, ScheduledState.RUNNING, startComponentsPause, InvalidComponentAction.SKIP); asyncRequest.markStepComplete(); } catch (final IllegalStateException ise) { // Component Lifecycle will restart the Processors only if they are valid. If IllegalStateException gets thrown, we need to provide // a more intelligent error message as to exactly what happened, rather than indicate that the flow could not be updated. throw new ResumeFlowException("Failed to restart components because " + ise.getMessage(), ise); } }
Example #8
Source File: StandardControllerServiceDAO.java From nifi with Apache License 2.0 | 6 votes |
@Override public void verifyUpdateReferencingComponents(final String controllerServiceId, final ScheduledState scheduledState, final ControllerServiceState controllerServiceState) { final ControllerServiceNode controllerService = locateControllerService(controllerServiceId); if (controllerServiceState != null) { if (ControllerServiceState.ENABLED.equals(controllerServiceState)) { serviceProvider.verifyCanEnableReferencingServices(controllerService); } else { serviceProvider.verifyCanDisableReferencingServices(controllerService); } } else if (scheduledState != null) { if (ScheduledState.RUNNING.equals(scheduledState)) { serviceProvider.verifyCanScheduleReferencingComponents(controllerService); } else { serviceProvider.verifyCanStopReferencingComponents(controllerService); } } }
Example #9
Source File: StandardControllerServiceDAO.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void verifyUpdateReferencingComponents(final String controllerServiceId, final ScheduledState scheduledState, final ControllerServiceState controllerServiceState) { final ControllerServiceNode controllerService = locateControllerService(controllerServiceId); if (controllerServiceState != null) { if (ControllerServiceState.ENABLED.equals(controllerServiceState)) { serviceProvider.verifyCanEnableReferencingServices(controllerService); } else { serviceProvider.verifyCanDisableReferencingServices(controllerService); } } else if (scheduledState != null) { if (ScheduledState.RUNNING.equals(scheduledState)) { serviceProvider.verifyCanScheduleReferencingComponents(controllerService); } else { serviceProvider.verifyCanStopReferencingComponents(controllerService); } } }
Example #10
Source File: StandardControllerServiceDAO.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public Set<ConfiguredComponent> updateControllerServiceReferencingComponents( final String controllerServiceId, final ScheduledState scheduledState, final ControllerServiceState controllerServiceState) { // get the controller service final ControllerServiceNode controllerService = locateControllerService(controllerServiceId); // this request is either acting upon referencing services or schedulable components if (controllerServiceState != null) { if (ControllerServiceState.ENABLED.equals(controllerServiceState)) { return serviceProvider.enableReferencingServices(controllerService); } else { return serviceProvider.disableReferencingServices(controllerService); } } else if (scheduledState != null) { if (ScheduledState.RUNNING.equals(scheduledState)) { return serviceProvider.scheduleReferencingComponents(controllerService); } else { return serviceProvider.unscheduleReferencingComponents(controllerService); } } return Collections.emptySet(); }
Example #11
Source File: StandardOutputPortDAO.java From nifi with Apache License 2.0 | 6 votes |
@Override protected void handleStateTransition(final Port port, final ScheduledState proposedScheduledState) throws IllegalStateException { final ProcessGroup processGroup = port.getProcessGroup(); switch (proposedScheduledState) { case RUNNING: processGroup.startOutputPort(port); break; case STOPPED: switch (port.getScheduledState()) { case RUNNING: processGroup.stopOutputPort(port); break; case DISABLED: processGroup.enableOutputPort(port); break; } break; case DISABLED: processGroup.disableOutputPort(port); break; } }
Example #12
Source File: StandardProcessGroup.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void disableProcessor(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.DISABLED) { return; } else if (state == ScheduledState.RUNNING) { throw new IllegalStateException("Processor is currently running"); } scheduler.disableProcessor(processor); } finally { readLock.unlock(); } }
Example #13
Source File: StandardControllerServiceDAO.java From nifi with Apache License 2.0 | 6 votes |
@Override public Set<ComponentNode> updateControllerServiceReferencingComponents( final String controllerServiceId, final ScheduledState scheduledState, final ControllerServiceState controllerServiceState) { // get the controller service final ControllerServiceNode controllerService = locateControllerService(controllerServiceId); // this request is either acting upon referencing services or schedulable components if (controllerServiceState != null) { if (ControllerServiceState.ENABLED.equals(controllerServiceState)) { return serviceProvider.enableReferencingServices(controllerService); } else { return serviceProvider.disableReferencingServices(controllerService); } } else if (scheduledState != null) { if (ScheduledState.RUNNING.equals(scheduledState)) { return serviceProvider.scheduleReferencingComponents(controllerService); } else { return serviceProvider.unscheduleReferencingComponents(controllerService); } } return Collections.emptySet(); }
Example #14
Source File: StandardProcessGroupDAO.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void verifyScheduleComponents(final String groupId, final ScheduledState state,final Set<String> componentIds) { final ProcessGroup group = locateProcessGroup(flowController, groupId); final Set<Connectable> connectables = new HashSet<>(componentIds.size()); for (final String componentId : componentIds) { final Connectable connectable = group.findLocalConnectable(componentId); if (connectable == null) { throw new ResourceNotFoundException("Unable to find component with id " + componentId); } connectables.add(connectable); } // verify as appropriate connectables.forEach(connectable -> { if (ScheduledState.RUNNING.equals(state)) { group.verifyCanStart(connectable); } else { group.verifyCanStop(connectable); } }); }
Example #15
Source File: ScheduledStateMatcher.java From nifi with Apache License 2.0 | 6 votes |
@Override public void match(final ProcessorNode component, final SearchQuery query, final List<String> matches) { final String searchTerm = query.getTerm(); if (ScheduledState.DISABLED.equals(component.getScheduledState())) { if (StringUtils.containsIgnoreCase(SEARCH_TERM_DISABLED, searchTerm)) { matches.add(MATCH_PREFIX + MATCH_DISABLED); } } else if (StringUtils.containsIgnoreCase(SEARCH_TERM_INVALID, searchTerm) && component.getValidationStatus() == ValidationStatus.INVALID) { matches.add(MATCH_PREFIX + MATCH_INVALID); } else if (StringUtils.containsIgnoreCase(SEARCH_TERM_VALIDATING, searchTerm) && component.getValidationStatus() == ValidationStatus.VALIDATING) { matches.add(MATCH_PREFIX + MATCH_VALIDATING); } else if (ScheduledState.RUNNING.equals(component.getScheduledState()) && StringUtils.containsIgnoreCase(SEARCH_TERM_RUNNING, searchTerm)) { matches.add(MATCH_PREFIX + MATCH_RUNNING); } else if (ScheduledState.STOPPED.equals(component.getScheduledState()) && StringUtils.containsIgnoreCase(SEARCH_TERM_STOPPED, searchTerm)) { matches.add(MATCH_PREFIX + MATCH_STOPPED); } }
Example #16
Source File: ProcessorLifecycleIT.java From nifi with Apache License 2.0 | 6 votes |
/** * Validates that the Processor can be stopped when @OnScheduled blocks * indefinitely but written to react to thread interrupts */ @Test public void validateProcessorCanBeStoppedWhenOnScheduledBlocksIndefinitelyInterruptable() throws Exception { final FlowManagerAndSystemBundle fcsb = this.buildFlowControllerForTest(NiFiProperties.PROCESSOR_SCHEDULING_TIMEOUT, "5 sec"); flowManager = fcsb.getFlowManager(); ProcessGroup testGroup = flowManager.createProcessGroup(UUID.randomUUID().toString()); ProcessorNode testProcNode = flowManager.createProcessor(TestProcessor.class.getName(), UUID.randomUUID().toString(), fcsb.getSystemBundle().getBundleDetails().getCoordinate()); testProcNode.setProperties(properties); TestProcessor testProcessor = (TestProcessor) testProcNode.getProcessor(); // sets the scenario for the processor to run this.blockingInterruptableOnUnschedule(testProcessor); testProcNode.performValidation(); processScheduler.startProcessor(testProcNode, true); assertCondition(() -> ScheduledState.RUNNING == testProcNode.getScheduledState(), SHORT_DELAY_TOLERANCE); processScheduler.stopProcessor(testProcNode); assertCondition(() -> ScheduledState.STOPPED == testProcNode.getScheduledState(), MEDIUM_DELAY_TOLERANCE); }
Example #17
Source File: StandardProcessGroup.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void startInputPort(final Port port) { readLock.lock(); try { if (getInputPort(port.getIdentifier()) == null) { throw new IllegalStateException("Port " + port.getIdentifier() + " is not a member of this Process Group"); } final ScheduledState state = port.getScheduledState(); if (state == ScheduledState.DISABLED) { throw new IllegalStateException("InputPort " + port.getIdentifier() + " is disabled"); } else if (state == ScheduledState.RUNNING) { return; } scheduler.startPort(port); } finally { readLock.unlock(); } }
Example #18
Source File: StandardProcessGroup.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void startProcessor(final ProcessorNode processor) { 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; } scheduler.startProcessor(processor); } finally { readLock.unlock(); } }
Example #19
Source File: ControllerSearchServiceIntegrationTest.java From nifi with Apache License 2.0 | 6 votes |
@Test public void testSearchBasedOnProperty() { // given final Map<PropertyDescriptor, String> rawProperties = new HashMap<>(); final PropertyDescriptor descriptor1 = new PropertyDescriptor.Builder().name("property1").displayName("property1display").description("property1 description").sensitive(false).build(); final PropertyDescriptor descriptor2 = new PropertyDescriptor.Builder().name("property2").displayName("property2display").description("property2 description").sensitive(true).build(); rawProperties.put(descriptor1, "property1value"); rawProperties.put(descriptor2, "property2value"); final ProcessorNode processorNode = getProcessorNode("processor1", "name1", "", Optional.empty(), SchedulingStrategy.TIMER_DRIVEN, ExecutionNode.ALL, ScheduledState.RUNNING, ValidationStatus.VALID, new HashSet<>(), "Processor", Mockito.mock(Processor.class), rawProperties, AUTHORIZED); givenRootProcessGroup() .withProcessor(processorNode); // when whenExecuteSearch("property"); // then thenResultConsists() .ofProcessor(getSimpleResultFromRoot("processor1", "name1", "Property name: property1", "Property value: property1 - property1value", "Property description: property1 description", "Property name: property2", "Property description: property2 description")) .validate(results); }
Example #20
Source File: StandardProcessGroup.java From localization_nifi with Apache License 2.0 | 6 votes |
@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(); } }
Example #21
Source File: StandardRemoteProcessGroup.java From nifi with Apache License 2.0 | 6 votes |
/** * Converts a set of ports into a set of remote process group ports. * * @param ports to convert * @return descriptors of ports */ private Set<RemoteProcessGroupPortDescriptor> convertRemotePort(final Set<PortDTO> ports) { Set<RemoteProcessGroupPortDescriptor> remotePorts = null; if (ports != null) { remotePorts = new LinkedHashSet<>(ports.size()); for (final PortDTO port : ports) { final StandardRemoteProcessGroupPortDescriptor descriptor = new StandardRemoteProcessGroupPortDescriptor(); final ScheduledState scheduledState = ScheduledState.valueOf(port.getState()); descriptor.setId(generatePortId(port.getId())); descriptor.setTargetId(port.getId()); descriptor.setName(port.getName()); descriptor.setComments(port.getComments()); descriptor.setTargetRunning(ScheduledState.RUNNING.equals(scheduledState)); remotePorts.add(descriptor); } } return remotePorts; }
Example #22
Source File: LocalComponentLifecycle.java From nifi with Apache License 2.0 | 6 votes |
private void stopComponents(final String processGroupId, final Map<String, Revision> componentRevisions, final Map<String, AffectedComponentEntity> affectedComponents, final Pause pause, final InvalidComponentAction invalidComponentAction) throws LifecycleManagementException { if (componentRevisions.isEmpty()) { return; } logger.debug("Stopping components with ID's {} from Process Group {}", componentRevisions.keySet(), processGroupId); serviceFacade.verifyScheduleComponents(processGroupId, ScheduledState.STOPPED, componentRevisions.keySet()); serviceFacade.scheduleComponents(processGroupId, ScheduledState.STOPPED, componentRevisions); // wait for all of the Processors to reach the desired state. We don't have to wait for other components because // Local and Remote Ports as well as funnels stop immediately. waitForProcessorState(processGroupId, affectedComponents, ScheduledState.STOPPED, pause, invalidComponentAction); }
Example #23
Source File: StandardRemoteProcessGroup.java From localization_nifi with Apache License 2.0 | 6 votes |
/** * Converts a set of ports into a set of remote process group ports. * * @param ports to convert * @return descriptors of ports */ private Set<RemoteProcessGroupPortDescriptor> convertRemotePort(final Set<PortDTO> ports) { Set<RemoteProcessGroupPortDescriptor> remotePorts = null; if (ports != null) { remotePorts = new LinkedHashSet<>(ports.size()); for (final PortDTO port : ports) { final StandardRemoteProcessGroupPortDescriptor descriptor = new StandardRemoteProcessGroupPortDescriptor(); final ScheduledState scheduledState = ScheduledState.valueOf(port.getState()); descriptor.setId(port.getId()); descriptor.setName(port.getName()); descriptor.setComments(port.getComments()); descriptor.setTargetRunning(ScheduledState.RUNNING.equals(scheduledState)); remotePorts.add(descriptor); } } return remotePorts; }
Example #24
Source File: ProcessorLifecycleIT.java From nifi with Apache License 2.0 | 6 votes |
@Test public void validateDisableOperation() throws Exception { final FlowManagerAndSystemBundle fcsb = this.buildFlowControllerForTest(); flowManager = fcsb.getFlowManager(); ProcessGroup testGroup = flowManager.createProcessGroup(UUID.randomUUID().toString()); final ProcessorNode testProcNode = flowManager.createProcessor(TestProcessor.class.getName(), UUID.randomUUID().toString(), fcsb.getSystemBundle().getBundleDetails().getCoordinate()); testProcNode.setProperties(properties); assertCondition(() -> ScheduledState.STOPPED == testProcNode.getScheduledState()); assertCondition(() -> ScheduledState.STOPPED == testProcNode.getPhysicalScheduledState()); // validates idempotency for (int i = 0; i < 2; i++) { testProcNode.disable(); } assertCondition(() -> ScheduledState.DISABLED == testProcNode.getScheduledState()); assertCondition(() -> ScheduledState.DISABLED == testProcNode.getPhysicalScheduledState()); testProcNode.performValidation(); processScheduler.startProcessor(testProcNode, true); assertCondition(() -> ScheduledState.DISABLED == testProcNode.getPhysicalScheduledState()); }
Example #25
Source File: StandardProcessGroupDAO.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public void scheduleComponents(final String groupId, final ScheduledState state, final Set<String> componentIds) { final ProcessGroup group = locateProcessGroup(flowController, groupId); for (final String componentId : componentIds) { final Connectable connectable = group.findLocalConnectable(componentId); if (ScheduledState.RUNNING.equals(state)) { if (ConnectableType.PROCESSOR.equals(connectable.getConnectableType())) { connectable.getProcessGroup().startProcessor((ProcessorNode) connectable); } else if (ConnectableType.INPUT_PORT.equals(connectable.getConnectableType())) { connectable.getProcessGroup().startInputPort((Port) connectable); } else if (ConnectableType.OUTPUT_PORT.equals(connectable.getConnectableType())) { connectable.getProcessGroup().startOutputPort((Port) connectable); } } else { if (ConnectableType.PROCESSOR.equals(connectable.getConnectableType())) { connectable.getProcessGroup().stopProcessor((ProcessorNode) connectable); } else if (ConnectableType.INPUT_PORT.equals(connectable.getConnectableType())) { connectable.getProcessGroup().stopInputPort((Port) connectable); } else if (ConnectableType.OUTPUT_PORT.equals(connectable.getConnectableType())) { connectable.getProcessGroup().stopOutputPort((Port) connectable); } } } }
Example #26
Source File: StandardProcessGroup.java From localization_nifi with Apache License 2.0 | 6 votes |
@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(); } }
Example #27
Source File: StandardProcessScheduler.java From localization_nifi with Apache License 2.0 | 5 votes |
public synchronized void disableReportingTask(final ReportingTaskNode taskNode) { if (taskNode.getScheduledState() != ScheduledState.STOPPED) { throw new IllegalStateException("Reporting Task cannot be disabled because its state is set to " + taskNode.getScheduledState() + " but transition to DISABLED state is allowed only from the STOPPED state"); } taskNode.setScheduledState(ScheduledState.DISABLED); }
Example #28
Source File: StandardProcessScheduler.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public synchronized void disablePort(final Port port) { if (port.getScheduledState() != ScheduledState.STOPPED) { throw new IllegalStateException("Port cannot be disabled because its state is set to " + port.getScheduledState()); } if (!(port instanceof AbstractPort)) { throw new IllegalArgumentException(); } ((AbstractPort) port).disable(); }
Example #29
Source File: ScheduledStateMatcherTest.java From nifi with Apache License 2.0 | 5 votes |
@Test public void testWhenLookingForValidatingButTheStatusIsDisabled() { // given final ScheduledStateMatcher testSubject = new ScheduledStateMatcher(); givenScheduledState(ScheduledState.DISABLED); givenValidationStatus(ValidationStatus.VALIDATING); givenSearchTerm("validating"); // when testSubject.match(component, searchQuery, matches); // then thenNoMatches(); }
Example #30
Source File: StandardProcessScheduler.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public synchronized void disableFunnel(final Funnel funnel) { if (funnel.getScheduledState() != ScheduledState.STOPPED) { throw new IllegalStateException("Funnel cannot be disabled because its state its state is set to " + funnel.getScheduledState()); } funnel.setScheduledState(ScheduledState.DISABLED); }