private static Resource findResolvedProvider(Wire wire, Set<Resource> resources, AbstractResolveContext rc) { // Make sure not to add new resources into the result. The resolver // already created the closure of all the needed resources. We need to // find the key in the result that already provides the capability // defined by this wire. Capability capability = wire.getCapability(); Resource resource = capability.getResource(); if (rc.isSystemResource(resource) || (ResourceUtils.isFragment(resource) && resources.contains(resource))) { return resource; } for (Resource resolved : resources) { for (Capability resolvedCap : resolved.getCapabilities(capability.getNamespace())) { if (ResourceUtils.matches(wire.getRequirement(), resolvedCap)) { return resolved; } } } // It shouldn't be possible to arrive here! throw new IllegalStateException( Strings.format("The capability for wire %s was not associated with a resource in the resolution", wire)); }
private static Resource findResolvedProvider(Wire wire, Set<Resource> resources, AbstractResolveContext rc) { // Make sure not to add new resources into the result. The resolver // already created the closure of all the needed resources. We need to // find the key in the result that already provides the capability // defined by this wire. Capability capability = wire.getCapability(); Resource resource = capability.getResource(); if (rc.isSystemResource(resource) || (ResourceUtils.isFragment(resource) && resources.contains(resource))) { return resource; } for (Resource resolved : resources) { for (Capability resolvedCap : resolved.getCapabilities(capability.getNamespace())) { if (ResourceUtils.matches(wire.getRequirement(), resolvedCap)) { return resolved; } } } // It shouldn't be possible to arrive here! throw new IllegalStateException( Strings.format("The capability for wire %s was not associated with a resource in the resolution", wire)); }