static Library getSharedLibrary ( String id ) { if ( bundleContext == null ) { return null ; } // Filter the SharedLibrary service references by ID. String filter = "(" + "id=" + id + ")" ; Collection < ServiceReference < Library > > refs = null ; try { refs = bundleContext . getServiceReferences ( Library . class , filter ) ; } catch ( InvalidSyntaxException e ) { if ( tc . isErrorEnabled ( ) ) { Tr . error ( tc , "cls.library.id.invalid" , id , e . toString ( ) ) ; } return null ; } if ( refs . isEmpty ( ) ) return null ; return bundleContext . getService ( getHighestRankedService ( refs ) ) ; }
Retrieve a library from the service registry .