*/
public synchronized SortedSet<BundleCapability> getCandidates(BundleRequirement req, boolean obeyMandatory) {
// BundleRevision reqRevision = req.getRevision();
SortedSet<BundleCapability> result = new TreeSet<BundleCapability>(new CandidateComparator());
CapabilitySet capSet = m_capSets.get(req.getNamespace());
if (capSet != null) {
// Get the requirement's filter; if this is our own impl we
// have a shortcut to get the already parsed filter, otherwise
// we must parse it from the directive.
SimpleFilter sf = null;
if (req instanceof BundleRequirementImpl) {
sf = ((BundleRequirementImpl) req).getFilter();
} else {
String filter = req.getDirectives().get(
Constants.FILTER_DIRECTIVE);
if (filter == null) {
sf = new SimpleFilter(null, null, SimpleFilter.MATCH_ALL);
} else {
sf = SimpleFilter.parse(filter);
}
}
// Find the matching candidates.
Set<BundleCapability> matches = capSet.match(sf, obeyMandatory);
for (BundleCapability cap : matches) {
/* TODO: karl - is this correct?
* if (System.getSecurityManager() != null) {
if (req.getNamespace().equals(
BundleRevision.PACKAGE_NAMESPACE)