[ 
https://issues.apache.org/jira/browse/NIFI-3122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15733408#comment-15733408
 ] 

ASF GitHub Bot commented on NIFI-3122:
--------------------------------------

Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1283#discussion_r91607077
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
 ---
    @@ -1950,57 +1952,6 @@ private ProcessGroup getConnectableParent(final 
ProcessGroup group, final String
             }
         }
     
    -    public void verifyComponentTypesInSnippet(final FlowSnippetDTO 
templateContents) {
    -        // validate that all Processor Types and Prioritizer Types are 
valid
    -        final Set<String> processorClasses = new HashSet<>();
    -        for (final Class<?> c : 
ExtensionManager.getExtensions(Processor.class)) {
    -            processorClasses.add(c.getName());
    -        }
    -        final Set<String> prioritizerClasses = new HashSet<>();
    -        for (final Class<?> c : 
ExtensionManager.getExtensions(FlowFilePrioritizer.class)) {
    -            prioritizerClasses.add(c.getName());
    -        }
    -        final Set<String> controllerServiceClasses = new HashSet<>();
    -        for (final Class<?> c : 
ExtensionManager.getExtensions(ControllerService.class)) {
    -            controllerServiceClasses.add(c.getName());
    -        }
    -
    -        final Set<ProcessorDTO> allProcs = new HashSet<>();
    -        final Set<ConnectionDTO> allConns = new HashSet<>();
    -        allProcs.addAll(templateContents.getProcessors());
    -        allConns.addAll(templateContents.getConnections());
    -        for (final ProcessGroupDTO childGroup : 
templateContents.getProcessGroups()) {
    -            allProcs.addAll(findAllProcessors(childGroup));
    -            allConns.addAll(findAllConnections(childGroup));
    -        }
    -
    -        for (final ProcessorDTO proc : allProcs) {
    -            if (!processorClasses.contains(proc.getType())) {
    -                throw new IllegalStateException("Invalid Processor Type: " 
+ proc.getType());
    -            }
    -        }
    -
    -        final Set<ControllerServiceDTO> controllerServices = 
templateContents.getControllerServices();
    -        if (controllerServices != null) {
    -            for (final ControllerServiceDTO service : controllerServices) {
    -                if (!controllerServiceClasses.contains(service.getType())) 
{
    -                    throw new IllegalStateException("Invalid Controller 
Service Type: " + service.getType());
    -                }
    -            }
    -        }
    -
    -        for (final ConnectionDTO conn : allConns) {
    -            final List<String> prioritizers = conn.getPrioritizers();
    -            if (prioritizers != null) {
    -                for (final String prioritizer : prioritizers) {
    -                    if (!prioritizerClasses.contains(prioritizer)) {
    --- End diff --
    
    Before we can remove this check I believe we need to provide support for 
ghost Prioritizers. Otherwise, if a template references a Prioritizer that 
doesn't exist in this NiFi instance we would throw an exception when 
instantiating the Template.
    
    Alternatively, we can keep this part of the verification in place. However, 
I think the ghost Prioritizer would be the preferred approach.


> Allow templates to be instantiated even if they contain missing processor 
> types
> -------------------------------------------------------------------------------
>
>                 Key: NIFI-3122
>                 URL: https://issues.apache.org/jira/browse/NIFI-3122
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>             Fix For: 1.2.0
>
>
> If a template is imported into NiFi, no checks are done to see if the 
> component types in the template are valid. However, when we try to 
> instantiate the template, if it contains a processor, etc. that is not known 
> by the NiFi instance, the instantiation fails.
> We recently introduced the notion of Ghost Processors/Controller 
> Services/Reporting Tasks. As a result, we can now avoid the failure in this 
> case and instead create ghost components when the type is not known.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to