code: public static ServiceReference getClassServiceReference(BundleContext context, String interfaceClassName, String versionRange, Dictionary<String, String> filter)
      {
          try {
              String serviceFilter = null;//ClassServiceUtility.addToFilter((String)null, BundleActivatorModel.PACKAGE_NAME, ClassFinderActivator.getPackageName(className, true));
              String interfaceName = null;
              if (filter != null)
              {
                  interfaceName = filter.get(BundleConstants.INTERFACE);
  
                  Enumeration<String> keys = filter.keys();
                  while (keys.hasMoreElements())
                  {
                      String key = keys.nextElement();
                      if (key.equals(BundleConstants.INTERFACE))
                          continue;
                      serviceFilter = ClassServiceUtility.addToFilter(serviceFilter, key, filter.get(key));
                  }
              }
              if (interfaceName == null)
                  interfaceName = interfaceClassName;
              serviceFilter = ClassFinderActivator.addVersionFilter(serviceFilter, versionRange);
              ServiceReference[] refs = null;
              if (context != null)
                  refs = context.getServiceReferences(interfaceName, serviceFilter);
  
              if ((refs != null) && (refs.length > 0))
                  return refs[0];
          } catch (InvalidSyntaxException e) {
              e.printStackTrace();
          }
          return null;
      }
docs: Find this class's class access registered class access service in the current workspace.
  @param context
  @param interfaceClassName
  @param versionRange
  @param filter
  @return