private List<Capability> calculateSystemCapabilities(final Map<String,String> fwkProps) throws IOException { Map<String, String> mf = new HashMap<>(); mf.put(Constants.PROVIDE_CAPABILITY, Stream.of( fwkProps.get(Constants.FRAMEWORK_SYSTEMCAPABILITIES), fwkProps.get(Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA) ) .filter(Objects::nonNull) .collect(Collectors.joining(","))); mf.put(Constants.EXPORT_PACKAGE, Stream.of( fwkProps.get(Constants.FRAMEWORK_SYSTEMPACKAGES), fwkProps.get(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA) ).filter(Objects::nonNull) .collect(Collectors.joining(","))); mf.put(Constants.BUNDLE_SYMBOLICNAME, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); mf.put(Constants.BUNDLE_MANIFESTVERSION, "2"); try { return ResourceBuilder.build(null, mf).getCapabilities(null); } catch (Exception ex) { throw new IOException(ex); } }
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()); } }