class TrustAnchorRetrievalService {

    public byte[] fetchTrustAnchorCertificate(URI trustAnchorCertificateURI, ValidationResult validationResult) {
        try {
            switch (trustAnchorCertificateURI.getScheme()) {
                case "rsync":
                    return fetchRsyncTrustAnchorCertificate(trustAnchorCertificateURI, validationResult);
                case "https":
                    return fetchHttpsTrustAnchorCertificate(trustAnchorCertificateURI, validationResult);
                case "file":
                    return fetchFileTrustAnchorCertificate(trustAnchorCertificateURI, validationResult);
                default:
                    validationResult.warn(ErrorCodes.TRUST_ANCHOR_FETCH, trustAnchorCertificateURI.toASCIIString(), "Unsupported URI");
                    return null;
            }
        } catch (IOException e) {
            validationResult.warn(ErrorCodes.TRUST_ANCHOR_FETCH, trustAnchorCertificateURI.toASCIIString(), e.getMessage());
            return null;
        }
    }

}