private void validateDependencies()

in src/main/java/org/apache/nifi/components/AbstractConfigurableComponent.java [143:176]


    private void validateDependencies(final PropertyDescriptor descriptor, final ValidationContext context, final Collection<ValidationResult> results) {
        // Ensure that we don't have any dependencies on non-existent properties.
        final Set<PropertyDependency> dependencies = descriptor.getDependencies();
        for (final PropertyDependency dependency : dependencies) {
            final String dependentPropertyName = dependency.getPropertyName();

            // If there's a supported property descriptor then all is okay.
            final PropertyDescriptor specDescriptor = new PropertyDescriptor.Builder().name(dependentPropertyName).build();
            final PropertyDescriptor supportedDescriptor = getSupportedPropertyDescriptor(specDescriptor);
            if (supportedDescriptor != null) {
                continue;
            }

            final PropertyDescriptor dynamicPropertyDescriptor = getSupportedDynamicPropertyDescriptor(dependentPropertyName);
            if (dynamicPropertyDescriptor == null) {
                results.add(new ValidationResult.Builder()
                    .subject(descriptor.getDisplayName())
                    .valid(false)
                    .explanation("Property depends on property " + dependentPropertyName + ", which is not a known property")
                    .build());
            }

            // Dependent property is supported as a dynamic property. This is okay as long as there is a value set.
            final PropertyValue value = context.getProperty(dynamicPropertyDescriptor);
            if (value == null || !value.isSet()) {
                results.add(new ValidationResult.Builder()
                    .subject(descriptor.getDisplayName())
                    .valid(false)
                    .explanation("Property depends on property " + dependentPropertyName + ", which is not a known property")
                    .build());
            }
        }

    }