/* * Get a list of bundle locations in a feature */ private List<String> getBundleLocations(Feature feature) { List<String> result = new LinkedList<String>(); if (feature != null && feature.getBundles() != null) { for (BundleInfo bundle : feature.getBundles()) { result.add(bundle.getLocation()); } } return result; }
@Override public Set<BundleInfo> getBundles() throws ApplicationServiceException { Set<BundleInfo> bundles = new TreeSet<BundleInfo>(new BundleInfoComparator()); for (Feature curFeature : getFeatures()) { bundles.addAll(curFeature.getBundles()); } return bundles; }
private Set<String> getFeatureLocations() throws Exception { Set<String> bundleLocations = new LinkedHashSet<String>(); for (Feature feature : featuresService.listFeatures()) { try { for (BundleInfo info : feature.getBundles()) { bundleLocations.add(info.getLocation()); } } catch (Exception e) { // Ignore } } return bundleLocations; }
/** * Get the list of features where the bundle is belonging. * * @param bundleLocation the bundle location. * @return the list of feature where the bundle is present. * @throws Exception in case of retrieval failure. */ protected List<Feature> retrieveFeature(String bundleLocation) throws Exception { Feature[] features = featuresService.listFeatures(); List<Feature> matchingFeatures = new ArrayList<Feature>(); for (Feature feature : features) { List<BundleInfo> bundles = feature.getBundles(); for (BundleInfo bundleInfo : bundles) { String location = bundleInfo.getLocation(); if (location.equalsIgnoreCase(bundleLocation)) { matchingFeatures.add(feature); LOGGER.debug( "CELLAR BUNDLE: found a feature {} containing bundle {}", feature.getName(), bundleLocation); } } } return matchingFeatures; }