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