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(); } }
@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); } }