@SuppressWarnings("deprecation") public static VersionRange getVersionRange(Clause clause) { String v = clause.getAttribute(Constants.VERSION_ATTRIBUTE); if (v == null) { v = clause.getAttribute(Constants.PACKAGE_SPECIFICATION_VERSION); } if (v == null) { v = clause.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); } return VersionRange.parseVersionRange(v); } }
@SuppressWarnings("deprecation") public static VersionRange getVersionRange(Clause clause) { String v = clause.getAttribute(Constants.VERSION_ATTRIBUTE); if (v == null) { v = clause.getAttribute(Constants.PACKAGE_SPECIFICATION_VERSION); } if (v == null) { v = clause.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); } return VersionRange.parseVersionRange(v); } }
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkBundle(clause.getName(), clause.getAttribute("bundle-version")); output.append(isSatisfied ? SimpleAnsi.COLOR_DEFAULT : SimpleAnsi.COLOR_RED); } public void post(Clause clause, StringBuilder output) {
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkBundle(clause.getName(), clause.getAttribute("bundle-version")); output.append(isSatisfied ? SimpleAnsi.COLOR_DEFAULT : SimpleAnsi.COLOR_RED); } public void post(Clause clause, StringBuilder output) {
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkPackage(clause.getName(), clause.getAttribute("version")); boolean isOptional = "optional".equals(clause.getDirective("resolution")); output.append(isSatisfied ? SimpleAnsi.COLOR_DEFAULT : SimpleAnsi.COLOR_RED); output.append(isSatisfied || isOptional ? SimpleAnsi.INTENSITY_NORMAL : SimpleAnsi.INTENSITY_BOLD); } public void post(Clause clause, StringBuilder output) {
private Set<PackageInfo> calculateSystemPackages(final Map<String,String> fwkProps) { return Stream.of( Parser.parseHeader( Stream.of( fwkProps.get(Constants.FRAMEWORK_SYSTEMPACKAGES), fwkProps.get(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA) ).filter(Objects::nonNull) .collect(Collectors.joining(",")) ) ).map( clause -> new PackageInfo(clause.getName(), clause.getAttribute("version") != null ? clause.getAttribute("version") : "0.0.0", false)) .collect(Collectors.toSet()); }
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkPackage(clause.getName(), clause.getAttribute("version")); boolean isOptional = "optional".equals(clause.getDirective("resolution")); output.append(isSatisfied ? SimpleAnsi.COLOR_DEFAULT : SimpleAnsi.COLOR_RED); output.append(isSatisfied || isOptional ? SimpleAnsi.INTENSITY_NORMAL : SimpleAnsi.INTENSITY_BOLD); } public void post(Clause clause, StringBuilder output) {
protected void findBundlesWithFragmentsToRefresh(Set<Bundle> toRefresh) { for (Bundle b : toRefresh) { if (b.getState() != Bundle.UNINSTALLED) { String hostHeader = b.getHeaders().get(Constants.FRAGMENT_HOST); if (hostHeader != null) { Clause[] clauses = Parser.parseHeader(hostHeader); if (clauses != null && clauses.length > 0) { Clause path = clauses[0]; for (Bundle hostBundle : bundleContext.getBundles()) { if (hostBundle.getSymbolicName().equals(path.getName())) { String ver = path.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); if (ver != null) { VersionRange v = VersionRange.parseVersionRange(ver); if (v.contains(hostBundle.getVersion())) { toRefresh.add(hostBundle); } } else { toRefresh.add(hostBundle); } } } } } } } }
protected void findBundlesWithFramentsToRefresh(Set<Bundle> toRefresh) { for (Bundle b : toRefresh) { if (b.getState() != Bundle.UNINSTALLED) { String hostHeader = (String) b.getHeaders().get(Constants.FRAGMENT_HOST); if (hostHeader != null) { Clause[] clauses = Parser.parseHeader(hostHeader); if (clauses != null && clauses.length > 0) { Clause path = clauses[0]; for (Bundle hostBundle : bundleContext.getBundles()) { if (hostBundle.getSymbolicName().equals(path.getName())) { String ver = path.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); if (ver != null) { VersionRange v = VersionRange.parseVersionRange(ver); if (v.contains(hostBundle.getVersion())) { toRefresh.add(hostBundle); } } else { toRefresh.add(hostBundle); } } } } } } } }
protected void findBundlesWithFragmentsToRefresh(Set<Bundle> toRefresh) { Set<Bundle> fragments = new HashSet<Bundle>(); Set<Bundle> bundles = getScopedBundles(fragmentScope); for (Bundle b : toRefresh) { if (b.getState() != Bundle.UNINSTALLED) { String hostHeader = b.getHeaders().get(Constants.FRAGMENT_HOST); if (hostHeader != null) { Clause[] clauses = Parser.parseHeader(hostHeader); if (clauses != null && clauses.length > 0) { Clause path = clauses[0]; for (Bundle hostBundle : bundles) { if (hostBundle.getSymbolicName() != null && hostBundle.getSymbolicName().equals(path.getName())) { String ver = path.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); if (ver != null) { VersionRange v = VersionRange.parseVersionRange(ver); if (v.contains(VersionTable.getVersion(hostBundle.getHeaders().get(Constants.BUNDLE_VERSION)))) { fragments.add(hostBundle); } } else { fragments.add(hostBundle); } } } } } } } toRefresh.addAll(fragments); }
Clause[] c = org.apache.felix.utils.manifest.Parser.parseClauses(new String[] { originalId }); nameString = c[0].getName(); versionString = c[0].getAttribute(RANGE);
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkBundle(clause.getName(), clause.getAttribute("version")); Ansi.ansi(output).fg(isSatisfied ? Ansi.Color.DEFAULT : Ansi.Color.RED).a(""); } public void post(Clause clause, StringBuilder output) {
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkBundle(clause.getName(), clause.getAttribute("version")); Ansi.ansi(output).fg(isSatisfied ? Ansi.Color.DEFAULT : Ansi.Color.RED).a(""); }
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkBundle(clause.getName(), clause.getAttribute("version")); Ansi.ansi(output).fg(isSatisfied ? Ansi.Color.DEFAULT : Ansi.Color.RED).a(""); }
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkPackage(clause.getName(), clause.getAttribute("version")); boolean isOptional = "optional".equals(clause.getDirective("resolution")); Ansi.ansi(output).fg(isSatisfied ? Ansi.Color.DEFAULT : Ansi.Color.RED) .a(isSatisfied || isOptional ? Ansi.Attribute.INTENSITY_BOLD_OFF : Ansi.Attribute.INTENSITY_BOLD) .a(""); } public void post(Clause clause, StringBuilder output) {
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkPackage(clause.getName(), clause.getAttribute("version")); boolean isOptional = "optional".equals(clause.getDirective("resolution")); Ansi.ansi(output).fg(isSatisfied ? Ansi.Color.DEFAULT : Ansi.Color.RED) .a(isSatisfied || isOptional ? Ansi.Attribute.INTENSITY_BOLD_OFF : Ansi.Attribute.INTENSITY_BOLD) .a(""); }
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkPackage(clause.getName(), clause.getAttribute("version")); boolean isOptional = "optional".equals(clause.getDirective("resolution")); Ansi.ansi(output).fg(isSatisfied ? Ansi.Color.DEFAULT : Ansi.Color.RED) .a(isSatisfied || isOptional ? Ansi.Attribute.INTENSITY_BOLD_OFF : Ansi.Attribute.INTENSITY_BOLD) .a(""); }
private boolean isSatisfied( Clause imported, ExportedPackage exported ) { if ( imported.getName().equals( exported.getName() ) ) { String versionAttr = imported.getAttribute( Constants.VERSION_ATTRIBUTE ); if ( versionAttr == null ) { // no specific version required, this export surely satisfies it return true; } VersionRange required = VersionRange.parse( versionAttr ); return required.isInRange( exported.getVersion() ); } // no this export does not satisfy the import return false; }
private boolean isSatisfied( Clause imported, ExportedPackage exported ) { if ( imported.getName().equals( exported.getName() ) ) { String versionAttr = imported.getAttribute( Constants.VERSION_ATTRIBUTE ); if ( versionAttr == null ) { // no specific version required, this export surely satisfies it return true; } VersionRange required = VersionRange.parse( versionAttr ); return required.isInRange( exported.getVersion() ); } // no this export does not satisfy the import return false; }
private void createNodeForImport(Node<Bundle> node, Bundle bundle, Clause i) { VersionRange range = VersionRange.parseVersionRange(i.getAttribute(Constants.VERSION_ATTRIBUTE)); boolean foundMatch = false; for (Bundle b : bundleContext.getBundles()) { BundleWiring wiring = b.adapt(BundleWiring.class); if (wiring != null) { List<BundleCapability> caps = wiring.getCapabilities(BundleRevision.PACKAGE_NAMESPACE); if (caps != null) { for (BundleCapability cap : caps) { String n = getAttribute(cap, BundleRevision.PACKAGE_NAMESPACE); String v = getAttribute(cap, Constants.VERSION_ATTRIBUTE); if (i.getName().equals(n) && range.contains(VersionTable.getVersion(v))) { boolean existing = tree.flatten().contains(b); System.out.printf("- import %s: resolved using %s%n", i, b); foundMatch = true; if (!node.hasChild(b)) { Node<Bundle> child = node.addChild(b); if (!existing) { createNode(child); } } } } } } } if (!foundMatch) { System.out.printf("- import %s: WARNING - unable to find matching export%n", i); } }