use of org.apache.aries.subsystem.core.archive.RequireBundleHeader in project aries by apache.
the class Aries1421Test method testRequireBundleVersionRanges.
@Test
public void testRequireBundleVersionRanges() throws Exception {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
Bundle bundleA = getConstituentAsBundle(applicationA, BUNDLE_A, null, null);
String expectedStr = bundleA.getHeaders().get(Constants.REQUIRE_BUNDLE);
RequireBundleHeader expected = new RequireBundleHeader(expectedStr);
Map<String, String> headers = ((BasicSubsystem) applicationA).getDeploymentHeaders();
String actualStr = headers.get(Constants.REQUIRE_BUNDLE);
RequireBundleHeader actual = new RequireBundleHeader(actualStr);
assertEquals("Wrong header", expected, actual);
} finally {
uninstallSubsystemSilently(applicationA);
}
}
use of org.apache.aries.subsystem.core.archive.RequireBundleHeader in project aries by apache.
the class SubsystemResource method setImportIsolationPolicy.
private void setImportIsolationPolicy(RegionFilterBuilder builder, RequireBundleHeader header) throws InvalidSyntaxException {
if (header == null)
return;
for (RequireBundleHeader.Clause clause : header.getClauses()) {
RequireBundleRequirement requirement = new RequireBundleRequirement(clause, this);
String policy = RegionFilter.VISIBLE_REQUIRE_NAMESPACE;
String filter = requirement.getDirectives().get(RequireBundleRequirement.DIRECTIVE_FILTER);
builder.allow(policy, filter);
}
}
use of org.apache.aries.subsystem.core.archive.RequireBundleHeader in project aries by apache.
the class RawSubsystemResource method computeRequireBundleHeader.
private RequireBundleHeader computeRequireBundleHeader() {
if (requirements.isEmpty())
return null;
ArrayList<RequireBundleHeader.Clause> clauses = new ArrayList<RequireBundleHeader.Clause>(requirements.size());
for (Requirement requirement : requirements) {
if (!BundleNamespace.BUNDLE_NAMESPACE.equals(requirement.getNamespace()))
continue;
clauses.add(RequireBundleHeader.Clause.valueOf(requirement));
}
if (clauses.isEmpty())
return null;
clauses.trimToSize();
return new RequireBundleHeader(clauses);
}
Aggregations