/** * 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; } } }
/** * Create an instance of {@link Bundle} * * @return the bundle. */ public Bundle createBundle() { return new Bundle(); }
@Override public int hashCode() { int result = value != null ? value.hashCode() : 0; result = 31 * result + getStartLevel(); result = 31 * result + (isStart() ? 1 : 0); result = 31 * result + (isDependency() ? 1 : 0); return result; }
bundle.setLocation(this.dependencyHelper.artifactToMvn(project.getArtifact(), project.getVersion())); if (startLevel != null) { bundle.setStartLevel(startLevel); if (bundleName.equals(b.getLocation())) { bundle = b; break; bundle.setLocation(bundleName); bundle.setDependency(true); if (startLevel != null && bundle.getStartLevel() == 0) { bundle.setStartLevel(startLevel);
Bundle bun = new Bundle(); bun.setLocation(location); generated.getBundle().add(bun); if (!ignoreDependencyFlag || !bundle.isDependency()) { bundleInfos.add(bundle); if (!ignoreDependencyFlag || !bundle.isDependency()) { bundleInfos.add(bundle);
private void logIgnored(Bundle bundle) { getLog().warn("Ignoring jar without BundleSymbolicName: " + bundle.getLocation()); }
for (Bundle b : f.getBundle()) { Bundle bundle = objectFactory.createBundle(); bundle.setLocation(b.getLocation()); feature.getBundle().add(bundle);
Bundle bundle = new Bundle(); bundle.setLocation(innerBundle); wrapFeature.getBundle().add(bundle);
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()); } } } } } }
if (!ignoreDependencyFlag || !bundle.isDependency()) { installer.installArtifact(bundle); if (!ignoreDependencyFlag || !bundle.isDependency()) { installer.installArtifact(bundle);
bundle.setLocation(this.dependencyHelper.artifactToMvn(project.getArtifact(), project.getVersion())); if (startLevel != null) { bundle.setStartLevel(startLevel); if (bundleName.equals(b.getLocation())) { bundle = b; break; bundle.setLocation(bundleName); bundle.setDependency(true); if (startLevel != null && bundle.getStartLevel() == 0) { bundle.setStartLevel(startLevel);
Bundle bun = new Bundle(); bun.setLocation(location); generated.getBundle().add(bun); if (!ignoreDependencyFlag || !bundle.isDependency()) { bundleInfos.add(bundle); if (!ignoreDependencyFlag || !bundle.isDependency()) { bundleInfos.add(bundle);
private void logIgnored(Bundle bundle) { getLog().warn("Ignoring jar without BundleSymbolicName: " + bundle.getLocation()); }
for (Bundle b : f.getBundle()) { Bundle bundle = objectFactory.createBundle(); bundle.setLocation(b.getLocation()); feature.getBundle().add(bundle);
if (!ignoreDependencyFlag || !bundle.isDependency()) { installer.installArtifact(bundle); if (!ignoreDependencyFlag || !bundle.isDependency()) { installer.installArtifact(bundle);
private Attributes getManifest(Bundle bundle) throws MojoExecutionException { Attributes attributes = manifests.get(bundle.getLocation()); if (attributes == null) { Artifact artifact = resourceToArtifact(bundle.getLocation(), skipNonMavenProtocols); if (artifact.getFile() == null) { resolveArtifact(artifact, remoteRepos); } try (JarInputStream jis = new JarInputStream(new FileInputStream(artifact.getFile()))) { Manifest manifest = jis.getManifest(); if (manifest != null) { attributes = manifest.getMainAttributes(); } else { attributes = new Attributes(); } manifests.put(bundle.getLocation(), attributes); } catch (IOException e) { throw new MojoExecutionException("Error reading bundle manifest from " + bundle.getLocation(), e); } } return attributes; }
private Attributes getManifest(Bundle bundle) throws MojoExecutionException { Attributes attributes = manifests.get(bundle.getLocation()); if (attributes == null) { Artifact artifact = resourceToArtifact(bundle.getLocation(), skipNonMavenProtocols); if (artifact.getFile() == null) { resolveArtifact(artifact, remoteRepos); } try (JarInputStream jis = new JarInputStream(new FileInputStream(artifact.getFile()))) { Manifest manifest = jis.getManifest(); if (manifest != null) { attributes = manifest.getMainAttributes(); } else { attributes = new Attributes(); } manifests.put(bundle.getLocation(), attributes); } catch (IOException e) { throw new MojoExecutionException("Error reading bundle manifest from " + bundle.getLocation(), e); } } return attributes; }
private void copyBundlesToDestRepository(List<? extends Bundle> artifactRefs) throws MojoExecutionException { for (Bundle artifactRef : artifactRefs) { Artifact artifact = resourceToArtifact(artifactRef.getLocation(), skipNonMavenProtocols); // Avoid getting NPE on artifact.getFile in some cases resolveArtifact(artifact, remoteRepos); if (artifact != null) { copy(artifact, repository); } } }
private void copyBundlesToDestRepository(List<? extends Bundle> artifactRefs) throws MojoExecutionException { for (Bundle artifactRef : artifactRefs) { Artifact artifact = resourceToArtifact(artifactRef.getLocation(), skipNonMavenProtocols); // Avoid getting NPE on artifact.getFile in some cases resolveArtifact(artifact, remoteRepos); if (artifact != null) { copy(artifact, repository); } } }
feature.getBundle().forEach(bundle -> { bundle2featureId.computeIfAbsent(bundle.getLocation().trim(), k -> new TreeSet<>()).add(feature.getId()); }); feature.getConditional().forEach(cond -> {