Search in sources :

Example 6 with DeploymentManifest

use of org.apache.aries.subsystem.core.archive.DeploymentManifest 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));
}
Also used : DeploymentManifest(org.apache.aries.subsystem.core.archive.DeploymentManifest) DeployedContentHeader(org.apache.aries.subsystem.core.archive.DeployedContentHeader)

Example 7 with DeploymentManifest

use of org.apache.aries.subsystem.core.archive.DeploymentManifest 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)

Example 8 with DeploymentManifest

use of org.apache.aries.subsystem.core.archive.DeploymentManifest in project aries by apache.

the class BasicSubsystem method getDeploymentManifestHeaderValue.

private String getDeploymentManifestHeaderValue(String name) {
    DeploymentManifest manifest = getDeploymentManifest();
    if (manifest == null)
        return null;
    Header<?> header = manifest.getHeaders().get(name);
    if (header == null)
        return null;
    return header.getValue();
}
Also used : DeploymentManifest(org.apache.aries.subsystem.core.archive.DeploymentManifest)

Example 9 with DeploymentManifest

use of org.apache.aries.subsystem.core.archive.DeploymentManifest in project aries by apache.

the class Utils method isDependency.

public static boolean isDependency(BasicSubsystem subsystem, Resource resource) {
    DeploymentManifest manifest = subsystem.getDeploymentManifest();
    if (manifest == null)
        return false;
    ProvisionResourceHeader header = manifest.getProvisionResourceHeader();
    if (header == null)
        return false;
    return header.contains(resource);
}
Also used : DeploymentManifest(org.apache.aries.subsystem.core.archive.DeploymentManifest) ProvisionResourceHeader(org.apache.aries.subsystem.core.archive.ProvisionResourceHeader)

Aggregations

DeploymentManifest (org.apache.aries.subsystem.core.archive.DeploymentManifest)9 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 DeployedContentHeader (org.apache.aries.subsystem.core.archive.DeployedContentHeader)2 ProvisionResourceHeader (org.apache.aries.subsystem.core.archive.ProvisionResourceHeader)2 SubsystemContentHeader (org.apache.aries.subsystem.core.archive.SubsystemContentHeader)2 BundleException (org.osgi.framework.BundleException)2 SubsystemException (org.osgi.service.subsystem.SubsystemException)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 URISyntaxException (java.net.URISyntaxException)1 LinkedHashSet (java.util.LinkedHashSet)1 AriesSubsystemParentsHeader (org.apache.aries.subsystem.core.archive.AriesSubsystemParentsHeader)1 Header (org.apache.aries.subsystem.core.archive.Header)1 SubsystemTypeHeader (org.apache.aries.subsystem.core.archive.SubsystemTypeHeader)1 SubsystemTest (org.apache.aries.subsystem.itests.SubsystemTest)1 Test (org.junit.Test)1 Bundle (org.osgi.framework.Bundle)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1 Resource (org.osgi.resource.Resource)1