Search in sources :

Example 1 with HttpsDirectDownloadCommand

use of org.apache.cloudstack.agent.directdownload.HttpsDirectDownloadCommand in project cloudstack by apache.

the class DirectDownloadManagerImpl method getDirectDownloadCommandFromProtocol.

/**
 * Return DirectDownloadCommand according to the protocol
 */
private DirectDownloadCommand getDirectDownloadCommandFromProtocol(DownloadProtocol protocol, String url, Long templateId, PrimaryDataStoreTO destPool, String checksum, Map<String, String> httpHeaders) {
    int connectTimeout = DirectDownloadConnectTimeout.value();
    int soTimeout = DirectDownloadSocketTimeout.value();
    int connectionRequestTimeout = DirectDownloadConnectionRequestTimeout.value();
    if (protocol.equals(DownloadProtocol.HTTP)) {
        return new HttpDirectDownloadCommand(url, templateId, destPool, checksum, httpHeaders, connectTimeout, soTimeout);
    } else if (protocol.equals(DownloadProtocol.HTTPS)) {
        return new HttpsDirectDownloadCommand(url, templateId, destPool, checksum, httpHeaders, connectTimeout, soTimeout, connectionRequestTimeout);
    } else if (protocol.equals(DownloadProtocol.NFS)) {
        return new NfsDirectDownloadCommand(url, templateId, destPool, checksum, httpHeaders);
    } else if (protocol.equals(DownloadProtocol.METALINK)) {
        return new MetalinkDirectDownloadCommand(url, templateId, destPool, checksum, httpHeaders, connectTimeout, soTimeout);
    } else {
        return null;
    }
}
Also used : MetalinkDirectDownloadCommand(org.apache.cloudstack.agent.directdownload.MetalinkDirectDownloadCommand) HttpDirectDownloadCommand(org.apache.cloudstack.agent.directdownload.HttpDirectDownloadCommand) NfsDirectDownloadCommand(org.apache.cloudstack.agent.directdownload.NfsDirectDownloadCommand) HttpsDirectDownloadCommand(org.apache.cloudstack.agent.directdownload.HttpsDirectDownloadCommand)

Aggregations

HttpDirectDownloadCommand (org.apache.cloudstack.agent.directdownload.HttpDirectDownloadCommand)1 HttpsDirectDownloadCommand (org.apache.cloudstack.agent.directdownload.HttpsDirectDownloadCommand)1 MetalinkDirectDownloadCommand (org.apache.cloudstack.agent.directdownload.MetalinkDirectDownloadCommand)1 NfsDirectDownloadCommand (org.apache.cloudstack.agent.directdownload.NfsDirectDownloadCommand)1