final String url = downloadLocation;
final String msg = "No protocol for " + protocol;
throw new ResourceDownloadError(url, msg);
}
ProtocolHandler protocolHandler = null;
switch (supportedProtocol) {
case FILE:
protocolHandler = new FileProtocolHandler();
break;
case HTTP:
protocolHandler = new HttpProtocolHandler();
break;
case HTTPS:
protocolHandler = new HttpsProtocolHandler();
break;
case SFTP:
protocolHandler = new SftpProtocolHandler();
break;
case FTP:
protocolHandler = new FTPProtocolHandler();
break;
default:
final String url = downloadLocation;
final String msg = "No case for " + supportedProtocol;
throw new ResourceDownloadError(url, msg);
}
return protocolHandler.downloadResource(resourceLocation,
downloadLocation);
}