To get List of dynamic java registered services based on service interface
Example: To get list of registered process Monitors
@param serviceInterface
@return
432960
public <T extends RegisteredService> List<T> getDynamicServices(Class<T> serviceInterface) {
        List<T> dynServices = new ArrayList<>();
        if (dynamicServices.containsKey(serviceInterface.getName())) {
            Set<String> deregister = new HashSet<>();
            for (String serviceClassName : dynamicServices.get(serviceInterface.getName())) {
                try {
                    Class<?> clazz = CompiledJavaCache.getClassFromAssetName(null, serviceClassName);
                    if (clazz != null)  {
                        RegisteredService rs = (RegisteredService)(clazz).newInstance();
                        dynServices.add(serviceInterface.cast(rs));
                    }
                } catch (Exception ex) {
                    logger.severeException("Failed to get Dynamic Java service : " + serviceClassName + " (removing from registry)", ex);
                    deregister.add(serviceClassName);
                }
            }
            // avoid repeated attempts to recompile until cache is refreshed
            dynamicServices.get(serviceInterface.getName()).removeAll(deregister);
        }
        return dynServices;
    }
364025
public List<String> getRunningServiceIds() {
        List<ServiceReference<Domain>> serviceReferences = osgiUtilsService.listServiceReferences(Domain.class);
        List<String> result = new ArrayList<String>();
        for (ServiceReference<Domain> ref : serviceReferences) {
            result.add((String) ref.getProperty(org.osgi.framework.Constants.SERVICE_PID));
        }
        return result;
    }
1222212
private <T> List<ServiceReference> getAllServiceRefs(Class<T> klass) {
        ServiceReference[] importDeclarationsRef;
        try {
            importDeclarationsRef = context.getAllServiceReferences(klass.getName(), null);
        } catch (InvalidSyntaxException e) {
            LOG.error("Failed to retrieved services " + klass.getName(), e);
            return new ArrayList<ServiceReference>();
        }
        if (importDeclarationsRef != null) {
            return Arrays.asList(importDeclarationsRef);
        }
        return new ArrayList<ServiceReference>();
    }
603680
@Override
    public List<ServiceRef> getServiceRefs() {
        List<ServiceRef> returnValue = delegate == null ? new ArrayList<ServiceRef>() : new ArrayList<ServiceRef>(delegate.getServiceRefs());

        returnValue.addAll(serviceRefTypeMap.values());
        returnValue.addAll(ejbServiceRefTypeMap.values());

        return returnValue;
    }
717242
public static <T> List<T> getServices(Class<T> intf) {
        List<T> ret = new ArrayList<T>();

        for (T service : ServiceLoader.load(intf)) {
            if (!(service instanceof ServiceStatus) || ((ServiceStatus)service).isAvailable()) {
                if (service instanceof ServiceLifecycle) {
                    ((ServiceLifecycle)service).init();
                }

                ret.add(service);
            }
        }

        return ret;
    }
941362
@Override
  public Set<String> getProcessApplicationNames() {
    List<JmxManagedProcessApplication> processApplications = serviceContainer.getServiceValuesByType(ServiceTypes.PROCESS_APPLICATION);
    Set<String> processApplicationNames = new HashSet<String>();
    for (JmxManagedProcessApplication jmxManagedProcessApplication : processApplications) {
      processApplicationNames.add(jmxManagedProcessApplication.getProcessApplicationName());
    }
    return processApplicationNames;
  }
1356536
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201902.CustomTargetingServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201902.CustomTargetingServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201902.CustomTargetingServiceSoapBindingStub(new java.net.URL(CustomTargetingServiceInterfacePort_address), this);
                _stub.setPortName(getCustomTargetingServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
653886
public List<JavaResource> getProjectInterfaces(Project project)
   {
      final List<JavaResource> classes = new ArrayList<>();
      if (project != null)
      {
         project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaInterfaceSourceVisitor(classes));
      }
      return classes;
   }
