use of com.axway.ats.common.filetransfer.FileTransferException in project ats-framework by Axway.
the class ClientFactory method getClient.
/**
* Returns a product specific {@link IFileTransferClient} that handles transfers via the specified {@link TransferProtocol}.
*
* @param protocol the {@link TransferProtocol} to use
* @param port a custom port to use when connecting
* @return the {@link IFileTransferClient} that handles transfers via the specified {@link TransferProtocol}
* @throws FileTransferException
* @see {@link TransferProtocol}
*/
public IFileTransferClient getClient(TransferProtocol protocol, int port) throws FileTransferException {
switch(protocol) {
case FTP:
FtpClient ftp = new FtpClient();
ftp.setCustomPort(port);
return ftp;
case FTPS:
FtpsClient ftps = new FtpsClient();
ftps.setCustomPort(port);
return ftps;
case SFTP:
SftpClient sftp = new SftpClient();
sftp.setCustomPort(port);
return sftp;
case HTTP:
FileTransferHttpClient http = new FileTransferHttpClient();
http.setCustomPort(port);
return http;
case HTTPS:
FileTransferHttpClient https = new FileTransferHttpClient();
https.setOverSsl(true);
https.setCustomPort(port);
return https;
default:
throw new FileTransferException("No implementation for the " + protocol + " protocol is currently available");
}
}
Aggregations