Class ZipURLInstaller

  • All Implemented Interfaces:
    Installer, Loggable

    public class ZipURLInstaller
    extends LoggedObject
    implements Installer
    Installs a zipped container file from a URL to a location on your local disk.
    • Constructor Detail

      • ZipURLInstaller

        public ZipURLInstaller​(URL remoteLocation)
        Parameters:
        remoteLocation - URL where the zipped container is located
      • ZipURLInstaller

        public ZipURLInstaller​(URL remoteLocation,
                               String downloadDir,
                               String extractDir)
        Parameters:
        remoteLocation - URL where the zipped container is located
        downloadDir - directory where the zipped container install will be downloaded.
        extractDir - directory where the zipped container install will be extracted.
    • Method Detail

      • setDownloadDir

        public void setDownloadDir​(String downloadDir)
        Parameters:
        downloadDir - the destination directory where the zipped container install will be downloaded.
      • setExtractDir

        public void setExtractDir​(String extractDir)
        Parameters:
        extractDir - the destination directory where the zipped container install will be installed.
      • getDownloadDir

        public String getDownloadDir()
        Returns:
        The destination directory where the zipped container install will be downloaded.
      • getDownloadFile

        public String getDownloadFile()
        Returns:
        The destination file where the zipped container install will be downloaded.
      • getExtractDir

        public String getExtractDir()
        Returns:
        The destination directory where the zipped container install will be extracted.
      • getFileHandler

        public FileHandler getFileHandler()
        Returns:
        the file utility class to use for performing all file I/O.
      • setFileHandler

        public void setFileHandler​(FileHandler fileHandler)
        Parameters:
        fileHandler - the file utility class to use for performing all file I/O.
      • registerInstallation

        public void registerInstallation()
        Create timestamp file to register that the installation has been successful. This allows to prevent installing again next time. If the remote URL changes, then the container will be reinstalled.
      • isAlreadyDownloaded

        public boolean isAlreadyDownloaded()
        Returns:
        true if the container has already been downloaded, false otherwise
      • isAlreadyExtracted

        public boolean isAlreadyExtracted()
        Returns:
        true if the container has already been extracted, false otherwise
      • getHome

        public String getHome()
        Specified by:
        getHome in interface Installer
        Returns:
        the directory where the container has been installed. Note that we're returning a String instead of a File because we want to leave the possibility of using URIs for specifying the home location.
      • download

        public void download()
        Downloads the zip file containing the container files.
      • doDownload

        protected void doDownload()
                           throws IOException
        Perform the actual HTTP download.
        Throws:
        IOException - if any I/O exception occurs (with the URL connection or file streams)
      • getSourceFileName

        protected String getSourceFileName()
        Returns:
        the name of the source zip file (without the path)
      • setProxy

        public void setProxy​(Proxy proxy)
        Sets proxy details.
        Parameters:
        proxy - the proxy configuration to set