Search in sources :

Example 11 with SubsystemContentHeader

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

the class ResolveContext method isValid.

private boolean isValid(Capability capability, Requirement requirement) throws BundleException, IOException, InvalidSyntaxException, URISyntaxException {
    if (IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getNamespace()))
        return true;
    Resource provider = capability.getResource();
    Resource requirer = requirement.getResource();
    SubsystemManifest manifest = resource.getSubsystemManifest();
    SubsystemContentHeader header = manifest.getSubsystemContentHeader();
    if (header.contains(provider) && header.contains(requirer)) {
        // are in the same region and the capability will be visible.
        return true;
    }
    Region from = findRegionForCapabilityValidation(provider);
    Region to = findRegionForCapabilityValidation(requirer);
    return new SharingPolicyValidator(from, to).isValid(capability);
}
Also used : SubsystemContentHeader(org.apache.aries.subsystem.core.archive.SubsystemContentHeader) SubsystemManifest(org.apache.aries.subsystem.core.archive.SubsystemManifest) Resource(org.osgi.resource.Resource) Region(org.eclipse.equinox.region.Region)

Example 12 with SubsystemContentHeader

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

the class Utils method isContent.

/*
	 * The Deployed-Content header in the deployment manifest is used to store
	 * information about explicitly installed resources and provisioned
	 * dependencies in addition to content for persistence purposes. This method
	 * returns true only if the resource is "true" content of the subsystem and,
	 * therefore, uses the Subsystem-Content header from the subsystem manifest.
	 */
public static boolean isContent(BasicSubsystem subsystem, Resource resource) {
    SubsystemManifest subsystemManifest = subsystem.getSubsystemManifest();
    if (subsystemManifest == null)
        return false;
    SubsystemContentHeader subsystemContentHeader = subsystemManifest.getSubsystemContentHeader();
    if (subsystemContentHeader == null)
        return false;
    return subsystemContentHeader.contains(resource);
}
Also used : SubsystemContentHeader(org.apache.aries.subsystem.core.archive.SubsystemContentHeader) SubsystemManifest(org.apache.aries.subsystem.core.archive.SubsystemManifest)

Example 13 with SubsystemContentHeader

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

the class SubsystemResource method addDependencies.

private void addDependencies(Resource resource, Map.Entry<Resource, List<Wire>> entry, Map<Resource, List<Wire>> resolution) {
    String type = ResourceHelper.getTypeAttribute(resource);
    SubsystemContentHeader contentHeader = getSubsystemManifest().getSubsystemContentHeader();
    if (// Do not include synthetic resources as dependencies.
    !Constants.ResourceTypeSynthesized.equals(type) && !contentHeader.contains(resource)) {
        // Do not include content as dependencies.
        addDependency(resource);
    }
}
Also used : SubsystemContentHeader(org.apache.aries.subsystem.core.archive.SubsystemContentHeader)

Aggregations

SubsystemContentHeader (org.apache.aries.subsystem.core.archive.SubsystemContentHeader)13 Resource (org.osgi.resource.Resource)8 SubsystemManifest (org.apache.aries.subsystem.core.archive.SubsystemManifest)4 Requirement (org.osgi.resource.Requirement)4 SubsystemException (org.osgi.service.subsystem.SubsystemException)4 ArrayList (java.util.ArrayList)3 Capability (org.osgi.resource.Capability)3 IOException (java.io.IOException)2 Iterator (java.util.Iterator)2 ImportPackageRequirement (org.apache.aries.subsystem.core.archive.ImportPackageRequirement)2 RequireBundleRequirement (org.apache.aries.subsystem.core.archive.RequireBundleRequirement)2 RequireCapabilityRequirement (org.apache.aries.subsystem.core.archive.RequireCapabilityRequirement)2 SubsystemImportServiceRequirement (org.apache.aries.subsystem.core.archive.SubsystemImportServiceRequirement)2 Region (org.eclipse.equinox.region.Region)2 BundleException (org.osgi.framework.BundleException)2 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Attribute (org.apache.aries.subsystem.core.archive.Attribute)1 DeploymentManifest (org.apache.aries.subsystem.core.archive.DeploymentManifest)1 GenericHeader (org.apache.aries.subsystem.core.archive.GenericHeader)1