Search in sources :

Example 1 with CapabilityIndex

use of aQute.bnd.deployer.repository.CapabilityIndex in project bndtools by bndtools.

the class WorkspaceR5Repository method findProviders.

@Override
public Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements) {
    Map<Requirement, Collection<Capability>> result = new HashMap<Requirement, Collection<Capability>>();
    for (Requirement requirement : requirements) {
        List<Capability> matches = new LinkedList<Capability>();
        result.put(requirement, matches);
        for (Entry<IProject, CapabilityIndex> entry : projectMap.entrySet()) {
            IProject project = entry.getKey();
            if (project.exists() && project.isOpen()) {
                CapabilityIndex capabilityIndex = entry.getValue();
                capabilityIndex.appendMatchingCapabilities(requirement, matches);
            }
        }
    }
    return result;
}
Also used : Requirement(org.osgi.resource.Requirement) Capability(org.osgi.resource.Capability) HashMap(java.util.HashMap) Collection(java.util.Collection) LinkedList(java.util.LinkedList) IProject(org.eclipse.core.resources.IProject) CapabilityIndex(aQute.bnd.deployer.repository.CapabilityIndex)

Example 2 with CapabilityIndex

use of aQute.bnd.deployer.repository.CapabilityIndex in project bndtools by bndtools.

the class WorkspaceR5Repository method addResource.

private void addResource(IProject project, Resource resource) {
    CapabilityIndex index = projectMap.get(project);
    if (index == null) {
        index = new CapabilityIndex();
        projectMap.put(project, index);
    }
    index.addResource(resource);
}
Also used : CapabilityIndex(aQute.bnd.deployer.repository.CapabilityIndex)

Aggregations

CapabilityIndex (aQute.bnd.deployer.repository.CapabilityIndex)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 IProject (org.eclipse.core.resources.IProject)1 Capability (org.osgi.resource.Capability)1 Requirement (org.osgi.resource.Requirement)1