com.github.nscuro.wdm.binary.BinaryDownloader Maven / Gradle / Ivy
Show all versions of webdriver-manager Show documentation
package com.github.nscuro.wdm.binary;
import com.github.nscuro.wdm.Architecture;
import com.github.nscuro.wdm.Browser;
import com.github.nscuro.wdm.Os;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
public interface BinaryDownloader {
/**
* Indicate whether or not a given {@link Browser} is supported.
*
* @param browser The {@link Browser} to check support for
* @return true when it's supported, otherwise false
*/
boolean supportsBrowser(final Browser browser);
/**
* Download a specific binary version and deploy it to the given destination directory.
*
* Note that each {@link BinaryDownloader} implementation must detect if the desired binary
* was already downloaded and decide whether or not to download it again.
*
* @param version The binary version to download (not the browser version)
* @param os The operating system the binary must be compatible with
* @param architecture The architecture the binary must be compatible with
* @param destinationDirPath Path to the directory the binary shall be deployed to
* @return A {@link File} handle of the downloaded binary
* @throws IOException When downloading the binary failed
*/
@Nonnull
File download(final String version, final Os os, final Architecture architecture, final Path destinationDirPath) throws IOException;
/**
* Download the latest binary version and deploy it to the given destination directory.
*
* Note that each {@link BinaryDownloader} implementation must detect if the desired binary
* was already downloaded and decide whether or not to download it again.
*
* @param os The operating system the binary must be compatible with
* @param architecture The architecture the binary must be compatible with
* @param destinationDirPath Path to the directory the binary shall be deployed to
* @return A {@link File} handle of the downloaded binary
* @throws IOException When downloading the binary failed
* @see #download(String, Os, Architecture, Path)
*/
@Nonnull
File downloadLatest(final Os os, final Architecture architecture, final Path destinationDirPath) throws IOException;
}