Class BundleContextServiceLocator

    • Constructor Detail

      • BundleContextServiceLocator

        public BundleContextServiceLocator​(org.osgi.framework.BundleContext bundleContext)
    • Method Detail

      • findSingleService

        public <T> T findSingleService​(Class<T> clazz,
                                       java.util.function.Predicate<T> postFilter,
                                       String bundleContextFilter)
        Description copied from interface: ServiceLocator
        Finds a service registered with the OSGI Service Registry of type clazz. If a bundleContextFilter is provided, it is used to query for the service, e.g. "(operation.label=My Label*)". In addition each clazz of type T found in the OSGI Service Registry must afterwards pass the provided postFilter. If multiple services are found, only the first one is returned.
        Specified by:
        findSingleService in interface ServiceLocator
        Returns:
        A object of type clazz or null.
      • findServices

        public <T> List<T> findServices​(Class<T> clazz,
                                        String query)
        Description copied from interface: ServiceLocator
        Find services of class clazz registered in the OSGI Service Registry. The optional filter criteria query is used.
        Specified by:
        findServices in interface ServiceLocator
        Returns:
        All found services registered in the OSGI Service Registry of type clazz.