private void verifyProcessorsInVersionedFlow(final VersionedProcessGroup versionedFlow, final Map<String, Set<BundleCoordinate>> supportedTypes) { if (versionedFlow.getProcessors() != null) { versionedFlow.getProcessors().forEach(processor -> { if (processor.getBundle() == null) { throw new IllegalArgumentException("Processor bundle must be specified."); } if (supportedTypes.containsKey(processor.getType())) { verifyBundleInVersionedFlow(processor.getBundle(), supportedTypes.get(processor.getType())); } else { throw new IllegalStateException("Invalid Processor Type: " + processor.getType()); } }); } if (versionedFlow.getProcessGroups() != null) { versionedFlow.getProcessGroups().forEach(processGroup -> { verifyProcessorsInVersionedFlow(processGroup, supportedTypes); }); } }
private static void populateComponentTypes(final VersionedProcessGroup group, final Set<Tuple<String, BundleCoordinate>> componentTypes) { group.getProcessors().stream() .map(versionedProc -> new Tuple<>(versionedProc.getType(), createBundleCoordinate(versionedProc.getBundle()))) .forEach(componentTypes::add); group.getControllerServices().stream() .map(versionedSvc -> new Tuple<>(versionedSvc.getType(), createBundleCoordinate(versionedSvc.getBundle()))) .forEach(componentTypes::add); for (final VersionedProcessGroup childGroup : group.getProcessGroups()) { populateComponentTypes(childGroup, componentTypes); } }
final BundleCoordinate processorToAddCoordinate = toCoordinate(processorToAdd.getBundle());
private ProcessorNode addProcessor(final ProcessGroup destination, final VersionedProcessor proposed, final String componentIdSeed) throws ProcessorInstantiationException { final BundleCoordinate coordinate = toCoordinate(proposed.getBundle()); final ProcessorNode procNode = flowManager.createProcessor(proposed.getType(), generateUuid(proposed.getIdentifier(), destination.getIdentifier(), componentIdSeed), coordinate, true); procNode.setVersionedComponentId(proposed.getIdentifier()); destination.addProcessor(procNode); updateProcessor(procNode, proposed); return procNode; }
if (versionedGroup.getProcessors() != null) { versionedGroup.getProcessors().forEach(processor -> { final BundleCoordinate coordinate = BundleUtils.getCompatibleBundle(extensionManager, processor.getType(), createBundleDto(processor.getBundle()));
private void updateProcessor(final ProcessorNode processor, final VersionedProcessor proposed) throws ProcessorInstantiationException { processor.pauseValidationTrigger(); try { processor.setAnnotationData(proposed.getAnnotationData()); processor.setBulletinLevel(LogLevel.valueOf(proposed.getBulletinLevel())); processor.setComments(proposed.getComments()); processor.setName(proposed.getName()); processor.setPenalizationPeriod(proposed.getPenaltyDuration()); final Map<String, String> properties = populatePropertiesMap(processor.getProperties(), proposed.getProperties(), proposed.getPropertyDescriptors(), processor.getProcessGroup()); processor.setProperties(properties, true); processor.setRunDuration(proposed.getRunDurationMillis(), TimeUnit.MILLISECONDS); processor.setSchedulingStrategy(SchedulingStrategy.valueOf(proposed.getSchedulingStrategy())); processor.setScheduldingPeriod(proposed.getSchedulingPeriod()); processor.setMaxConcurrentTasks(proposed.getConcurrentlySchedulableTaskCount()); processor.setExecutionNode(ExecutionNode.valueOf(proposed.getExecutionNode())); processor.setStyle(proposed.getStyle()); processor.setYieldPeriod(proposed.getYieldDuration()); processor.setPosition(new Position(proposed.getPosition().getX(), proposed.getPosition().getY())); if (!isEqual(processor.getBundleCoordinate(), proposed.getBundle())) { final BundleCoordinate newBundleCoordinate = toCoordinate(proposed.getBundle()); final List<PropertyDescriptor> descriptors = new ArrayList<>(processor.getProperties().keySet()); final Set<URL> additionalUrls = processor.getAdditionalClasspathResources(descriptors); flowController.getReloadComponent().reload(processor, proposed.getType(), newBundleCoordinate, additionalUrls); } } finally { processor.resumeValidationTrigger(); } }