Search in sources :

Example 41 with ResourceBuilder

use of aQute.bnd.osgi.resource.ResourceBuilder in project bnd by bndtools.

the class AugmentRepository method executeAugmentOperations.

private void executeAugmentOperations(Map<Requirement, Collection<Capability>> allBundles, Requirement bundleRequirement, List<Augment> augments) throws Exception {
    Collection<Capability> matchedBundleCapabilities = allBundles.get(bundleRequirement);
    Collection<Resource> bundles = ResourceUtils.getResources(matchedBundleCapabilities);
    for (Resource bundle : bundles) {
        ResourceBuilder wrappedBundleBuilder = new ResourceBuilder();
        Map<Capability, Capability> originalToWrapper = wrappedBundleBuilder.from(bundle);
        wrapped.putAll(originalToWrapper);
        List<Augment> bundleAugments = augments;
        for (Augment augment : bundleAugments) {
            List<Capability> addedCapabilities = augment(augment, wrappedBundleBuilder);
            augmentedCapabilities.addAll(addedCapabilities);
        }
        Resource wrappedBundle = wrappedBundleBuilder.build();
        augmentedBundles.add(wrappedBundle);
    }
}
Also used : ResourceBuilder(aQute.bnd.osgi.resource.ResourceBuilder) Capability(org.osgi.resource.Capability) Resource(org.osgi.resource.Resource)

Aggregations

ResourceBuilder (aQute.bnd.osgi.resource.ResourceBuilder)41 Resource (org.osgi.resource.Resource)22 File (java.io.File)13 CapReqBuilder (aQute.bnd.osgi.resource.CapReqBuilder)8 Capability (org.osgi.resource.Capability)8 Requirement (org.osgi.resource.Requirement)8 Parameters (aQute.bnd.header.Parameters)6 ResourcesRepository (aQute.bnd.osgi.repository.ResourcesRepository)6 Version (org.osgi.framework.Version)6 Domain (aQute.bnd.osgi.Domain)5 Resolution (biz.aQute.resolve.ResolverValidator.Resolution)5 HashSet (java.util.HashSet)5 IOException (java.io.IOException)4 URI (java.net.URI)4 ArrayList (java.util.ArrayList)4 Processor (aQute.bnd.osgi.Processor)3 HashMap (java.util.HashMap)3 List (java.util.List)3 VersionedClause (aQute.bnd.build.model.clauses.VersionedClause)2 Referral (aQute.bnd.deployer.repository.api.Referral)2