tpalfy commented on a change in pull request #3651: NIFI-6539 Nifi stateless 
init from flow xml
URL: https://github.com/apache/nifi/pull/3651#discussion_r314401435
 
 

 ##########
 File path: 
nifi-stateless/nifi-stateless-core/src/main/java/org/apache/nifi/stateless/core/ComponentFactory.java
 ##########
 @@ -223,4 +350,24 @@ private Bundle getAvailableBundle(final 
org.apache.nifi.registry.flow.Bundle bun
 
         return possibleBundles.get(0);
     }
+
+    private Bundle getAvailableBundle(final BundleDTO bundle, final String 
componentType) {
 
 Review comment:
   This code duplication could be avoided with a common private method like 
this:
   
   ```java
   private Bundle getAvailableBundle(final org.apache.nifi.registry.flow.Bundle 
bundle, final String componentType) {
           return getAvailableBundle(componentType, bundle.getGroup(), 
bundle.getArtifact(), bundle.getVersion());
       }
   
       private Bundle getAvailableBundle(final BundleDTO bundle, final String 
componentType) {
           return getAvailableBundle(componentType, bundle.getGroup(), 
bundle.getArtifact(), bundle.getVersion());
       }
   
       private Bundle getAvailableBundle(final String componentType, String 
group, String artifact, String version) {
           final BundleCoordinate bundleCoordinate = new 
BundleCoordinate(group, artifact, version);
           final Bundle availableBundle = 
extensionManager.getBundle(bundleCoordinate);
           if (availableBundle != null) {
               return availableBundle;
           }
   
           final List<Bundle> possibleBundles = 
extensionManager.getBundles(componentType);
           if (possibleBundles.isEmpty()) {
               throw new IllegalStateException("Could not find any NiFi Bundles 
that contain the Extension [" + componentType + "]");
           }
   
           if (possibleBundles.size() > 1) {
               throw new IllegalStateException("Found " + 
possibleBundles.size() + " different NiFi Bundles that contain the Extension [" 
+ componentType + "] but none of them had a version of " +
                       version);
           }
   
           return possibleBundles.get(0);
       }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to