class BloombergJmsTopicNameResolver extends AbstractResolver<JmsTopicNameResolveRequest, String> implements JmsTopicNameResolver {

  @Override
  public Map<JmsTopicNameResolveRequest, String> resolve(Collection<JmsTopicNameResolveRequest> requests) {
    Map<JmsTopicNameResolveRequest, String> returnValue = new HashMap<JmsTopicNameResolveRequest, String>();

    Map<String, Collection<JmsTopicNameResolveRequest>> lookupKey2Requests = new HashMap<String, Collection<JmsTopicNameResolveRequest>>();
    
    for (JmsTopicNameResolveRequest request : requests) {
      ExternalId marketDataUniqueId = request.getMarketDataUniqueId();
      if (!marketDataUniqueId.getScheme().equals(ExternalSchemes.BLOOMBERG_BUID)) {
        s_logger.info("No Bloomberg BUID found, was given: " + marketDataUniqueId);
        returnValue.put(request, null);
        continue;
      }
      
      String lookupKey = BloombergDomainIdentifierResolver.toBloombergKey(marketDataUniqueId);
      
      Collection<JmsTopicNameResolveRequest> requestsForLookupKey = lookupKey2Requests.get(lookupKey);
      if (requestsForLookupKey == null) {
        requestsForLookupKey = new ArrayList<JmsTopicNameResolveRequest>();
        lookupKey2Requests.put(lookupKey, requestsForLookupKey);
      }
      requestsForLookupKey.add(request);
    }
    
    if (!lookupKey2Requests.keySet().isEmpty()) {
      ReferenceDataProviderGetRequest rdRequest = ReferenceDataProviderGetRequest.createGet(
          lookupKey2Requests.keySet(), BloombergConstants.JMS_TOPIC_NAME_RESOLVER_FIELDS, true);
      ReferenceDataProviderGetResult referenceData = _referenceDataProvider.getReferenceData(rdRequest);
      
      for (Map.Entry<String, Collection<JmsTopicNameResolveRequest>> entry : lookupKey2Requests.entrySet()) {
        String lookupKey = entry.getKey();
        ReferenceData result = referenceData.getReferenceDataOrNull(lookupKey);
        
        for (JmsTopicNameResolveRequest request : entry.getValue()) {
          String jmsTopicName = getJmsTopicName(request, result);
          returnValue.put(request, jmsTopicName);
        }
      }
    }
    
    return returnValue;
  }

  public  BloombergJmsTopicNameResolver(ReferenceDataProvider referenceDataProvider);

}