use of org.apache.aries.subsystem.core.archive.DeployedContentHeader in project aries by apache.
the class Aries1425Test method testDeployedContentHeader.
@Test
public void testDeployedContentHeader() throws Exception {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
Map<String, String> headers = applicationA.getDeploymentHeaders();
String header = headers.get(SubsystemConstants.DEPLOYED_CONTENT);
DeployedContentHeader dch = new DeployedContentHeader(header);
boolean foundClause = false;
for (DeployedContentHeader.Clause clause : dch.getClauses()) {
if (BUNDLE_A.equals(clause.getSymbolicName())) {
assertEquals("Wrong type", IdentityNamespace.TYPE_FRAGMENT, clause.getType());
foundClause = true;
break;
}
}
assertTrue("Missing clause", foundClause);
} finally {
uninstallSubsystemSilently(applicationA);
}
}
use of org.apache.aries.subsystem.core.archive.DeployedContentHeader in project aries by apache.
the class BasicSubsystem method removedContent.
synchronized void removedContent(Collection<DeployedContentHeader.Clause> content) {
DeploymentManifest manifest = getDeploymentManifest();
DeployedContentHeader header = manifest.getDeployedContentHeader();
if (header == null)
return;
Collection<DeployedContentHeader.Clause> clauses = new ArrayList<DeployedContentHeader.Clause>(header.getClauses());
for (Iterator<DeployedContentHeader.Clause> i = clauses.iterator(); i.hasNext(); ) if (content.contains(i.next())) {
i.remove();
break;
}
DeploymentManifest.Builder builder = new DeploymentManifest.Builder();
for (Entry<String, Header<?>> entry : manifest.getHeaders().entrySet()) {
if (DeployedContentHeader.NAME.equals(entry.getKey()))
continue;
builder.header(entry.getValue());
}
if (!clauses.isEmpty())
builder.header(new DeployedContentHeader(clauses));
try {
setDeploymentManifest(builder.build());
} catch (Exception e) {
throw new SubsystemException(e);
}
}
use of org.apache.aries.subsystem.core.archive.DeployedContentHeader in project aries by apache.
the class BasicSubsystem method removedContent.
void removedContent(Resource resource) {
DeploymentManifest manifest = getDeploymentManifest();
DeployedContentHeader header = manifest.getDeployedContentHeader();
if (header == null)
return;
DeployedContentHeader.Clause clause = header.getClause(resource);
if (clause == null)
return;
removedContent(Collections.singleton(clause));
}
Aggregations