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));
    }
static Library getSharedLibrary ( String id ) { if ( bundleContext == null ) { return null ; } 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.

@return A library with the given id or <code>null</code> if no match was found