578365
public static List<Service> getServices(List<ServiceId> ids) {
        ProviderList list = Providers.getProviderList();
        return list.getServices(ids);
    }
1059526
public DruidNodeDiscovery getForService(String serviceName)
  {
    return serviceDiscoveryMap.computeIfAbsent(
        serviceName,
        service -> {

          Set<NodeType> nodeTypesToWatch = DruidNodeDiscoveryProvider.SERVICE_TO_NODE_TYPES.get(service);
          if (nodeTypesToWatch == null) {
            throw new IAE("Unknown service [%s].", service);
          }
          ServiceDruidNodeDiscovery serviceDiscovery = new ServiceDruidNodeDiscovery(service, nodeTypesToWatch.size());
          DruidNodeDiscovery.Listener filteringGatheringUpstreamListener =
              serviceDiscovery.filteringUpstreamListener();
          for (NodeType nodeType : nodeTypesToWatch) {
            getForNodeType(nodeType).registerListener(filteringGatheringUpstreamListener);
          }
          return serviceDiscovery;
        }
    );
  }
1179516
public BrokerServiceAccessor getServiceAccessor(String serviceId) {
        for (BrokerServiceAccessor serviceAccessor : serviceAccessors) {
            if (serviceId.equals(serviceAccessor.getServiceDescription().getId())) {
                return serviceAccessor;
            }
        }

        throw new NotFoundException("Could not find service broker with service_id " + serviceId);
    }
811030
public ArrayList<Long> serviceName_monitoringNotifications_GET(String serviceName) throws IOException {
		String qPath = "/xdsl/{serviceName}/monitoringNotifications";
		StringBuilder sb = path(qPath, serviceName);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t15);
	}
394344
public List<HandlerType<ServiceRefType<T>>> getAllHandler()
   {
      List<HandlerType<ServiceRefType<T>>> list = new ArrayList<HandlerType<ServiceRefType<T>>>();
      List<Node> nodeList = childNode.get("handler");
      for(Node node: nodeList)
      {
         HandlerType<ServiceRefType<T>>  type = new HandlerTypeImpl<ServiceRefType<T>>(this, "handler", childNode, node);
         list.add(type);
      }
      return list;
   }
1316895
public List<ServiceReference> getReferences(String resourceType) {
		List<ServiceReference> references = new ArrayList<ServiceReference>();
		if (containsKey(resourceType)) {
			references.addAll(get(resourceType));
			Collections.sort(references, new Comparator<ServiceReference>() {
				@Override
				public int compare(ServiceReference r0, ServiceReference r1) {
					Integer p0 = OsgiUtil.toInteger(
							r0.getProperty(ComponentBindingsProvider.PRIORITY),
							0);
					Integer p1 = OsgiUtil.toInteger(
							r1.getProperty(ComponentBindingsProvider.PRIORITY),
							0);
					return -1 * p0.compareTo(p1);
				}

			});
		}
		return references;
	}
201404
public ServiceReference<?>[] fetchReferences() {
        try {
            LOGGER.debug("Try to locate a suitable service for objectClass = "
                    + serviceInterface + " and filter = " + filterString);
            return bundleContext.getAllServiceReferences(serviceInterface, filterString);
        } catch (InvalidSyntaxException e) {
            LOGGER.error("Creation of filter failed: {}", e.getMessage(), e);
            throw new RuntimeException("Creation of filter failed", e);
        }
    }
928253
public <T extends ServiceConfiguration<?>> List<T> getExistingServiceConfigurations(Class<T> clazz) {
    ArrayList<T> results = new ArrayList<>();
    for (ServiceConfiguration<?> serviceConfiguration : serviceConfigurations) {
      if (clazz.equals(serviceConfiguration.getClass())) {
        results.add(clazz.cast(serviceConfiguration));
      }
    }
    return results;
  }
967196
public OvhServiceMonitoring serviceName_serviceMonitoring_monitoringId_GET(String serviceName, Long monitoringId) throws IOException {
		String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}";
		StringBuilder sb = path(qPath, serviceName, monitoringId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhServiceMonitoring.class);
	}