String searchedPackageName = "org.apache.camel.component.file.remote.strategy"; Manifest manifest = new Manifest(streamOfTheManifest); String exportPackageHeader = manifest.getMainAttributes().getValue("Export-Package"); // Parser and clause comes from org.apache.felix.utils.manifest package Clause[] clauses = Parser.parseHeader(exportPackageHeader); for (Clause exportPackageClause : clauses) { String exportedPackageName = exportPackageClause.getName(); if (searchedPackageName.equals(exportedPackageName) { // Do your stuff here } }
public static String extractUrl(String override) { Clause[] cs = Parser.parseClauses(new String[]{override}); if (cs.length != 1) { throw new IllegalStateException("Override contains more than one clause: " + override); } return cs[0].getName(); }
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 static boolean matches(Clause requirement, Clause export) { if (requirement.getName().equals(export.getName())) { VersionRange importVersionRange = getVersionRange(requirement); VersionRange exportVersionRange = getVersionRange(export); VersionRange intersection = importVersionRange.intersect(exportVersionRange); return intersection != null; } return false; }
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) {
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) {
public static boolean matches(Clause requirement, Clause export) { if (requirement.getName().equals(export.getName())) { VersionRange importVersionRange = getVersionRange(requirement); VersionRange exportVersionRange = getVersionRange(export); VersionRange intersection = importVersionRange.intersect(exportVersionRange); return intersection != null; } return false; }
private void createNodesForImports(Node<Bundle> node, Bundle bundle) { Clause[] imports = Parser.parseHeader(bundle.getHeaders().get("Import-Package")); Clause[] exports = Parser.parseHeader(bundle.getHeaders().get("Export-Package")); for (Clause i : imports) { boolean exported = false; for (Clause e : exports) { if (e.getName().equals(i.getName())) { exported = true; break; } } if (!exported) { createNodeForImport(node, bundle, i); } } }
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 = 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(""); }
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; }
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(""); }