예제 #1
0
 public static AuthorityIndexingService getIndexingService(ServiceManager serviceManager) {
   if (indexingService == null) {
     indexingService =
         serviceManager.getServiceByName(
             AuthorityIndexingService.class.getName(), AuthorityIndexingService.class);
   }
   return indexingService;
 }
예제 #2
0
 /**
  * Construct a provider holder with all currently known providers of the given type.
  *
  * @param serviceManager the system service manager
  * @param providerType the interface type of the providers we care about
  */
 public ProviderStack(ServiceManager serviceManager, Class<T> providerType) {
   providers = Collections.synchronizedList(new ArrayList<ProviderHolder<T>>());
   List<T> foundProviders = serviceManager.getServicesByType(providerType);
   // filter out the NotProviders first
   for (Iterator<T> iterator = foundProviders.iterator(); iterator.hasNext(); ) {
     T t = iterator.next();
     if (t instanceof NotProvider) {
       iterator.remove();
     }
   }
   Collections.sort(foundProviders, new OrderedServiceComparator());
   for (T t : foundProviders) {
     providers.add(new ProviderHolder<T>(t));
   }
 }