code: private Object checkRegisteredServicesByLdapFilter(String filter) throws InvalidSyntaxException {
      ServiceReference<?>[] references = getBundleContext().getServiceReferences((String) null, filter);
      if (isEmptyOrNull(references)) {
        return null;
      }
      if (references.length == 1) {
        return getBundleContext().getService(references[0]);
      }
      throw new RuntimeException("Too many services registered for filter: " + filter);
    }
docs: Checks the OSGi ServiceRegistry if a service matching the given filter is
  present.
  
  @param filter
  the LDAP filter
  @return null if no service could be found or the service object
  @throws InvalidSyntaxException
  if the filter has an invalid syntax
  @throws RuntimeException
  if more than one service is found