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 ) ; }
Checks the OSGi ServiceRegistry if a service matching the given filter is present .