Java Code Examples for org.apache.nifi.components.PropertyDescriptor#getDefaultValue()
The following examples show how to use
org.apache.nifi.components.PropertyDescriptor#getDefaultValue() .
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: StandardValidationContext.java From nifi with Apache License 2.0 | 6 votes |
@Override public Map<PropertyDescriptor, String> getProperties() { final Map<PropertyDescriptor, String> effectiveValues = effectiveValuesRef.get(); if (effectiveValues != null) { return effectiveValues; } final Map<PropertyDescriptor, String> valueMap = new LinkedHashMap<>(); for (final Map.Entry<PropertyDescriptor, PropertyConfiguration> entry : this.properties.entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); final PropertyConfiguration configuration = entry.getValue(); final String value = configuration == null ? descriptor.getDefaultValue() : configuration.getEffectiveValue(parameterContext); valueMap.put(entry.getKey(), value); } final Map<PropertyDescriptor, String> immutableValueMap = Collections.unmodifiableMap(valueMap); effectiveValuesRef.compareAndSet(null, immutableValueMap); return immutableValueMap; }
Example 2
Source File: StandardProcessContext.java From localization_nifi with Apache License 2.0 | 6 votes |
public StandardProcessContext(final ProcessorNode processorNode, final ControllerServiceProvider controllerServiceProvider, final StringEncryptor encryptor, final StateManager stateManager, final VariableRegistry variableRegistry) { this.procNode = processorNode; this.controllerServiceProvider = controllerServiceProvider; this.encryptor = encryptor; this.stateManager = stateManager; this.variableRegistry = variableRegistry; preparedQueries = new HashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : procNode.getProperties().entrySet()) { final PropertyDescriptor desc = entry.getKey(); String value = entry.getValue(); if (value == null) { value = desc.getDefaultValue(); } if (value != null) { final PreparedQuery pq = Query.prepare(value); preparedQueries.put(desc, pq); } } }
Example 3
Source File: StandardReportingContext.java From nifi with Apache License 2.0 | 6 votes |
public StandardReportingContext(final FlowController flowController, final BulletinRepository bulletinRepository, final Map<PropertyDescriptor, String> properties, final ReportingTask reportingTask, final VariableRegistry variableRegistry, final ParameterLookup parameterLookup) { this.flowController = flowController; this.eventAccess = flowController.getEventAccess(); this.bulletinRepository = bulletinRepository; this.properties = Collections.unmodifiableMap(properties); this.serviceProvider = flowController.getControllerServiceProvider(); this.reportingTask = reportingTask; this.variableRegistry = variableRegistry; this.parameterLookup = parameterLookup; this.analyticsEnabled = flowController.getStatusAnalyticsEngine() != null; preparedQueries = new HashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : properties.entrySet()) { final PropertyDescriptor desc = entry.getKey(); String value = entry.getValue(); if (value == null) { value = desc.getDefaultValue(); } final PreparedQuery pq = Query.prepare(value); preparedQueries.put(desc, pq); } }
Example 4
Source File: StatelessControllerServiceConfiguration.java From nifi with Apache License 2.0 | 5 votes |
public String getProperty(final PropertyDescriptor descriptor) { final PropertyConfiguration value = properties.get(descriptor); if (value == null) { return descriptor.getDefaultValue(); } else { return value.getRawValue(); } }
Example 5
Source File: StandardFlowSerializer.java From nifi with Apache License 2.0 | 5 votes |
private static void addConfiguration(final Element element, final Map<PropertyDescriptor, String> properties, final String annotationData, final StringEncryptor encryptor) { final Document doc = element.getOwnerDocument(); for (final Map.Entry<PropertyDescriptor, String> entry : properties.entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); String value = entry.getValue(); if (value == null) { value = descriptor.getDefaultValue(); } if (value != null && descriptor.isSensitive()) { value = ENC_PREFIX + encryptor.encrypt(value) + ENC_SUFFIX; } final Element propElement = doc.createElement("property"); addTextElement(propElement, "name", descriptor.getName()); if (value != null) { addTextElement(propElement, "value", value); } element.appendChild(propElement); } if (annotationData != null) { addTextElement(element, "annotationData", annotationData); } }
Example 6
Source File: StandardValidationContext.java From localization_nifi with Apache License 2.0 | 5 votes |
public StandardValidationContext( final ControllerServiceProvider controllerServiceProvider, final Set<String> serviceIdentifiersToNotValidate, final Map<PropertyDescriptor, String> properties, final String annotationData, final String groupId, final String componentId, VariableRegistry variableRegistry) { this.controllerServiceProvider = controllerServiceProvider; this.properties = new HashMap<>(properties); this.annotationData = annotationData; this.serviceIdentifiersToNotValidate = serviceIdentifiersToNotValidate; this.variableRegistry = variableRegistry; this.groupId = groupId; this.componentId = componentId; preparedQueries = new HashMap<>(properties.size()); for (final Map.Entry<PropertyDescriptor, String> entry : properties.entrySet()) { final PropertyDescriptor desc = entry.getKey(); String value = entry.getValue(); if (value == null) { value = desc.getDefaultValue(); } final PreparedQuery pq = Query.prepare(value); preparedQueries.put(desc, pq); } expressionLanguageSupported = new HashMap<>(properties.size()); for (final PropertyDescriptor descriptor : properties.keySet()) { expressionLanguageSupported.put(descriptor.getName(), descriptor.isExpressionLanguageSupported()); } }
Example 7
Source File: ControllerServiceAuditor.java From nifi with Apache License 2.0 | 5 votes |
/** * Extracts the values for the configured properties from the specified ControllerService. * * @param controllerService service * @param controllerServiceDTO dto * @return properties */ private Map<String, String> extractConfiguredPropertyValues(ControllerServiceNode controllerService, ControllerServiceDTO controllerServiceDTO) { Map<String, String> values = new HashMap<>(); if (controllerServiceDTO.getName() != null) { values.put(NAME, controllerService.getName()); } if (controllerServiceDTO.getAnnotationData() != null) { values.put(ANNOTATION_DATA, controllerService.getAnnotationData()); } if (controllerServiceDTO.getBundle() != null) { final BundleCoordinate bundle = controllerService.getBundleCoordinate(); values.put(EXTENSION_VERSION, formatExtensionVersion(controllerService.getComponentType(), bundle)); } if (controllerServiceDTO.getProperties() != null) { // for each property specified, extract its configured value final Map<String, String> properties = controllerServiceDTO.getProperties(); final Map<PropertyDescriptor, String> configuredProperties = controllerService.getRawPropertyValues(); for (String propertyName : properties.keySet()) { // build a descriptor for getting the configured value PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder().name(propertyName).build(); String configuredPropertyValue = configuredProperties.get(propertyDescriptor); // if the configured value couldn't be found, use the default value from the actual descriptor if (configuredPropertyValue == null) { propertyDescriptor = locatePropertyDescriptor(configuredProperties.keySet(), propertyDescriptor); configuredPropertyValue = propertyDescriptor.getDefaultValue(); } values.put(propertyName, configuredPropertyValue); } } if (controllerServiceDTO.getComments() != null) { values.put(COMMENTS, controllerService.getComments()); } return values; }
Example 8
Source File: FlowController.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public void removeReportingTask(final ReportingTaskNode reportingTaskNode) { final ReportingTaskNode existing = reportingTasks.get(reportingTaskNode.getIdentifier()); if (existing == null || existing != reportingTaskNode) { throw new IllegalStateException("Reporting Task " + reportingTaskNode + " does not exist in this Flow"); } reportingTaskNode.verifyCanDelete(); try (final NarCloseable x = NarCloseable.withComponentNarLoader(reportingTaskNode.getReportingTask().getClass(), reportingTaskNode.getReportingTask().getIdentifier())) { ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, reportingTaskNode.getReportingTask(), reportingTaskNode.getConfigurationContext()); } for (final Map.Entry<PropertyDescriptor, String> entry : reportingTaskNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.getControllerServiceDefinition() != null) { final String value = entry.getValue() == null ? descriptor.getDefaultValue() : entry.getValue(); if (value != null) { final ControllerServiceNode serviceNode = controllerServiceProvider.getControllerServiceNode(value); if (serviceNode != null) { serviceNode.removeReference(reportingTaskNode); } } } } reportingTasks.remove(reportingTaskNode.getIdentifier()); ExtensionManager.removeInstanceClassLoaderIfExists(reportingTaskNode.getIdentifier()); }
Example 9
Source File: StandardConfigurationContext.java From localization_nifi with Apache License 2.0 | 5 votes |
public StandardConfigurationContext(final ConfiguredComponent component, final ControllerServiceLookup serviceLookup, final String schedulingPeriod, final VariableRegistry variableRegistry) { this.component = component; this.serviceLookup = serviceLookup; this.schedulingPeriod = schedulingPeriod; this.variableRegistry = variableRegistry; if (schedulingPeriod == null) { schedulingNanos = null; } else { if (FormatUtils.TIME_DURATION_PATTERN.matcher(schedulingPeriod).matches()) { schedulingNanos = FormatUtils.getTimeDuration(schedulingPeriod, TimeUnit.NANOSECONDS); } else { schedulingNanos = null; } } preparedQueries = new HashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : component.getProperties().entrySet()) { final PropertyDescriptor desc = entry.getKey(); String value = entry.getValue(); if (value == null) { value = desc.getDefaultValue(); } final PreparedQuery pq = Query.prepare(value); preparedQueries.put(desc, pq); } }
Example 10
Source File: StandardFlowSerializer.java From localization_nifi with Apache License 2.0 | 5 votes |
private static void addConfiguration(final Element element, final Map<PropertyDescriptor, String> properties, final String annotationData, final StringEncryptor encryptor) { final Document doc = element.getOwnerDocument(); for (final Map.Entry<PropertyDescriptor, String> entry : properties.entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); String value = entry.getValue(); if (value != null && descriptor.isSensitive()) { value = ENC_PREFIX + encryptor.encrypt(value) + ENC_SUFFIX; } if (value == null) { value = descriptor.getDefaultValue(); } final Element propElement = doc.createElement("property"); addTextElement(propElement, "name", descriptor.getName()); if (value != null) { addTextElement(propElement, "value", value); } element.appendChild(propElement); } if (annotationData != null) { addTextElement(element, "annotationData", annotationData); } }
Example 11
Source File: ControllerServiceConfiguration.java From nifi with Apache License 2.0 | 5 votes |
public String getProperty(final PropertyDescriptor descriptor) { final String value = properties.get(descriptor); if (value == null) { return descriptor.getDefaultValue(); } else { return value; } }
Example 12
Source File: StandardFlowManager.java From nifi with Apache License 2.0 | 5 votes |
public void removeRootControllerService(final ControllerServiceNode service) { final ControllerServiceNode existing = rootControllerServices.get(requireNonNull(service).getIdentifier()); if (existing == null) { throw new IllegalStateException(service + " is not a member of this Process Group"); } service.verifyCanDelete(); final ExtensionManager extensionManager = flowController.getExtensionManager(); final VariableRegistry variableRegistry = flowController.getVariableRegistry(); try (final NarCloseable x = NarCloseable.withComponentNarLoader(extensionManager, service.getControllerServiceImplementation().getClass(), service.getIdentifier())) { final ConfigurationContext configurationContext = new StandardConfigurationContext(service, flowController.getControllerServiceProvider(), null, variableRegistry); ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnRemoved.class, service.getControllerServiceImplementation(), configurationContext); } for (final Map.Entry<PropertyDescriptor, String> entry : service.getEffectivePropertyValues().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.getControllerServiceDefinition() != null) { final String value = entry.getValue() == null ? descriptor.getDefaultValue() : entry.getValue(); if (value != null) { final ControllerServiceNode referencedNode = getRootControllerService(value); if (referencedNode != null) { referencedNode.removeReference(service, descriptor); } } } } rootControllerServices.remove(service.getIdentifier()); flowController.getStateManagerProvider().onComponentRemoved(service.getIdentifier()); extensionManager.removeInstanceClassLoader(service.getIdentifier()); logger.info("{} removed from Flow Controller", service); }
Example 13
Source File: ControllerServiceAuditor.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Extracts the values for the configured properties from the specified ControllerService. * * @param controllerService service * @param controllerServiceDTO dto * @return properties */ private Map<String, String> extractConfiguredPropertyValues(ControllerServiceNode controllerService, ControllerServiceDTO controllerServiceDTO) { Map<String, String> values = new HashMap<>(); if (controllerServiceDTO.getName() != null) { values.put(NAME, controllerService.getName()); } if (controllerServiceDTO.getAnnotationData() != null) { values.put(ANNOTATION_DATA, controllerService.getAnnotationData()); } if (controllerServiceDTO.getProperties() != null) { // for each property specified, extract its configured value Map<String, String> properties = controllerServiceDTO.getProperties(); Map<PropertyDescriptor, String> configuredProperties = controllerService.getProperties(); for (String propertyName : properties.keySet()) { // build a descriptor for getting the configured value PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder().name(propertyName).build(); String configuredPropertyValue = configuredProperties.get(propertyDescriptor); // if the configured value couldn't be found, use the default value from the actual descriptor if (configuredPropertyValue == null) { propertyDescriptor = locatePropertyDescriptor(configuredProperties.keySet(), propertyDescriptor); configuredPropertyValue = propertyDescriptor.getDefaultValue(); } values.put(propertyName, configuredPropertyValue); } } if (controllerServiceDTO.getComments() != null) { values.put(COMMENTS, controllerService.getComments()); } return values; }
Example 14
Source File: ReportingTaskAuditor.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Extracts the values for the configured properties from the specified ReportingTask. * * @param reportingTask task * @param reportingTaskDTO dto * @return properties of task */ private Map<String, String> extractConfiguredPropertyValues(ReportingTaskNode reportingTask, ReportingTaskDTO reportingTaskDTO) { Map<String, String> values = new HashMap<>(); if (reportingTaskDTO.getName() != null) { values.put(NAME, reportingTask.getName()); } if (reportingTaskDTO.getAnnotationData() != null) { values.put(ANNOTATION_DATA, reportingTask.getAnnotationData()); } if (reportingTaskDTO.getProperties() != null) { // for each property specified, extract its configured value Map<String, String> properties = reportingTaskDTO.getProperties(); Map<PropertyDescriptor, String> configuredProperties = reportingTask.getProperties(); for (String propertyName : properties.keySet()) { // build a descriptor for getting the configured value PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder().name(propertyName).build(); String configuredPropertyValue = configuredProperties.get(propertyDescriptor); // if the configured value couldn't be found, use the default value from the actual descriptor if (configuredPropertyValue == null) { propertyDescriptor = locatePropertyDescriptor(configuredProperties.keySet(), propertyDescriptor); configuredPropertyValue = propertyDescriptor.getDefaultValue(); } values.put(propertyName, configuredPropertyValue); } } return values; }
Example 15
Source File: ReportingTaskAuditor.java From nifi with Apache License 2.0 | 5 votes |
/** * Extracts the values for the configured properties from the specified ReportingTask. * * @param reportingTask task * @param reportingTaskDTO dto * @return properties of task */ private Map<String, String> extractConfiguredPropertyValues(ReportingTaskNode reportingTask, ReportingTaskDTO reportingTaskDTO) { Map<String, String> values = new HashMap<>(); if (reportingTaskDTO.getName() != null) { values.put(NAME, reportingTask.getName()); } if (reportingTaskDTO.getAnnotationData() != null) { values.put(ANNOTATION_DATA, reportingTask.getAnnotationData()); } if (reportingTaskDTO.getBundle() != null) { final BundleCoordinate bundle = reportingTask.getBundleCoordinate(); values.put(EXTENSION_VERSION, formatExtensionVersion(reportingTask.getComponentType(), bundle)); } if (reportingTaskDTO.getProperties() != null) { // for each property specified, extract its configured value Map<String, String> properties = reportingTaskDTO.getProperties(); Map<PropertyDescriptor, String> configuredProperties = reportingTask.getRawPropertyValues(); for (String propertyName : properties.keySet()) { // build a descriptor for getting the configured value PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder().name(propertyName).build(); String configuredPropertyValue = configuredProperties.get(propertyDescriptor); // if the configured value couldn't be found, use the default value from the actual descriptor if (configuredPropertyValue == null) { propertyDescriptor = locatePropertyDescriptor(configuredProperties.keySet(), propertyDescriptor); configuredPropertyValue = propertyDescriptor.getDefaultValue(); } values.put(propertyName, configuredPropertyValue); } } return values; }
Example 16
Source File: ProcessorAuditor.java From nifi with Apache License 2.0 | 4 votes |
/** * Extracts the values for the configured properties from the specified Processor. */ private Map<String, String> extractConfiguredPropertyValues(ProcessorNode processor, ProcessorDTO processorDTO) { Map<String, String> values = new HashMap<>(); if (processorDTO.getName() != null) { values.put(NAME, processor.getName()); } if (processorDTO.getBundle() != null) { final BundleCoordinate bundle = processor.getBundleCoordinate(); values.put(EXTENSION_VERSION, formatExtensionVersion(processor.getComponentType(), bundle)); } if (processorDTO.getConfig() != null) { ProcessorConfigDTO newConfig = processorDTO.getConfig(); if (newConfig.getConcurrentlySchedulableTaskCount() != null) { values.put(CONCURRENTLY_SCHEDULABLE_TASKS, String.valueOf(processor.getMaxConcurrentTasks())); } if (newConfig.getPenaltyDuration() != null) { values.put(PENALTY_DURATION, processor.getPenalizationPeriod()); } if (newConfig.getYieldDuration() != null) { values.put(YIELD_DURATION, processor.getYieldPeriod()); } if (newConfig.getBulletinLevel() != null) { values.put(BULLETIN_LEVEL, processor.getBulletinLevel().name()); } if (newConfig.getAnnotationData() != null) { values.put(ANNOTATION_DATA, processor.getAnnotationData()); } if (newConfig.getSchedulingPeriod() != null) { values.put(SCHEDULING_PERIOD, String.valueOf(processor.getSchedulingPeriod())); } if (newConfig.getAutoTerminatedRelationships() != null) { // get each of the auto terminated relationship names final Set<Relationship> autoTerminatedRelationships = processor.getAutoTerminatedRelationships(); final List<String> autoTerminatedRelationshipNames = new ArrayList<>(autoTerminatedRelationships.size()); for (final Relationship relationship : autoTerminatedRelationships) { autoTerminatedRelationshipNames.add(relationship.getName()); } // sort them and include in the configuration Collections.sort(autoTerminatedRelationshipNames, Collator.getInstance(Locale.US)); values.put(AUTO_TERMINATED_RELATIONSHIPS, StringUtils.join(autoTerminatedRelationshipNames, ", ")); } if (newConfig.getProperties() != null) { // for each property specified, extract its configured value Map<String, String> properties = newConfig.getProperties(); Map<PropertyDescriptor, String> configuredProperties = processor.getRawPropertyValues(); for (String propertyName : properties.keySet()) { // build a descriptor for getting the configured value PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder().name(propertyName).build(); String configuredPropertyValue = configuredProperties.get(propertyDescriptor); // if the configured value couldn't be found, use the default value from the actual descriptor if (configuredPropertyValue == null) { propertyDescriptor = locatePropertyDescriptor(configuredProperties.keySet(), propertyDescriptor); configuredPropertyValue = propertyDescriptor.getDefaultValue(); } values.put(propertyName, configuredPropertyValue); } } if (newConfig.getComments() != null) { values.put(COMMENTS, processor.getComments()); } if (newConfig.getSchedulingStrategy() != null) { values.put(SCHEDULING_STRATEGY, processor.getSchedulingStrategy().name()); } if (newConfig.getExecutionNode() != null) { values.put(EXECUTION_NODE, processor.getExecutionNode().name()); } } return values; }
Example 17
Source File: StandardConfigurationContext.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public PropertyValue getProperty(final PropertyDescriptor property) { final String configuredValue = component.getProperty(property); return new StandardPropertyValue(configuredValue == null ? property.getDefaultValue() : configuredValue, serviceLookup, preparedQueries.get(property), variableRegistry); }
Example 18
Source File: ControllerFacade.java From localization_nifi with Apache License 2.0 | 4 votes |
private ComponentSearchResultDTO search(final String searchStr, final ProcessorNode procNode) { final List<String> matches = new ArrayList<>(); final Processor processor = procNode.getProcessor(); addIfAppropriate(searchStr, procNode.getIdentifier(), "Id", matches); addIfAppropriate(searchStr, procNode.getName(), "Name", matches); addIfAppropriate(searchStr, procNode.getComments(), "Comments", matches); // consider scheduling strategy if (SchedulingStrategy.EVENT_DRIVEN.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("event", searchStr)) { matches.add("Scheduling strategy: Event driven"); } else if (SchedulingStrategy.TIMER_DRIVEN.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("timer", searchStr)) { matches.add("Scheduling strategy: Timer driven"); } else if (SchedulingStrategy.PRIMARY_NODE_ONLY.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("primary", searchStr)) { // PRIMARY_NODE_ONLY has been deprecated as a SchedulingStrategy and replaced by PRIMARY as an ExecutionNode. matches.add("Scheduling strategy: On primary node"); } // consider execution node if (ExecutionNode.PRIMARY.equals(procNode.getExecutionNode()) && StringUtils.containsIgnoreCase("primary", searchStr)) { matches.add("Execution node: primary"); } // consider scheduled state if (ScheduledState.DISABLED.equals(procNode.getScheduledState())) { if (StringUtils.containsIgnoreCase("disabled", searchStr)) { matches.add("Run status: Disabled"); } } else { if (StringUtils.containsIgnoreCase("invalid", searchStr) && !procNode.isValid()) { matches.add("Run status: Invalid"); } else if (ScheduledState.RUNNING.equals(procNode.getScheduledState()) && StringUtils.containsIgnoreCase("running", searchStr)) { matches.add("Run status: Running"); } else if (ScheduledState.STOPPED.equals(procNode.getScheduledState()) && StringUtils.containsIgnoreCase("stopped", searchStr)) { matches.add("Run status: Stopped"); } } for (final Relationship relationship : procNode.getRelationships()) { addIfAppropriate(searchStr, relationship.getName(), "Relationship", matches); } // Add both the actual class name and the component type. This allows us to search for 'Ghost' // to search for components that could not be instantiated. addIfAppropriate(searchStr, processor.getClass().getSimpleName(), "Type", matches); addIfAppropriate(searchStr, procNode.getComponentType(), "Type", matches); for (final Map.Entry<PropertyDescriptor, String> entry : procNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); addIfAppropriate(searchStr, descriptor.getName(), "Property name", matches); addIfAppropriate(searchStr, descriptor.getDescription(), "Property description", matches); // never include sensitive properties values in search results if (descriptor.isSensitive()) { continue; } String value = entry.getValue(); // if unset consider default value if (value == null) { value = descriptor.getDefaultValue(); } // evaluate if the value matches the search criteria if (StringUtils.containsIgnoreCase(value, searchStr)) { matches.add("Property value: " + descriptor.getName() + " - " + value); } } // consider searching the processor directly if (processor instanceof Searchable) { final Searchable searchable = (Searchable) processor; final SearchContext context = new StandardSearchContext(searchStr, procNode, flowController, variableRegistry); // search the processor using the appropriate thread context classloader try (final NarCloseable x = NarCloseable.withComponentNarLoader(processor.getClass(), processor.getIdentifier())) { final Collection<SearchResult> searchResults = searchable.search(context); if (CollectionUtils.isNotEmpty(searchResults)) { for (final SearchResult searchResult : searchResults) { matches.add(searchResult.getLabel() + ": " + searchResult.getMatch()); } } } catch (final Throwable t) { // log this as error } } if (matches.isEmpty()) { return null; } final ComponentSearchResultDTO result = new ComponentSearchResultDTO(); result.setId(procNode.getIdentifier()); result.setMatches(matches); result.setName(procNode.getName()); return result; }
Example 19
Source File: StandardSearchContext.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public PropertyValue getProperty(PropertyDescriptor property) { final String configuredValue = processorNode.getProperty(property); return new StandardPropertyValue(configuredValue == null ? property.getDefaultValue() : configuredValue, controllerServiceLookup,variableRegistry); }
Example 20
Source File: StandardValidationContext.java From nifi with Apache License 2.0 | 4 votes |
@Override public PropertyValue getProperty(final PropertyDescriptor property) { final PropertyConfiguration configuredValue = properties.get(property); final String effectiveValue = configuredValue == null ? property.getDefaultValue() : configuredValue.getEffectiveValue(parameterContext); return new StandardPropertyValue(effectiveValue, controllerServiceProvider, parameterContext, preparedQueries.get(property), variableRegistry); }