Search in sources :

Example 1 with Clause

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

the class RawSubsystemResource method computeFileCapabilities.

private List<Capability> computeFileCapabilities(FileResource resource, IFile file, SubsystemManifest manifest) {
    SubsystemContentHeader ssch = manifest.getSubsystemContentHeader();
    if (ssch == null)
        return Collections.emptyList();
    for (Clause c : ssch.getClauses()) {
        Attribute er = c.getAttribute(ContentHandler.EMBEDDED_RESOURCE_ATTRIBUTE);
        if (er != null) {
            if (file.getName().equals(er.getValue())) {
                Map<String, Object> attrs = new HashMap<String, Object>();
                attrs.put(ContentHandler.EMBEDDED_RESOURCE_ATTRIBUTE, er.getValue());
                return Collections.<Capability>singletonList(new OsgiIdentityCapability(resource, c.getSymbolicName(), c.getVersionRange().getLeft(), c.getType(), attrs));
            }
        }
    }
    return Collections.emptyList();
}
Also used : SubsystemContentHeader(org.apache.aries.subsystem.core.archive.SubsystemContentHeader) Capability(org.osgi.resource.Capability) Attribute(org.apache.aries.subsystem.core.archive.Attribute) HashMap(java.util.HashMap) Clause(org.apache.aries.subsystem.core.archive.SubsystemContentHeader.Clause)

Aggregations

HashMap (java.util.HashMap)1 Attribute (org.apache.aries.subsystem.core.archive.Attribute)1 SubsystemContentHeader (org.apache.aries.subsystem.core.archive.SubsystemContentHeader)1 Clause (org.apache.aries.subsystem.core.archive.SubsystemContentHeader.Clause)1 Capability (org.osgi.resource.Capability)1