private void findAllProcessors(final VersionedProcessGroup group, final Map<String, VersionedProcessor> map) { for (final VersionedProcessor processor : group.getProcessors()) { map.put(processor.getIdentifier(), processor); } for (final VersionedProcessGroup childGroup : group.getProcessGroups()) { findAllProcessors(childGroup, map); } }
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; }
final ProcessorNode processor = processorsByVersionedId.get(proposedProcessor.getIdentifier()); if (processor == null) { final ProcessorNode added = addProcessor(group, proposedProcessor, componentIdSeed); autoTerminatedRelationships.put(added, proposedAutoTerminated); LOG.info("Added {} to {}", added, this); } else if (updatedVersionedComponentIds.contains(proposedProcessor.getIdentifier())) { updateProcessor(processor, proposedProcessor); processorsRemoved.remove(proposedProcessor.getIdentifier());
@Override public ProcessorSchema apply(final VersionedProcessor versionedProcessor) { Map<String, Object> map = new HashMap<>(); map.put(NAME_KEY, versionedProcessor.getName()); map.put(ID_KEY, versionedProcessor.getIdentifier()); map.put(CLASS_KEY, versionedProcessor.getType()); map.put(SCHEDULING_STRATEGY_KEY, versionedProcessor.getSchedulingStrategy()); map.put(SCHEDULING_PERIOD_KEY, versionedProcessor.getSchedulingPeriod()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, versionedProcessor.getConcurrentlySchedulableTaskCount()); map.put(ProcessorSchema.PENALIZATION_PERIOD_KEY, versionedProcessor.getPenaltyDuration()); map.put(CommonPropertyKeys.YIELD_PERIOD_KEY, versionedProcessor.getYieldDuration()); Long runDurationMillis = versionedProcessor.getRunDurationMillis(); if (runDurationMillis != null) { map.put(ProcessorSchema.RUN_DURATION_NANOS_KEY, runDurationMillis * 1000); } final List<String> autoTerminateRelationships = new ArrayList<>(nullToEmpty(versionedProcessor.getAutoTerminatedRelationships())); map.put(ProcessorSchema.AUTO_TERMINATED_RELATIONSHIPS_LIST_KEY, autoTerminateRelationships); map.put(PROPERTIES_KEY, new HashMap<>(nullToEmpty(versionedProcessor.getProperties()))); String annotationData = versionedProcessor.getAnnotationData(); if(annotationData != null && !annotationData.isEmpty()) { map.put(ANNOTATION_DATA_KEY, annotationData); } return new ProcessorSchema(map); } }
@Override public ProcessorSchema apply(final VersionedProcessor versionedProcessor) { Map<String, Object> map = new HashMap<>(); map.put(NAME_KEY, versionedProcessor.getName()); map.put(ID_KEY, versionedProcessor.getIdentifier()); map.put(CLASS_KEY, versionedProcessor.getType()); map.put(SCHEDULING_STRATEGY_KEY, versionedProcessor.getSchedulingStrategy()); map.put(SCHEDULING_PERIOD_KEY, versionedProcessor.getSchedulingPeriod()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, versionedProcessor.getConcurrentlySchedulableTaskCount()); map.put(ProcessorSchema.PENALIZATION_PERIOD_KEY, versionedProcessor.getPenaltyDuration()); map.put(CommonPropertyKeys.YIELD_PERIOD_KEY, versionedProcessor.getYieldDuration()); Long runDurationMillis = versionedProcessor.getRunDurationMillis(); if (runDurationMillis != null) { map.put(ProcessorSchema.RUN_DURATION_NANOS_KEY, runDurationMillis * 1000); } final List<String> autoTerminateRelationships = new ArrayList<>(nullToEmpty(versionedProcessor.getAutoTerminatedRelationships())); map.put(ProcessorSchema.AUTO_TERMINATED_RELATIONSHIPS_LIST_KEY, autoTerminateRelationships); map.put(PROPERTIES_KEY, new HashMap<>(nullToEmpty(versionedProcessor.getProperties()))); String annotationData = versionedProcessor.getAnnotationData(); if(annotationData != null && !annotationData.isEmpty()) { map.put(ANNOTATION_DATA_KEY, annotationData); } return new ProcessorSchema(map); } }