Search in sources :

Example 1 with SubsystemManifest

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

the class RawSubsystemResource method computeSubsystemManifestBeforeRequirements.

private SubsystemManifest computeSubsystemManifestBeforeRequirements(IDirectory content, SubsystemManifest manifest) throws MalformedURLException {
    SubsystemManifest.Builder builder = new SubsystemManifest.Builder().manifest(manifest);
    addSubsystemSymbolicNameHeader(builder, manifest);
    addSubsystemVersionHeader(builder, manifest);
    addSubsystemTypeHeader(builder, manifest);
    addSubsystemContentHeader(builder, manifest);
    builder.header(new GenericHeader(Constants.AriesSubsystemOriginalContent, String.valueOf(content.toURL())));
    return builder.build();
}
Also used : SubsystemManifest(org.apache.aries.subsystem.core.archive.SubsystemManifest) GenericHeader(org.apache.aries.subsystem.core.archive.GenericHeader)

Example 2 with SubsystemManifest

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

the class ResolveContext method isAcceptDependencies.

private boolean isAcceptDependencies() {
    SubsystemManifest manifest = resource.getSubsystemManifest();
    SubsystemTypeHeader header = manifest.getSubsystemTypeHeader();
    ProvisionPolicyDirective directive = header.getProvisionPolicyDirective();
    return directive.isAcceptDependencies();
}
Also used : SubsystemManifest(org.apache.aries.subsystem.core.archive.SubsystemManifest) ProvisionPolicyDirective(org.apache.aries.subsystem.core.archive.ProvisionPolicyDirective) SubsystemTypeHeader(org.apache.aries.subsystem.core.archive.SubsystemTypeHeader)

Example 3 with SubsystemManifest

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

the class BasicSubsystem method wasInstalledWithChildrenHavingProvisionDependenciesResolve.

private static boolean wasInstalledWithChildrenHavingProvisionDependenciesResolve(Subsystem child) {
    BasicSubsystem bs = (BasicSubsystem) child;
    SubsystemManifest manifest = bs.getSubsystemManifest();
    SubsystemTypeHeader header = manifest.getSubsystemTypeHeader();
    AriesProvisionDependenciesDirective directive = header.getAriesProvisionDependenciesDirective();
    if (directive.isResolve()) {
        return true;
    }
    return wasInstalledWithChildrenHavingProvisionDependenciesResolve(child.getChildren());
}
Also used : SubsystemManifest(org.apache.aries.subsystem.core.archive.SubsystemManifest) AriesProvisionDependenciesDirective(org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective) SubsystemTypeHeader(org.apache.aries.subsystem.core.archive.SubsystemTypeHeader)

Example 4 with SubsystemManifest

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

the class BasicSubsystem method getRequirements.

@Override
public List<Requirement> getRequirements(String namespace) {
    // First, add the requirements from the manifest.
    SubsystemManifest manifest = getSubsystemManifest();
    List<Requirement> result = manifest.toRequirements(this);
    if (namespace != null)
        for (Iterator<Requirement> i = result.iterator(); i.hasNext(); ) if (!i.next().getNamespace().equals(namespace))
            i.remove();
    if (isScoped())
        return result;
    SubsystemContentHeader header = manifest.getSubsystemContentHeader();
    for (Resource constituent : getConstituents()) if (header.contains(constituent))
        for (Requirement requirement : constituent.getRequirements(namespace)) result.add(new BasicRequirement(requirement, this));
    return result;
}
Also used : SubsystemContentHeader(org.apache.aries.subsystem.core.archive.SubsystemContentHeader) Requirement(org.osgi.resource.Requirement) SubsystemManifest(org.apache.aries.subsystem.core.archive.SubsystemManifest) Iterator(java.util.Iterator) Resource(org.osgi.resource.Resource)

Example 5 with SubsystemManifest

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

the class BasicSubsystem method getCapabilities.

@Override
public List<Capability> getCapabilities(String namespace) {
    // First, add the capabilities from the manifest.
    SubsystemManifest manifest = getSubsystemManifest();
    List<Capability> result = manifest.toCapabilities(this);
    if (namespace != null)
        for (Iterator<Capability> i = result.iterator(); i.hasNext(); ) if (!i.next().getNamespace().equals(namespace))
            i.remove();
    // in FeatureTest.testSharedContent() under certain conditions.
    if (isScoped() || IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace))
        return result;
    SubsystemContentHeader header = manifest.getSubsystemContentHeader();
    for (Resource constituent : getConstituents()) {
        if (header.contains(constituent)) {
            for (Capability capability : constituent.getCapabilities(namespace)) {
                if (namespace == null && (IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getNamespace()) || HostNamespace.HOST_NAMESPACE.equals(capability.getNamespace()))) {
                    // is null.
                    continue;
                }
                result.add(new BasicCapability(capability, this));
            }
        }
    }
    return result;
}
Also used : SubsystemContentHeader(org.apache.aries.subsystem.core.archive.SubsystemContentHeader) SubsystemManifest(org.apache.aries.subsystem.core.archive.SubsystemManifest) Capability(org.osgi.resource.Capability) Iterator(java.util.Iterator) Resource(org.osgi.resource.Resource)

Aggregations

SubsystemManifest (org.apache.aries.subsystem.core.archive.SubsystemManifest)9 SubsystemContentHeader (org.apache.aries.subsystem.core.archive.SubsystemContentHeader)4 SubsystemTypeHeader (org.apache.aries.subsystem.core.archive.SubsystemTypeHeader)3 Resource (org.osgi.resource.Resource)3 Iterator (java.util.Iterator)2 AriesProvisionDependenciesDirective (org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective)2 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 GenericHeader (org.apache.aries.subsystem.core.archive.GenericHeader)1 ProvisionPolicyDirective (org.apache.aries.subsystem.core.archive.ProvisionPolicyDirective)1 SubsystemLocalizationHeader (org.apache.aries.subsystem.core.archive.SubsystemLocalizationHeader)1 IFile (org.apache.aries.util.filesystem.IFile)1 Region (org.eclipse.equinox.region.Region)1 Capability (org.osgi.resource.Capability)1 Requirement (org.osgi.resource.Requirement)1