class RepositoryRequestFactory {

    public HttpUriRequest create(String url, DownloadOptions options) {
        try {
            if (options.isAuthenticationNeeded()) {
                return requestFactory.authenticatedGet(url, options.getUsername(), options.getPassword());
            } else {
                return requestFactory.get(url);
            }
        } catch (Exception e) {
            throw new RuntimeException("Error while creating the http request", e);
        }
    }

}