/** * Changes String for <code>originalUri</code> into {@link LocationPattern} */ public void compile() throws MalformedURLException { originalUriPattern = new LocationPattern(originalUri); } }
public ProfileNamePattern(String profileName) { if (profileName == null) { throw new IllegalArgumentException("Profile name to match should not be null"); } name = profileName; if (name.contains("*")) { namePattern = LocationPattern.toRegExp(name); } }
/** * Checks whether the bundle URI is blacklisted according to configured rules * @param uri * @return */ public boolean isBundleBlacklisted(String uri) { for (LocationPattern pattern : bundleBlacklist) { if (pattern.matches(uri)) { return true; } } return false; }
LocationPattern pattern = new LocationPattern(uri); String ga = String.format("%s/%s", pattern.getGroupId(), pattern.getArtifactId()); ga2uri.computeIfAbsent(ga, k -> new LinkedList<>()).add(originalUri); } catch (IllegalArgumentException ignored) {
private void processBundles(List<Bundle> bundles, boolean allBlacklisted, Boolean forceDependency) { for (Bundle bundle : bundles) { boolean bundleBlacklisted = allBlacklisted || isBundleBlacklisted(bundle.getLocation()); if (bundleBlacklisted) { // blacklisting has higher priority bundle.setBlacklisted(true); } else { // if not blacklisted, it may be overriden staticOverrideBundle(bundle); // and may have dependency flag altered if (forceDependency != null) { // set at feature level bundle.setDependency(forceDependency); } else { // may have dependency overriden at bundle level for (OverrideBundleDependency.OverrideDependency overrideBundleDependency : getInstructions().getOverrideBundleDependency().getBundles()) { LocationPattern pattern = new LocationPattern(overrideBundleDependency.getUri()); if (pattern.matches(bundle.getLocation())) { bundle.setDependency(overrideBundleDependency.isDependency()); } } } } } }
LocationPattern pattern = new LocationPattern(uri); String ga = String.format("%s/%s", pattern.getGroupId(), pattern.getArtifactId()); ga2uri.computeIfAbsent(ga, k -> new LinkedList<>()).add(originalUri); } catch (IllegalArgumentException ignored) {
other = new LocationPattern(otherUri); } catch (IllegalArgumentException e) { LOG.debug("Can't parse \"" + otherUri + "\" as Maven URI. Ignoring.");
public ProfileNamePattern(String profileName) { if (profileName == null) { throw new IllegalArgumentException("Profile name to match should not be null"); } name = profileName; if (name.contains("*")) { namePattern = LocationPattern.toRegExp(name); } }
/** * Checks whether features XML repository URI is blacklisted. * @param uri * @return */ public boolean isRepositoryBlacklisted(String uri) { for (LocationPattern pattern : repositoryBlacklist) { if (pattern.matches(uri)) { return true; } } return false; }
} else { try { repositoryBlacklist.add(new LocationPattern(location)); } catch (IllegalArgumentException e) { LOG.warn("Problem parsing repository blacklist URI \"" + location + "\": " + e.getMessage() + ". Ignoring."); } else { try { bundleBlacklist.add(new LocationPattern(location)); } catch (IllegalArgumentException e) { LOG.warn("Problem parsing bundle blacklist URI \"" + location + "\": " + e.getMessage() + ". Ignoring.");
versionString = c[0].getAttribute(RANGE); namePattern = LocationPattern.toRegExp(nameString);
@Override public boolean isRepositoryBlacklisted(String uri) { for (LocationPattern lp : processing.getBlacklistedRepositoryLocationPatterns()) { if (lp.matches(uri)) { return true; } } return false; }
for (String repositoryURI : getBlacklistedRepositories()) { try { blacklistedRepositoryLocationPatterns.add(new LocationPattern(repositoryURI)); blacklisted.add(repositoryURI + ";" + Blacklist.BLACKLIST_TYPE + "=" + Blacklist.TYPE_REPOSITORY); } catch (IllegalArgumentException e) {
/** * Processes {@link Bundle bundle definition} and (according to override instructions) maybe sets different target * location and {@link BundleInfo#isOverriden()} flag. */ private void staticOverrideBundle(Bundle bundle) { bundle.setOverriden(BundleInfo.BundleOverrideMode.NONE); for (BundleReplacements.OverrideBundle override : this.getInstructions().getBundleReplacements().getOverrideBundles()) { String originalLocation = bundle.getLocation(); if (override.getOriginalUriPattern().matches(originalLocation)) { LOG.debug("Overriding bundle location \"" + originalLocation + "\" with \"" + override.getReplacement() + "\""); bundle.setOriginalLocation(originalLocation); if (override.getMode() == BundleReplacements.BundleOverrideMode.MAVEN) { bundle.setOverriden(BundleInfo.BundleOverrideMode.MAVEN); } else { bundle.setOverriden(BundleInfo.BundleOverrideMode.OSGI); } bundle.setLocation(override.getReplacement()); // TOCHECK: last rule wins - no break!!! //break; } } }
blacklist.blacklistRepository(new LocationPattern(br)); } catch (IllegalArgumentException e) { LOGGER.warn("Blacklisted features XML repository URI is invalid: {}, ignoring", br); blacklist.blacklistBundle(new LocationPattern(bb)); } catch (IllegalArgumentException e) { LOGGER.warn("Blacklisted bundle URI is invalid: {}, ignoring", bb);
blacklistedDescriptors.forEach(lp -> { processor.getInstructions().getBlacklistedRepositoryLocationPatterns() .add(new LocationPattern(lp)); }); .add(new LocationPattern("mvn:" + selfGroupId + "/" + selfArtifactId));
blacklistedDescriptors.forEach(lp -> { processor.getInstructions().getBlacklistedRepositoryLocationPatterns() .add(new LocationPattern(lp)); }); .add(new LocationPattern("mvn:" + selfGroupId + "/" + selfArtifactId));
blacklist.blacklistRepository(new LocationPattern(br)); } catch (IllegalArgumentException e) { LOGGER.warn("Blacklisted features XML repository URI is invalid: {}, ignoring", br); blacklist.blacklistBundle(new LocationPattern(bb)); } catch (IllegalArgumentException e) { LOGGER.warn("Blacklisted bundle URI is invalid: {}, ignoring", bb);