private RequirementImpl getFirstIdentityReq(ResourceImpl resource) { for (Requirement r : resource.getRequirements(null)) { if (IDENTITY_NAMESPACE.equals(r.getNamespace())) { return (RequirementImpl) r; } } return null; }
public void requireFeature(String name, String range, boolean mandatory) { if (mandatory) { ResourceUtils.addIdentityRequirement(this, name, TYPE_FEATURE, range); } else { ResourceImpl res = new ResourceImpl(); ResourceUtils.addIdentityRequirement(res, name, TYPE_FEATURE, range, false); dependentFeatures.addAll(res.getRequirements(null)); } }
protected void analyze() throws IOException { final String name = this.manifest.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME); if ( name != null ) { final String version = this.manifest.getMainAttributes().getValue(Constants.BUNDLE_VERSION); if ( version == null ) { throw new IOException("Unable to get bundle version from artifact " + getArtifact().getId().toMvnId()); } this.symbolicName = name; this.bundleVersion = version; final String newBundleName = this.getArtifact().getMetadata().get("bundle:rename-bsn"); if (newBundleName != null) { this.symbolicName = newBundleName; } this.getExportedPackages().addAll(extractExportedPackages(this.manifest)); this.getImportedPackages().addAll(extractImportedPackages(this.manifest)); this.getDynamicImportedPackages().addAll(extractDynamicImportedPackages(this.manifest)); try { ResourceImpl resource = ResourceBuilder.build(null, this.manifest.getMainAttributes().entrySet().stream() .collect(Collectors.toMap(entry -> entry.getKey().toString(), entry -> entry.getValue().toString()))); this.getCapabilities().addAll(resource.getCapabilities(null)); this.getRequirements().addAll(resource.getRequirements(null)); } catch (Exception ex) { throw new IOException(ex); } } else { throw new IOException("Unable to get bundle symbolic name from artifact " + getArtifact().getId().toMvnId()); } }