for (final BundleDetails bundleDetail : additionalBundleDetails) { logger.warn(String.format("Unable to resolve required dependency '%s'. Skipping NAR '%s'", bundleDetail.getDependencyCoordinate().getId(), bundleDetail.getWorkingDirectory().getAbsolutePath())); skippedBundles.add(bundleDetail);
final BundleCoordinate bundleDependencyCoordinate = bundleDetail.getDependencyCoordinate(); if (bundleDependencyCoordinate == null) { final ClassLoader jettyClassLoader = getJettyBundle().getClassLoader();
final BundleCoordinate narDependencyCoordinate = narDetail.getDependencyCoordinate(); narDetail.getDependencyCoordinate().getId(), narDetail.getWorkingDirectory().getAbsolutePath()));
/** * Determines if the given controller service node has the required API as an ancestor. * * @param controllerServiceImplBundle the bundle of a controller service being referenced by a processor * @param requiredApiCoordinate the controller service API required by the processor * @return true if the controller service node has the require API as an ancestor, false otherwise */ private boolean matchesApi(final ExtensionManager extensionManager, final Bundle controllerServiceImplBundle, final BundleCoordinate requiredApiCoordinate) { // start with the coordinate of the controller service for cases where the API and service are in the same bundle BundleCoordinate controllerServiceDependencyCoordinate = controllerServiceImplBundle.getBundleDetails().getCoordinate(); boolean foundApiDependency = false; while (controllerServiceDependencyCoordinate != null) { // determine if the dependency coordinate matches the required API if (requiredApiCoordinate.equals(controllerServiceDependencyCoordinate)) { foundApiDependency = true; break; } // move to the next dependency in the chain, or stop if null final Bundle controllerServiceDependencyBundle = extensionManager.getBundle(controllerServiceDependencyCoordinate); if (controllerServiceDependencyBundle == null) { controllerServiceDependencyCoordinate = null; } else { controllerServiceDependencyCoordinate = controllerServiceDependencyBundle.getBundleDetails().getDependencyCoordinate(); } } return foundApiDependency; }
private void enrichComponent(EnrichingElementAdapter componentToEnrich, Map<String, Bundle> componentToEnrichVersionToBundles) throws FlowEnrichmentException { if (componentToEnrich.getBundleElement() != null) { return; } BundleCoordinate enrichingBundleCoordinate = null; if (!componentToEnrichVersionToBundles.isEmpty()) { // If there is only one supporting bundle, choose it, otherwise carry out additional analysis if (componentToEnrichVersionToBundles.size() == 1) { BundleDetails enrichingBundleDetails = componentToEnrichVersionToBundles.entrySet().iterator().next().getValue().getBundleDetails(); enrichingBundleCoordinate = enrichingBundleDetails.getCoordinate(); // Adjust the bundle to reflect the values we learned from the Extension Manager componentToEnrich.setBundleInformation(enrichingBundleCoordinate); componentToEnrich.setDependsUponBundleCoordinate(enrichingBundleDetails.getDependencyCoordinate()); } else { // multiple options final Set<String> componentToEnrichBundleVersions = componentToEnrichVersionToBundles.values().stream() .map(bundle -> bundle.getBundleDetails().getCoordinate().getVersion()).collect(Collectors.toSet()); // Select the last version of those available for the enriching bundle final String bundleVersion = componentToEnrichBundleVersions.stream().sorted().reduce((version, otherVersion) -> otherVersion).get(); final BundleCoordinate enrichingCoordinate = componentToEnrichVersionToBundles.get(bundleVersion).getBundleDetails().getCoordinate(); componentToEnrich.setBundleInformation(enrichingCoordinate); logger.warn("Multiple enriching bundle options were available for component {}. The automatically selected enriching bundle was {}", new Object[]{componentToEnrich.getComponentClass(), enrichingCoordinate}); } } else { logger.warn("Could not find any eligible bundles for {}. Automatic start of the flow cannot be guaranteed.", componentToEnrich.getComponentClass()); } }
private void enrichComponent(EnrichingElementAdapter componentToEnrich, Map<String, Bundle> componentToEnrichVersionToBundles) throws FlowEnrichmentException { if (componentToEnrich.getBundleElement() != null) { return; } BundleCoordinate enrichingBundleCoordinate = null; if (!componentToEnrichVersionToBundles.isEmpty()) { // If there is only one supporting bundle, choose it, otherwise carry out additional analysis if (componentToEnrichVersionToBundles.size() == 1) { BundleDetails enrichingBundleDetails = componentToEnrichVersionToBundles.entrySet().iterator().next().getValue().getBundleDetails(); enrichingBundleCoordinate = enrichingBundleDetails.getCoordinate(); // Adjust the bundle to reflect the values we learned from the Extension Manager componentToEnrich.setBundleInformation(enrichingBundleCoordinate); componentToEnrich.setDependsUponBundleCoordinate(enrichingBundleDetails.getDependencyCoordinate()); } else { // multiple options final Set<String> componentToEnrichBundleVersions = componentToEnrichVersionToBundles.values().stream() .map(bundle -> bundle.getBundleDetails().getCoordinate().getVersion()).collect(Collectors.toSet()); // Select the last version of those available for the enriching bundle final String bundleVersion = componentToEnrichBundleVersions.stream().sorted().reduce((version, otherVersion) -> otherVersion).get(); final BundleCoordinate enrichingCoordinate = componentToEnrichVersionToBundles.get(bundleVersion).getBundleDetails().getCoordinate(); componentToEnrich.setBundleInformation(enrichingCoordinate); logger.warn("Multiple enriching bundle options were available for component {}. The automatically selected enriching bundle was {}", new Object[]{componentToEnrich.getComponentClass(), enrichingCoordinate}); } } else { logger.warn("Could not find any eligible bundles for {}. Automatic start of the flow cannot be guaranteed.", componentToEnrich.getComponentClass()); } }
final BundleCoordinate narDependencyCoordinate = narDetail.getDependencyCoordinate(); narDetail.getDependencyCoordinate().getId(), narDetail.getWorkingDirectory().getAbsolutePath()));
final BundleCoordinate narDependencyCoordinate = narDetail.getDependencyCoordinate(); narDetail.getDependencyCoordinate().getId(), narDetail.getWorkingDirectory().getAbsolutePath()));
/** * Determines if the given controller service node has the required API as an ancestor. * * @param controllerServiceImplBundle the bundle of a controller service being referenced by a processor * @param requiredApiCoordinate the controller service API required by the processor * @return true if the controller service node has the require API as an ancestor, false otherwise */ private boolean matchesApi(final Bundle controllerServiceImplBundle, final BundleCoordinate requiredApiCoordinate) { // start with the coordinate of the controller service for cases where the API and service are in the same bundle BundleCoordinate controllerServiceDependencyCoordinate = controllerServiceImplBundle.getBundleDetails().getCoordinate(); boolean foundApiDependency = false; while (controllerServiceDependencyCoordinate != null) { // determine if the dependency coordinate matches the required API if (requiredApiCoordinate.equals(controllerServiceDependencyCoordinate)) { foundApiDependency = true; break; } // move to the next dependency in the chain, or stop if null final Bundle controllerServiceDependencyBundle = ExtensionManager.getBundle(controllerServiceDependencyCoordinate); if (controllerServiceDependencyBundle == null) { controllerServiceDependencyCoordinate = null; } else { controllerServiceDependencyCoordinate = controllerServiceDependencyBundle.getBundleDetails().getDependencyCoordinate(); } } return foundApiDependency; }