class DBService implements RolesProvider {

    PublicKeyEntry getServicePublicKeyEntry(String domainName, String serviceName,
            String keyId, boolean domainStateCheck) {

        try (ObjectStoreConnection con = store.getConnection(true, false)) {
            return con.getPublicKeyEntry(domainName, serviceName, keyId, domainStateCheck);
        } catch (ResourceException ex) {
            if (ex.getCode() != ResourceException.SERVICE_UNAVAILABLE) {
                throw ex;
            }
        }
        
        // if we got this far it means we couldn't get our public key
        // from our DB store either due to timeout or communication
        // error so we're going to see if we have the public key in
        // our cache and use that for our requests
        
        PublicKeyEntry keyEntry = getPublicKeyFromCache(domainName, serviceName, keyId);
        if (keyEntry == null) {
            throw new ResourceException(ResourceException.SERVICE_UNAVAILABLE,
                    "Unable to retrieve public key from DB store");
        }
        return keyEntry;
    }

    public  DBService(ObjectStore store, AuditLogger auditLogger, ZMSConfig zmsConfig, AuditReferenceValidator auditReferenceValidator);

}