Search in sources :

Example 1 with Header

use of org.apache.aries.subsystem.core.archive.Header 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);
    }
}
Also used : DeploymentManifest(org.apache.aries.subsystem.core.archive.DeploymentManifest) SubsystemException(org.osgi.service.subsystem.SubsystemException) DeployedContentHeader(org.apache.aries.subsystem.core.archive.DeployedContentHeader) ArrayList(java.util.ArrayList) URISyntaxException(java.net.URISyntaxException) BundleException(org.osgi.framework.BundleException) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) ResolutionException(org.osgi.service.resolver.ResolutionException) SubsystemException(org.osgi.service.subsystem.SubsystemException) IOException(java.io.IOException) SubsystemTypeHeader(org.apache.aries.subsystem.core.archive.SubsystemTypeHeader) SubsystemContentHeader(org.apache.aries.subsystem.core.archive.SubsystemContentHeader) ProvisionResourceHeader(org.apache.aries.subsystem.core.archive.ProvisionResourceHeader) AriesSubsystemParentsHeader(org.apache.aries.subsystem.core.archive.AriesSubsystemParentsHeader) Header(org.apache.aries.subsystem.core.archive.Header) DeployedContentHeader(org.apache.aries.subsystem.core.archive.DeployedContentHeader)

Aggregations

IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 AriesSubsystemParentsHeader (org.apache.aries.subsystem.core.archive.AriesSubsystemParentsHeader)1 DeployedContentHeader (org.apache.aries.subsystem.core.archive.DeployedContentHeader)1 DeploymentManifest (org.apache.aries.subsystem.core.archive.DeploymentManifest)1 Header (org.apache.aries.subsystem.core.archive.Header)1 ProvisionResourceHeader (org.apache.aries.subsystem.core.archive.ProvisionResourceHeader)1 SubsystemContentHeader (org.apache.aries.subsystem.core.archive.SubsystemContentHeader)1 SubsystemTypeHeader (org.apache.aries.subsystem.core.archive.SubsystemTypeHeader)1 BundleException (org.osgi.framework.BundleException)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1 ResolutionException (org.osgi.service.resolver.ResolutionException)1 SubsystemException (org.osgi.service.subsystem.SubsystemException)1